#!/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 - repackage an installed package install: install a package, - 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