Mercurial > mxe-octave
comparison tools/makeinst-script.sh.in @ 6396:d5e6775fb3bc release
Add uninstall options to remove local packages and settings (Bug #62352)
* src/default-octave.mk, src/release-octave.mk, src/stable-octave.mk: save api version to file
* tools/makeinst-script.sh.in: add uninstall options, and on set, remove specified files from appdata/octave
(grafted from 8fe292548edfeb8a82e64f0e2b5da1a65e35d835)
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Wed, 31 Aug 2022 08:09:19 -0400 |
parents | ea224bb389e3 |
children | eb58a62c878e |
comparison
equal
deleted
inserted
replaced
6386:1dde81c1f186 | 6396:d5e6775fb3bc |
---|---|
48 ICON=`find $OCTAVE_SOURCE -name octave-logo.ico -printf "%P\n" | head -1 | sed 's,/,\\\\,g'` | 48 ICON=`find $OCTAVE_SOURCE -name octave-logo.ico -printf "%P\n" | head -1 | sed 's,/,\\\\,g'` |
49 | 49 |
50 # extract version number | 50 # extract version number |
51 OCTAVE_VERSION=`head -1 $MXEDIR/octave/octave-version` | 51 OCTAVE_VERSION=`head -1 $MXEDIR/octave/octave-version` |
52 VERSION=`echo $OCTAVE_VERSION | sed -n 's,\([0-9\.]*\).*,\1,p'` | 52 VERSION=`echo $OCTAVE_VERSION | sed -n 's,\([0-9\.]*\).*,\1,p'` |
53 OCTAVE_API_VERSION=`head -1 $MXEDIR/octave/octave-api` | |
53 if [ `echo $VERSION | grep -o '\.' | wc -l` -le 2 ]; then | 54 if [ `echo $VERSION | grep -o '\.' | wc -l` -le 2 ]; then |
54 INSTALLER_VERSION="$VERSION.0" | 55 INSTALLER_VERSION="$VERSION.0" |
55 else | 56 else |
56 INSTALLER_VERSION=$VERSION | 57 INSTALLER_VERSION=$VERSION |
57 fi | 58 fi |
168 !define MUI_FINISHPAGE_SHOWREADME "\$INSTDIR\\README.html" | 169 !define MUI_FINISHPAGE_SHOWREADME "\$INSTDIR\\README.html" |
169 !insertmacro MUI_PAGE_FINISH | 170 !insertmacro MUI_PAGE_FINISH |
170 | 171 |
171 ; uninstaller | 172 ; uninstaller |
172 !insertmacro MUI_UNPAGE_CONFIRM | 173 !insertmacro MUI_UNPAGE_CONFIRM |
174 | |
175 UninstPage custom un.octaveOptionsPage un.octaveOptionsLeave | |
173 | 176 |
174 !insertmacro MUI_UNPAGE_INSTFILES | 177 !insertmacro MUI_UNPAGE_INSTFILES |
175 | 178 |
176 !insertmacro MUI_UNPAGE_FINISH | 179 !insertmacro MUI_UNPAGE_FINISH |
177 | 180 |
340 \${NSD_GetState} \$RegisterOctaveFileTypeCtrl \$RegisterOctaveFileType | 343 \${NSD_GetState} \$RegisterOctaveFileTypeCtrl \$RegisterOctaveFileType |
341 \${DropList_GetCurSel} \$InstallBlasLibCtrl \$InstallBlasLib | 344 \${DropList_GetCurSel} \$InstallBlasLibCtrl \$InstallBlasLib |
342 FunctionEnd | 345 FunctionEnd |
343 | 346 |
344 ###################################################################### | 347 ###################################################################### |
348 ; custom uninstall options page functions | |
349 | |
350 Var UninstallLocalPackages | |
351 Var UninstallLocalPackagesCtrl | |
352 Var UninstallUserSettings | |
353 Var UninstallUserSettingsCtrl | |
354 | |
355 Function un.octaveOptionsPage | |
356 | |
357 nsDialogs::Create 1018 | |
358 Pop \$0 | |
359 | |
360 \${If} \$0 == error | |
361 Abort | |
362 \${EndIf} | |
363 | |
364 \${NSD_CreateCheckBox} 0 0 100% 12u "Uninstall Local Packages" | |
365 Pop \$UninstallLocalPackagesCtrl | |
366 \${NSD_SetState} \$UninstallLocalPackagesCtrl \$UninstallLocalPackages | |
367 | |
368 \${NSD_CreateCheckBox} 0 20u 100% 12u "Remove user settings" | |
369 Pop \$UninstallUserSettingsCtrl | |
370 \${NSD_SetState} \$UninstallUserSettingsCtrl \$UninstallUserSettings | |
371 | |
372 !insertmacro MUI_HEADER_TEXT "Uninstall Options" "Choose additional options for uninstalling" | |
373 nsDialogs::Show | |
374 Pop \$0 | |
375 FunctionEnd | |
376 | |
377 Function un.octaveOptionsLeave | |
378 \${NSD_GetState} \$UninstallLocalPackagesCtrl \$UninstallLocalPackages | |
379 \${NSD_GetState} \$UninstallUserSettingsCtrl \$UninstallUserSettings | |
380 FunctionEnd | |
381 | |
382 ###################################################################### | |
345 Function un.onInit | 383 Function un.onInit |
346 !insertmacro MULTIUSER_UNINIT | 384 !insertmacro MULTIUSER_UNINIT |
347 | 385 |
348 # find installer info | 386 # find installer info |
349 Push \$R0 | 387 Push \$R0 |
383 StrCpy \$MultiUser.UninstallKey "\${PRODUCT_UNINST_KEY}" | 421 StrCpy \$MultiUser.UninstallKey "\${PRODUCT_UNINST_KEY}" |
384 StrCpy \$MultiUser.Local "" | 422 StrCpy \$MultiUser.Local "" |
385 \${EndIf} | 423 \${EndIf} |
386 | 424 |
387 Pop \$R0 | 425 Pop \$R0 |
426 | |
427 ; set default uninstall options | |
428 StrCpy \$UninstallUserSettings \${BST_UNCHECKED} | |
429 StrCpy \$UninstallLocalPackages \${BST_CHECKED} | |
430 | |
431 ; process command line options | |
432 \${GetParameters} \$R0 | |
433 ClearErrors | |
434 \${GetOptions} "\$R0" "/UNINSTALL_LOCALPACKAGES=" \$0 | |
435 IfErrors un_no_local_packages_opt | |
436 \${If} \$0 == 0 | |
437 StrCpy \$UninstallLocalPackages \${BST_UNCHECKED} | |
438 \${EndIf} | |
439 un_no_local_packages_opt: | |
440 ClearErrors | |
441 \${GetOptions} "\$R0" "/UNINSTALL_USERSETTINGS=" \$0 | |
442 IfErrors un_no_user_settings_opt | |
443 \${If} \$0 == 1 | |
444 StrCpy \$UninstallUserSettings \${BST_CHECKED} | |
445 \${EndIf} | |
446 un_no_user_settings_opt: | |
447 ClearErrors | |
448 | |
388 FunctionEnd | 449 FunctionEnd |
389 | 450 |
390 Function .onInit | 451 Function .onInit |
391 !insertmacro MULTIUSER_INIT | 452 !insertmacro MULTIUSER_INIT |
392 | 453 |
623 | 684 |
624 SectionEnd | 685 SectionEnd |
625 | 686 |
626 Section "Uninstall" | 687 Section "Uninstall" |
627 | 688 |
689 ; remove user uninstall stuff if options chosen | |
690 \${If} \$UninstallLocalPackages == 1 | |
691 \${If} \${FileExists} "\$APPDATA\\octave\\api-v$OCTAVE_API_VERSION" | |
692 RMDir /r "\$APPDATA\\octave\\api-v$OCTAVE_API_VERSION" | |
693 \${EndIf} | |
694 ClearErrors | |
695 \${EndIf} | |
696 | |
697 \${If} \$UninstallUserSettings == 1 | |
698 \${If} \${FileExists} "\$APPDATA\\octave" | |
699 Delete "\$APPDATA\\octave\\octave-gui.ini" | |
700 Delete "\$APPDATA\\octave\\octave-doc-bookmarks.xbel" | |
701 Delete "\$APPDATA\\octave\\history" | |
702 RMDir "\$APPDATA\\octave" | |
703 \${EndIf} | |
704 ClearErrors | |
705 \${EndIf} | |
706 | |
628 ReadRegDWORD \$0 \${PRODUCT_UNINST_ROOT_KEY} "\$MultiUser.UninstallKey" "RegisteredFileType" | 707 ReadRegDWORD \$0 \${PRODUCT_UNINST_ROOT_KEY} "\$MultiUser.UninstallKey" "RegisteredFileType" |
629 IfErrors not_registered_file | 708 IfErrors not_registered_file |
630 | 709 |
631 ; only try remove if is set to our version of octave | 710 ; only try remove if is set to our version of octave |
632 ReadRegStr \$0 SHCTX "Software\\Classes\\.m" "" | 711 ReadRegStr \$0 SHCTX "Software\\Classes\\.m" "" |