From 1df25cedbad52ced18a879598957b6e0e6c86cba Mon Sep 17 00:00:00 2001 From: Jack-Benny Persson Date: Fri, 10 Jan 2014 13:19:45 +0100 Subject: [PATCH] Some more functions --- dpkg-frontend.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/dpkg-frontend.sh b/dpkg-frontend.sh index b0ab8cb..d617b0b 100755 --- a/dpkg-frontend.sh +++ b/dpkg-frontend.sh @@ -75,12 +75,11 @@ search_pkg() uninstall_pkg() { - #Pkginfo=`$Dpkg --status $Search` $Zenity --title "dpkg-frontend" \ --question \ --text="Package $Search is installed.\nUninstall ${Search}?" if [ $? -eq 0 ]; then # CHANGE NEXT LINE - sleep 5 | $Zenity --title "dpkg-frontend" \ + sleep 3 | $Zenity --title "dpkg-frontend" \ --progress --pulsate --text "Uninstalling ${Search}..." fi } @@ -97,6 +96,17 @@ show_selections() --info --text "Selections for $Search is: ${Selections}" } +choice_dialog() +{ + Choice=`$Zenity --list --column=Action --column=Description \ + --radiolist uninstall "Uninstall" show "Show selections"` + if [ "$Choice" = "Uninstall" ]; then + return 11 + elif [ "$Choice" = "Show selections" ]; then + return 12 + fi +} + # Create variables with absolute path to binaries and check # if we can execute it (binaries will be avaliable in # variables with first character uppercase, such as Grep) @@ -133,11 +143,12 @@ done ### Main ### search_pkg -if [ $? -eq 0 ]; then +choice_dialog +if [ $? -eq 11 ]; then uninstall_pkg +elif [ $? -eq 12 ]; then + show_selections fi - -show_selections echo $Search exit 0