diff --git a/gui b/gui index 0872b84..c205744 100755 --- a/gui +++ b/gui @@ -26,10 +26,20 @@ if [ ! -z "$1" ];then fi install() { - x-terminal-emulator --title="Installing $app" -e ' + app="$1" + #terminal title text + linecount="$(echo "$app" | wc -l)" + if [ $linecount -eq 1 ];then + title="$app" + elif [ $linecount -le 4 ];then + title="$(echo "$app" | tr '\n' '|' | sed -i 's/|/, /g')" + else + title="several apps" + fi + x-terminal-emulator --title="Installing $title" -e ' bash -c '\'' PATH="'"$PATH"'" - if "'"${DIRECTORY}/manage"'" install "'"$app"'" ; then + if "'"${DIRECTORY}/manage"'" multi-install "'"$app"'" ; then echo -e "\nClosing in 30 seconds." sleep 30 else @@ -43,10 +53,20 @@ install() { } uninstall() { - x-terminal-emulator --title="Uninstalling $app" -e ' + app="$1" + #terminal title text + linecount="$(echo "$app" | wc -l)" + if [ $linecount -eq 1 ];then + title="$app" + elif [ $linecount -le 4 ];then + title="$(echo "$app" | tr '\n' '|' | sed -i 's/|/, /g')" + else + title="several apps" + fi + x-terminal-emulator --title="Uninstalling $title" -e ' bash -c '\'' PATH="'"$PATH"'" - if "'"${DIRECTORY}/manage"'" uninstall "'"$app"'" ; then + if "'"${DIRECTORY}/manage"'" multi-uninstall "'"$app"'" ; then echo -e "\nClosing in 30 seconds." sleep 30 else @@ -73,7 +93,7 @@ while true;do output="$(echo -e "$LIST" | yad --center --title='Pi-Apps' --width=310 --height=400 --no-headers \ --text="$motd" --image="${DIRECTORY}/icons/logo-64.png" --image-on-top \ - --list --separator='\n' --window-icon="${DIRECTORY}/icons/logo.png" \ + --list --multiple --separator='\n' --window-icon="${DIRECTORY}/icons/logo.png" \ --column=:IMG --column=:IMG --column=Name --column=tip:HD --print-column=3 --tooltip-column=4 \ --button=Install!"${DIRECTORY}/icons/install.png":4 \ --button=Uninstall!"${DIRECTORY}/icons/uninstall.png":2 \ @@ -85,7 +105,7 @@ while true;do if [ $button -eq 252 ];then #if window manager x was pressed exit 0 fi - + output="$(echo "$output" | sed '/^$/d')" echo "Output: ${output}EOO" if [ -z "$output" ];then @@ -106,7 +126,7 @@ while true;do ;; 0) echo "Details" - + output="$(echo "$output" | head -n1)" if [ ! -z "$(cat "${DIRECTORY}/data/installed-packages/${output}")" ];then installedpackages=" This app installed these packages: $(cat "${DIRECTORY}/data/installed-packages/${output}" | sort | uniq | tr '\n' ' ')" @@ -156,10 +176,10 @@ $installedpackages" output='' elif [ $button == 4 ];then app="$output" - install + install "$app" elif [ $button == 2 ];then app="$output" - uninstall + uninstall "$app" elif [ $button == 6 ];then echo 'previous app' @@ -212,14 +232,12 @@ $installedpackages" fi ;; 2) - app="$output" - uninstall + uninstall "$output" #clear output var to prompt main window to open next output='' ;; 4) - app="$output" - install + install "$output" #clear output var to prompt main window to open next output='' ;; diff --git a/manage b/manage index 4b9b305..d44c1db 100755 --- a/manage +++ b/manage @@ -33,8 +33,24 @@ dirhash() { echo "$hash" echo "$hash" 1>&2 } - -if [ "$1" == 'install' ];then +if [ "$1" == 'multi-install' ];then + PREIFS="$IFS" + IFS=$'\n' + for app in $2 + do + "${DIRECTORY}/manage" install "$app" + done + IFS="$PREIFS" +elif [ "$1" == 'multi-uninstall' ];then + PREIFS="$IFS" + IFS=$'\n' + for app in $2 + do + "${DIRECTORY}/manage" uninstall "$app" + done + IFS="$PREIFS" + +elif [ "$1" == 'install' ];then #INSTALL #for this operation, a program name must be specified. app="$2" @@ -89,10 +105,10 @@ Pi-Apps will wait until that one finishes before installing $app." | yad --text- echo 'corrupted' > "${DIRECTORY}/data/status/${app}" if "$installscript" ; then echo 'installed' > "${DIRECTORY}/data/status/${app}" - echo -en "\n\e[42m\e[30mInstalled ${app} successfully.\e[39m\e[49m" + echo -e "\n\e[42m\e[30mInstalled ${app} successfully.\e[39m\e[49m" exit 0 else - echo -en "\n\e[41m\e[30mFailed to install ${app} with $scriptname script!\e[39m\e[49m" + echo -e "\n\e[41m\e[30mFailed to install ${app} with $scriptname script!\e[39m\e[49m" exit 1 fi elif [ "$1" == 'uninstall' ];then @@ -125,10 +141,10 @@ Pi-Apps will wait until that one finishes before starting this one." | yad --tex echo 'corrupted' > "${DIRECTORY}/data/status/${app}" if "${DIRECTORY}/apps/${app}/uninstall" ; then echo 'uninstalled' > "${DIRECTORY}/data/status/${app}" - echo -en "\n\e[42m\e[30mUninstalled ${app} successfully.\e[39m\e[49m" + echo -e "\n\e[42m\e[30mUninstalled ${app} successfully.\e[39m\e[49m" exit 0 else - echo -en "\n\e[41m\e[30mFailed to uninstall ${app}!\e[39m\e[49m" + echo -e "\n\e[41m\e[30mFailed to uninstall ${app}!\e[39m\e[49m" exit 1 fi elif [ "$1" == 'update' ];then @@ -181,7 +197,7 @@ elif [ "$1" == 'update' ];then if [ "$(cat "${DIRECTORY}/data/status/${app}")" == 'installed' ];then installback=yes #uninstall it using a recursive script instance - "${DIRECTORY}/manage" uninstall "$app" + "${DIRECTORY}/manage" uninstall "$app" fi fi