]> pd.if.org Git - zpackage/blob - zpm
add -P option to zpm to add to exec path
[zpackage] / zpm
1 #!/bin/sh
2
3 # parse command line options
4 while getopts P: opt; do
5         case $opt in
6                 P) PATH=$PATH:$OPTARG ;;
7                 *) printf "zpm unknown option '%s'\n" "$opt"; exit 1 ;;
8         esac
9 done
10 shift $((OPTIND - 1))
11
12 : ${ZPMPATH:=/usr/libexec/zpm}
13
14 PATH="$PATH:$ZPMPATH"
15 export PATH
16
17 [ -z "$1" ] && set help
18 cmd="$1"
19 shift
20
21 die() {
22         echo $*
23         exit 1;
24 }
25
26 # read in config files
27
28 test -r /etc/zpmrc && . /etc/zpmrc
29 test -r $HOME/.zpmrc && . $HOME/zpmrc
30 test -r .zpmrc && . .zpmrc
31
32 case $cmd in
33         help)
34                 ecmd=$(command -v "zpm-$cmd") && { exec "$ecmd" "$@" || die "$0: unknown command zpm help"; }
35                 find $(echo $PATH | tr ':' ' ') -maxdepth 1 -type f -name 'zpm-*' -executable -printf '%P\n'
36                 ;;
37         *)
38                 ecmd=$(command -v "zpm-$cmd") || die "$0: unknown command $cmd $@"
39                 exec "$ecmd" "$@" || die "$0: could not exec $ecmd"
40                 ;;
41 esac
42
43 exit 0
44
45 note: add/edit a note file, - from stdin, list if none
46 ack: acknowledge a note file
47
48 build:
49         build a package from source
50         - take file names on stdin and build package from them
51         - <name> repackage an installed package
52
53 install: install a package, - <name> for from a file
54
55 remove: remove a package
56
57 db: edit package databases used for finding packages
58
59 info: get information on a package
60
61 track: add a package to config tracked packages
62
63 add: add to a repository/database
64
65 clean: clean a repository/database
66
67 update: update a package, or all if no name