]> pd.if.org Git - zpackage/blobdiff - bin/zpm
move programs to bin for build
[zpackage] / bin / zpm
diff --git a/bin/zpm b/bin/zpm
new file mode 100755 (executable)
index 0000000..06599ac
--- /dev/null
+++ b/bin/zpm
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# parse command line options
+while getopts P: opt; do
+       case $opt in
+               P) PATH=$OPTARG:$PATH ;;
+               *) printf "zpm unknown option '%s'\n" "$opt"; exit 1 ;;
+       esac
+done
+shift $((OPTIND - 1))
+
+#: ${ZPMPATH:=/usr/libexec/zpm}
+
+if [ -n "$ZPMPATH" ]; then
+       PATH="$PATH:$ZPMPATH"
+fi
+export PATH
+
+[ -z "$1" ] && set help
+cmd="$1"
+shift
+
+die() {
+       echo $*
+       exit 1;
+}
+
+# read in config files
+
+test -r /etc/zpmrc && . /etc/zpmrc
+test -r $HOME/.zpmrc && . $HOME/zpmrc
+test -r .zpmrc && . .zpmrc
+
+case $cmd in
+       help)
+               ecmd=$(command -v "zpm-$cmd") && { exec "$ecmd" "$@" || die "$0: unknown command zpm help"; }
+               find $(echo $PATH | tr ':' ' ') -maxdepth 1 -type f -name 'zpm-*' -executable -printf '%P\n'
+               ;;
+       *)
+               ecmd=$(command -v "zpm-$cmd") || die "$0: unknown command $cmd $@"
+               exec "$ecmd" "$@" || die "$0: could not exec $ecmd"
+               ;;
+esac
+
+exit 0
+
+note: add/edit a note file, - from stdin, list if none
+ack: acknowledge a note file
+
+build:
+       build a package from source
+       - take file names on stdin and build package from them
+       - <name> repackage an installed package
+
+install: install a package, - <name> for from a file
+
+remove: remove a package
+
+db: edit package databases used for finding packages
+
+info: get information on a package
+
+track: add a package to config tracked packages
+
+add: add to a repository/database
+
+clean: clean a repository/database
+
+update: update a package, or all if no name