summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2012-02-23 14:29:46 +0100
committerDaniel Friesel <derf@finalrewind.org>2012-02-23 14:29:46 +0100
commitbf0b5456245e2c03ccab53ead2a8e2f59a76606b (patch)
treeefdeb61e420142762960769f884f3dcb9c6277cf
parent4bc73d2ebb7ecdc422075918062428c302836bd8 (diff)
Add sh version of pkglist script (patch by Simon Campese)
-rw-r--r--examples/pkglist-sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/examples/pkglist-sh b/examples/pkglist-sh
new file mode 100644
index 0000000..aa60fba
--- /dev/null
+++ b/examples/pkglist-sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+## on the PKG_HOST: list available packages
+## non-zsh version
+## used by ct update remote
+
+if [ -z ${PKG_PATH} -o -z ${PKG_PROTO} ]; then
+ echo "PKG_PATH and PKG_PROTO must be set while running ${0}" >&2
+ exit 1
+fi
+
+if [ ! -d ${PKG_PATH} ]; then
+ echo "${0}: package root directory '${PKG_PATH}' does not exist!" >&2
+ exit 1
+fi
+
+set -e
+
+cd ${PKG_PATH}
+
+for dir in $(find . -type d -mindepth 1 -maxdepth 1 ! -name ".?*"); do
+ # git repo
+ if [ -d ${dir}/.git ]; then
+ echo -n "${dir} git "
+ echo -n $(git --git-dir=${dir}/.git log -n 1 | cut -d ' ' -f 2)
+ echo " ${PKG_PROTO}://${PKG_UAH}/${PKG_PATH}/${dir}/.git"
+ elif [ -d ${dir}/objects -a -d ${dir}/refs ]; then
+ # bare git repo
+ echo -n "${dir} git "
+ echo -n $(git --git-dir=${dir} log -n 1 | cut -d ' ' -f 2)
+ echo " ${PKG_PROTO}://${PKG_UAH}/${PKG_PATH}/${dir}"
+ else
+ # unknown
+ echo "${dir}: Unsupported or no repository" >&2
+ fi
+done
+
+