# HG changeset patch # User Christophe Lincoln # Date 1337103344 -7200 # Node ID daf5adaaa87bf10f0bcacbc25ebcbee2b38d880b # Parent 1e166d1364d7618c8c933c26c2bf9ba8716c36aa spk-add: some colors, improvments, usage diff -r 1e166d1364d7 -r daf5adaaa87b lib/libspk.sh --- a/lib/libspk.sh Tue May 15 19:02:53 2012 +0200 +++ b/lib/libspk.sh Tue May 15 19:35:44 2012 +0200 @@ -100,7 +100,7 @@ check_installed() { local name="$1" if [ -d "$installed/$name" ]; then - echo $(boldify "$name") $(gettext "package is already installed.") + echo $(boldify "$name") $(gettext "package is already installed") continue fi } @@ -145,7 +145,7 @@ for pkgorg in $depends; do local pkg=$(equivalent_pkg $pkgorg) if [ ! -d "$installed/$pkg" ]; then - gettext "Missing: \$pkg"; newline + gettext "Missing:"; echo " $pkg" deps=$(($deps+1)) elif [ ! -f "$installed/$pkg/receipt" ]; then gettext "WARNING Dependency loop between \$package and \$pkg."; newline @@ -155,7 +155,8 @@ echo $deps $(gettext "missing package(s) to install.") fi - gettext "\$deps missing package(s) to install."; newline + echo -n "$(colorize "$deps" 34) " + gettext "missing dep(s) to install."; newline # Return true if missing deps [ "$deps" != "0" ] diff -r 1e166d1364d7 -r daf5adaaa87b spk-add --- a/spk-add Tue May 15 19:02:53 2012 +0200 +++ b/spk-add Tue May 15 19:35:44 2012 +0200 @@ -27,6 +27,8 @@ $(gettext "Install SliTaz Packages") $(boldify $(gettext "Options:")) + --forced $(gettext "Force package reinstallation") + --root= $(gettext "Set the root file system path") $(boldify $(gettext "Examples:")) $name package1 package2 packageN @@ -259,8 +261,6 @@ install_web() { local package_name="$1" - check_root - # Check if get-Package if ! is_package_mirrored $package_name; then package_name="get-$package_name" @@ -283,18 +283,17 @@ cd $CACHE_DIR > /dev/null if [ -f "$package_full.tazpkg" ]; then - eval_gettext "\$package_full is already in the cache : \$CACHE_DIR"; newline + echo -n "$(colorize "$package_full" 34) "; echo ": $CACHE_DIR)" # Check package download was finished if ! tail -c 2k $package_full.tazpkg | fgrep -q 00000000TRAILER; then eval_gettext "Continuing \$package_name download"; newline download "$package_full.tazpkg" fi - # Check that the package has the correct checksum -# if [ "$($CHECKSUM $package_full.tazpkg)" != "$(fgrep \" $package_full.tazpkg\" $pkgsmd5)" ]; then -# rm -f $package.tazpkg -# download "$package_full.tazpkg" -# fi + #if [ "$($CHECKSUM $package_full.tazpkg)" != "$(fgrep \" $package_full.tazpkg\" $pkgsmd5)" ]; then + # rm -f $package.tazpkg + # download "$package_full.tazpkg" + #fi else newline download "$package_full.tazpkg" @@ -338,15 +337,12 @@ fi } -# Old style -case $1 in - install|-i) - install_local $2 $3 - exit 0 ;; - get-install|-gi) - install_web $2 - exit 0 ;; - "") usage ;; +# +# Commands and exit +# + +case "$1" in + ""|*usage|*help) usage ;; esac # @@ -358,9 +354,15 @@ for pkg in $@ do case "$pkg" in - *.tazpkg|.spk) - echo "Local package" ;; + *.tazpkg|*.spk) + [ "$forced" ] || check_installed $(package_name $package_file) + echo "Local package" + #install_local $pkg + ;; + --*) continue ;; + *) + [ "$forced" ] || check_installed $pkg + install_web $pkg ;; esac - echo "Adding: $pkg" done exit 0 diff -r 1e166d1364d7 -r daf5adaaa87b spk-ls --- a/spk-ls Tue May 15 19:02:53 2012 +0200 +++ b/spk-ls Tue May 15 19:35:44 2012 +0200 @@ -26,7 +26,7 @@ --mirror $(gettext "List all the packages on mirror") --blocked $(gettext "List all blocked packages") --short $(gettext "Short list of installed packages") - --root $(gettext "Set the root file system path") + --root= $(gettext "Set the root file system path") --color=NB $(gettext "Set package name color in list") --debug $(gettext "Display some usefull debug information") diff -r 1e166d1364d7 -r daf5adaaa87b spk-rm --- a/spk-rm Tue May 15 19:02:53 2012 +0200 +++ b/spk-rm Tue May 15 19:35:44 2012 +0200 @@ -23,7 +23,7 @@ $(boldify $(gettext "Options:")) --confirm $(gettext "Ask before removing any packages") - --root $(gettext "Set the root file system path") + --root= $(gettext "Set the root file system path") --verbose $(gettext "Be more verbose when removing files") $(boldify $(gettext "Examples:"))