From 723f4f2d2d0df8e3797cc0d2b4ed3b1877bbffb1 Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Mar 31 2017 07:25:08 +0000 Subject: Improve PapagayoNG NSIS script --- diff --git a/build-papagayong.sh b/build-papagayong.sh index 888144d..d0d42da 100755 --- a/build-papagayong.sh +++ b/build-papagayong.sh @@ -40,8 +40,8 @@ run_nsis() { echo "" echo "Update papagayong for $PLATFORM-$ARCH" echo "" - #$SCRIPT update papagayong-master - #$SCRIPT clean_before_do unpack papagayong-master + $SCRIPT update papagayong-master + $SCRIPT clean_before_do unpack papagayong-master # QUICK HACK: $SCRIPT shell papagayong-master "/build/script/packet/papagayong-master.files/build-win.sh" @@ -54,6 +54,6 @@ run_nsis() { "$PACKET_BUILD_DIR/$PLATFORM-$ARCH/papagayong-master/unpack/version-papagayong-master" } -#run_appimage linux 64 -#run_appimage linux 32 +run_appimage linux 64 +run_appimage linux 32 run_nsis win 32 diff --git a/docker-builder-data/build/script/packet/papagayong-master.files/build-win.sh b/docker-builder-data/build/script/packet/papagayong-master.files/build-win.sh index 4f13439..50bbf35 100755 --- a/docker-builder-data/build/script/packet/papagayong-master.files/build-win.sh +++ b/docker-builder-data/build/script/packet/papagayong-master.files/build-win.sh @@ -13,6 +13,37 @@ PREBUILT_DIR="papagayo-ng-1.4.0-win" VERSION=$(grep "export VERSION=" "$UNPACK_PACKET_DIR/$PK_DIRNAME/util/package-linux.sh" | cut -d\' -f 2) TARGET_DIR="papagayo-ng-$VERSION-win" +foreachfile() { + local FILE=$1 + local COMMAND=$2 + if [ ! -e "$FILE" ]; then + return 1 + fi + if [ -d "$FILE" ]; then + ls -A1 "$FILE" | while read SUBFILE; do + if ! $COMMAND "$FILE/$SUBFILE" ${@:3}; then + return 1 + fi + done + fi +} + +nsis_register_file() { + local FILE=$1 + local WIN_FILE=$(echo "$FILE" | sed "s|\/|\\\\|g") + + if [ "${FILE:0:2}" = "./" ]; then + if [ -d "$FILE" ]; then + foreachfile "$FILE" nsis_register_file + echo "RMDir \"\$INSTDIR\\${WIN_FILE:2}\"" >> "files-uninstall.nsh" + else + echo "Delete \"\$INSTDIR\\${WIN_FILE:2}\"" >> "files-uninstall.nsh" + fi + else + foreachfile $FILE nsis_register_file + fi +} + if [ ! -f "$BUILD_PACKET_DIR/papagayo-ng-$VERSION-win-installer.exe" ] \ || [ "$BUILD_PACKET_DIR/papagayo-ng-$VERSION-win-installer.exe" -ot "$CURRENT_PACKET_DIR/unpack.done" ]; then mkdir -p "$BUILD_PACKET_DIR/prebuilt" @@ -32,6 +63,8 @@ if [ ! -f "$BUILD_PACKET_DIR/papagayo-ng-$VERSION-win-installer.exe" ] \ ln -s "$UNPACK_PACKET_DIR/$PK_DIRNAME" papagayo-ng cp "$FILES_PACKET_DIR/papagayo-ng.nsi" . cp "$FILES_PACKET_DIR/papagayo-ng.bat" . + touch "files-uninstall.nsh" + nsis_register_file . makensis papagayo-ng.nsi cd "$BUILD_PACKET_DIR" diff --git a/docker-builder-data/build/script/packet/papagayong-master.files/papagayo-ng.nsi b/docker-builder-data/build/script/packet/papagayong-master.files/papagayo-ng.nsi index c30b91f..7303092 100644 --- a/docker-builder-data/build/script/packet/papagayong-master.files/papagayo-ng.nsi +++ b/docker-builder-data/build/script/packet/papagayong-master.files/papagayo-ng.nsi @@ -55,9 +55,8 @@ Section "Uninstall" StrCmp $testkey '"$INSTDIR\papagayo-ng.bat" "%1"' 0 +2 DeleteRegKey HKCR "Papagayo.Document\shell\open\command" - Delete "$INSTDIR\*.*" - RMDir /r "$INSTDIR" - Delete "$SMPROGRAMS\$(^Name)\*.*" - RMDir "$SMPROGRAMS\$(^Name)" + !include "files-uninstall.nsh" + Delete "$INSTDIR\uninstall.exe" + RMDir "$INSTDIR" SectionEnd