spk view spk-rm @ rev 8

Add spk-rm (make it standard and then use it as skeleton for other tools), main spk tool will folow
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 11 17:04:26 2012 +0200 (2012-05-11)
parents
children 7cd8650b22ae
line source
1 #!/bin/sh
2 #
3 # Spk-rm - Remove SliTaz packages. Read the README before adding or
4 # modifing any code in spk!
5 #
6 # Copyright (C) SliTaz GNU/Linux - BSD License
7 # Author: See AUTHORS files
8 #
9 #. /usr/lib/slitaz/libspk.sh
10 . lib/libspk.sh
12 #
13 # Functions
14 #
16 # Help and usage
17 usage() {
18 name=$(basename $0)
19 cat << EOT
21 $(boldify $(gettext "Usage:")) [package|--option] [pkg2 ... pkgN|--opt2]
23 $(boldify $(gettext "Options:"))
25 $(boldify $(gettext "Examples:"))
27 EOT
28 exit 0
29 }
31 #
32 # Commands
33 #
35 case "$1" in
36 "") usage ;;
37 *)
38 count=0
39 for pkg in $@
40 do
41 [ -d "$installed/$pkg" ] || continue
42 count=$(($count + 1))
43 [ "$count" == 1 ] && echo ""
44 gettext "Removing"; echo " $pkg"
45 separator
46 # Handle --confirm
47 if [ "$confirm" ]; then
48 gettext "Confirm uninstalltion of:"; echo " $pkg"
49 gettext "Anser [y|Y|yes] or [n|N|no] : "
50 # A read_anser function ?
51 read anser
52 case "$anser" in
53 y|Y|yes) ;;
54 *)
55 gettext "Uninstallation canceled"
56 echo -e "\n" && exit 0 ;;
57 esac
58 fi
59 gettext "TODO"; echo
60 done ;;
61 esac
62 exit 0