spk 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 | 69ed9cf3a2dc |
children | 7cd8650b22ae |
files | spk-rm |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/spk-rm Fri May 11 17:04:26 2012 +0200 1.3 @@ -0,0 +1,62 @@ 1.4 +#!/bin/sh 1.5 +# 1.6 +# Spk-rm - Remove SliTaz packages. Read the README before adding or 1.7 +# modifing any code in spk! 1.8 +# 1.9 +# Copyright (C) SliTaz GNU/Linux - BSD License 1.10 +# Author: See AUTHORS files 1.11 +# 1.12 +#. /usr/lib/slitaz/libspk.sh 1.13 +. lib/libspk.sh 1.14 + 1.15 +# 1.16 +# Functions 1.17 +# 1.18 + 1.19 +# Help and usage 1.20 +usage() { 1.21 + name=$(basename $0) 1.22 + cat << EOT 1.23 + 1.24 +$(boldify $(gettext "Usage:")) [package|--option] [pkg2 ... pkgN|--opt2] 1.25 + 1.26 +$(boldify $(gettext "Options:")) 1.27 + 1.28 +$(boldify $(gettext "Examples:")) 1.29 + 1.30 +EOT 1.31 + exit 0 1.32 +} 1.33 + 1.34 +# 1.35 +# Commands 1.36 +# 1.37 + 1.38 +case "$1" in 1.39 + "") usage ;; 1.40 + *) 1.41 + count=0 1.42 + for pkg in $@ 1.43 + do 1.44 + [ -d "$installed/$pkg" ] || continue 1.45 + count=$(($count + 1)) 1.46 + [ "$count" == 1 ] && echo "" 1.47 + gettext "Removing"; echo " $pkg" 1.48 + separator 1.49 + # Handle --confirm 1.50 + if [ "$confirm" ]; then 1.51 + gettext "Confirm uninstalltion of:"; echo " $pkg" 1.52 + gettext "Anser [y|Y|yes] or [n|N|no] : " 1.53 + # A read_anser function ? 1.54 + read anser 1.55 + case "$anser" in 1.56 + y|Y|yes) ;; 1.57 + *) 1.58 + gettext "Uninstallation canceled" 1.59 + echo -e "\n" && exit 0 ;; 1.60 + esac 1.61 + fi 1.62 + gettext "TODO"; echo 1.63 + done ;; 1.64 +esac 1.65 +exit 0