std.c: Improve some comments
[sunny256-utils.git] / multiapt
blob63851f414770a3e495ed87cc774a19bcc5a62eec
1 #!/usr/bin/env bash
3 #=======================================================================
4 # multiapt
5 # File ID: ffa9a0ac-28af-11e4-9136-c80aa9e67bbd
6 # [Description]
7 # License: GNU General Public License version 2 or later.
8 #=======================================================================
10 progname=multiapt
12 cmd_str=install
13 test "$1" = "-r" && { cmd_str=remove; shift; }
14 test "$1" = "-u" && { cmd_str=upgrade; shift; }
16 if test -e "/gitrepos.txt"; then
17 cd /
18 git update-dirs $(cat gitrepos.txt) -q -e "git wait-until-clean"
21 for f in "$@"; do
22 cd /etc || { echo $progname: Cannot chdir to /etc >&2; exit 1; }
23 echo
24 if test "$cmd_str" = "remove"; then
25 echo apt-get remove $f
26 apt-get remove $f
27 else
28 echo apt-get install $f
29 apt-get install "$f"
31 if test "$cmd_str" = "install"; then
32 ciall -d -y apt-get install $f
33 elif test "$cmd_str" = "upgrade"; then
34 ciall -d -y upgrade package $f
35 elif test "$cmd_str" = "remove"; then
36 ciall -d -y apt-get remove $f
37 else
38 echo $progname: invalid \$cmd_str value: \"$cmd_str\" >&2
39 exit 1
41 if test -e "/gitrepos.txt"; then
42 cd /
43 if test "$cmd_str" = "install"; then
44 git update-dirs $(cat gitrepos.txt) -e "ciall -y apt-get install $f"
45 elif test "$cmd_str" = "upgrade"; then
46 git update-dirs $(cat gitrepos.txt) -e "ciall -y upgrade package $f"
47 elif test "$cmd_str" = "remove"; then
48 git update-dirs $(cat gitrepos.txt) -e "ciall -y apt-get remove $f"
51 done