Improve Windows installer

This commit is contained in:
Samuel Sloniker 2024-07-30 10:05:32 -07:00
parent afdac88880
commit 765e00446e
2 changed files with 14 additions and 21 deletions

View File

@ -1,11 +1,14 @@
pyinstaller --icon "icon.ico" --windowed --onefile --hidden-import "tornado.web" --add-data "icon.ico:files" --add-data "README.md:files" --add-data "GPL-3.0.txt:files" --add-data "CC-BY-SA-4.0.txt:files" --name "navpoint.exe" "main.py"
& "C:\Program Files (x86)\NSIS\makensis.exe" ".\windows_installer.nsi"
$version = (Get-Content -Path README.md -TotalCount 1).Split()[3] $version = (Get-Content -Path README.md -TotalCount 1).Split()[3]
$distName = "navpoint-$version-windows-$env:PROCESSOR_ARCHITECTURE" $distName = "navpoint-$version-windows-$env:PROCESSOR_ARCHITECTURE"
Remove-Item -Path "dist\$distName-*" Remove-Item -Path "dist\$distName-*"
pyinstaller --icon "icon.ico" --windowed --onefile --hidden-import "tornado.web" --add-data "icon.ico:files" --add-data "README.md:files" --add-data "GPL-3.0.txt:files" --add-data "CC-BY-SA-4.0.txt:files" --name "navpoint.exe" "main.py"
(Get-Content ".\windows_installer.nsi" -Raw).Replace("<<version>>", "$version").Replace("<<distName>>", "$distName") | Out-File ".\temp_installer.nsi"
& "C:\Program Files (x86)\NSIS\makensis.exe" ".\temp_installer.nsi"
Remove-Item -Path ".\temp_installer.nsi"
Move-Item -Path "dist\navpoint.exe" -Destination "dist\$distName-portable.exe" Move-Item -Path "dist\navpoint.exe" -Destination "dist\$distName-portable.exe"
Move-Item -Path "dist\NavpointInstaller.exe" -Destination "dist\$distName-installer.exe"
# Move-Item -Path "dist\NavpointInstaller.exe" -Destination "dist\$distName-installer.exe"

View File

@ -1,5 +1,5 @@
OutFile "dist\NavpointInstaller.exe" Name "Navpoint <<version>>"
# define installation directory OutFile "dist\<<distName>>-installer.exe"
InstallDir $PROFILE\Navpoint InstallDir $PROFILE\Navpoint
RequestExecutionLevel user RequestExecutionLevel user
@ -9,25 +9,15 @@ Section
SetOutPath $INSTDIR SetOutPath $INSTDIR
File dist\navpoint.exe File dist\navpoint.exe
# create the uninstaller
WriteUninstaller "$INSTDIR\uninstall.exe"
# create a shortcut named "new shortcut" in the start menu programs directory
# point the new shortcut at the program uninstaller
CreateShortcut "$SMPROGRAMS\Uninstall Navpoint.lnk" "$INSTDIR\uninstall.exe"
CreateShortcut "$SMPROGRAMS\Navpoint.lnk" "$INSTDIR\navpoint.exe" CreateShortcut "$SMPROGRAMS\Navpoint.lnk" "$INSTDIR\navpoint.exe"
CreateShortcut "$DESKTOP\Navpoint.lnk" "$INSTDIR\navpoint.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
CreateShortcut "$SMPROGRAMS\Uninstall Navpoint.lnk" "$INSTDIR\uninstall.exe"
SectionEnd SectionEnd
# uninstaller section start
Section "uninstall" Section "uninstall"
# Remove the link from the start menu
Delete "$SMPROGRAMS\Uninstall Navpoint.lnk" Delete "$SMPROGRAMS\Uninstall Navpoint.lnk"
# Delete the uninstaller
Delete $INSTDIR\uninstaller.exe Delete $INSTDIR\uninstaller.exe
RMDir $INSTDIR RMDir $INSTDIR
# uninstaller section end
SectionEnd SectionEnd