# HG changeset patch # User Christophe Lincoln # Date 1204152231 -3600 # Node ID 77cd0a789c388c98e39e69f4e042ddccf11cf180 # Parent 549f4948508b43bb402af2c848cf2935007dc9d4 Add: Tazpkg SHell mode diff -r 549f4948508b -r 77cd0a789c38 tazpkg --- a/tazpkg Wed Feb 27 19:12:12 2008 +0100 +++ b/tazpkg Wed Feb 27 23:43:51 2008 +0100 @@ -67,10 +67,10 @@ mkdir -p $CACHE_DIR fi if [ ! -d "$INSTALLED" ]; then - mkdir -p $INSTALLED + mkdir -p $INSTALLED fi if [ ! -f "$LOCALSTATE/mirror" ]; then - echo "$DEFAULT_MIRROR" > $LOCALSTATE/mirror + echo "$DEFAULT_MIRROR" > $LOCALSTATE/mirror fi fi @@ -81,8 +81,9 @@ # Print the usage. usage () { - echo -e "SliTaz packages manager - Version: $VERSION -\033[1mUsage: \033[0m tazpkg [command] [package|dir|pattern|list|cat|--opt] [dir|--opt] + echo -e "SliTaz packages manager - Version: $VERSION\n +\033[1mUsage:\033[0m tazpkg [command] [package|dir|pattern|list|cat|--opt] [dir|--opt] + tazpkg shell\n \033[1mCommands: \033[0m usage Print this short usage. list List installed packages on the system by category or all. @@ -128,7 +129,7 @@ { if test $(id -u) != 0 ; then echo -e "\nYou must be root to run `basename $0` with this option." - echo -e "Please type 'su' and root password to become super-user.\n" + echo -e "Please use 'su' and root password to become super-user.\n" exit 0 fi } @@ -1268,6 +1269,39 @@ fi echo "" ;; + shell) + # Tazpkg SHell + # + if test $(id -u) = 0 ; then + PROMPT="\\033[1;33mtazpkg\\033[0;39m# " + else + PROMPT="\\033[1;33mtazpkg\\033[0;39m> " + fi + if [ ! "$2" = "--noheader" ]; then + clear + echo "" + echo -e "\033[1mTazpkg SHell.\033[0m" + echo "================================================================================" + echo "Type 'usage' to list all avalaible commands and 'quit' or 'q' to exit." + echo "" + fi + while true + do + echo -en "$PROMPT"; read cmd + case $cmd in + q|quit) + break ;; + shell) + echo "You are already running a Tazpkg SHell." ;; + su) + su -c 'exec tazpkg shell --noheader' && break ;; + "") + continue ;; + *) + tazpkg $cmd ;; + esac + done + ;; usage|*) # Print a short help or give usage for an unknow or empty command. #