#!/usr/bin/env zsh ## on the PKG_HOST: list available packages ## used by ct remote-update # the PKG_PATH (package root path) is given as first argument ($1) if [[ ! -d $1 ]] { echo "$0: package root directory '$1' does not exist!" >&2 exit 1 } # change into package root directory (first argument) cd $1 for i in *(-/); { if [[ -d $i/.git ]] { echo -n "$i git " echo ${$(git --git-dir=$i/.git log -n 1)[2]} } elif [[ -d $i/objects && -d $i/refs ]] { echo -n "$i git " echo ${$(git --git-dir=$i log -n 1)[2]} } else { echo "$i: Unsupported or no repository" >&2 } }