From 4fd073430acc0e4ce601d405e97aaa294a36524e Mon Sep 17 00:00:00 2001 From: Botspot Date: Sat, 31 Oct 2020 11:17:44 -0500 Subject: [PATCH] fix updater --- updater | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/updater b/updater index cf8373a..7262eb0 100755 --- a/updater +++ b/updater @@ -158,9 +158,13 @@ button=$? #get exit code to determine which button was pressed echo "Button: ${button}" [ ! "$button" -eq 0 ] && error 'User cancelled' #exit now if anything but Update was clicked -x-terminal-emulator --title="Installing $output" -e " +updatable="$(echo "$updatable" | tr '|' '!')" +mainupdate="$(echo "$mainupdate" | tr '|' '!')" + +lxterminal --title="Updating Pi-Apps..." -e " + trap 'sleep 30' EXIT PREIFS=\"$IFS\" - IFS='|' + IFS='!' for i in $updatable do \"${DIRECTORY}/manage\" update \"$i\" nofetch @@ -172,17 +176,25 @@ x-terminal-emulator --title="Installing $output" -e " #move old program to trash gio trash \"${DIRECTORY}/${i}\" 2>/dev/null - mkdir -p \"$(dirname \"${DIRECTORY}/${i}\")\" + mkdir -p \"$(dirname "${DIRECTORY}/${i}")\" #copy new version to apps/ - cp -f \"${DIRECTORY}/update/pi-apps/${i}\" \"${DIRECTORY}/${i}\" || error \"Failed to copy ${DIRECTORY}/update/pi-apps/${i}!\" + cp -f \"${DIRECTORY}/update/pi-apps/${i}\" \"${DIRECTORY}/${i}\" echo -e \"\e[92m${i} was updated successfully.\e[39m\" done IFS=\"$PREIFS\" + + #move old .git folder to trash + gio trash \"${DIRECTORY}/.git\" 2>/dev/null + #copy new .git folder + cp -rf \"${DIRECTORY}/update/pi-apps/.git\" \"${DIRECTORY}/.git\" " -#.git folder -#move old .git folder to trash -gio trash "${DIRECTORY}/.git" 2>/dev/null -cp -rf "${DIRECTORY}/update/pi-apps/.git" "${DIRECTORY}/.git" || error "Failed to copy new .git!" +sleep 1 +while ps -C manage >/dev/null;do sleep 0.1; done + +yad --text="Please close all instances of Pi-Apps to apply the update." \ + --text-align=center --center --title='Pi-Apps update complete' --window-icon="${DIRECTORY}/icons/logo.png" \ + --button=OK!"${DIRECTORY}/icons/check.png":0 +exit 0