Update NSIS to use a more modern style and detect if LibreWolf is still running
This commit is contained in:
parent
c4156370ba
commit
64972b5b34
5 changed files with 379 additions and 340 deletions
BIN
assets/banner.bmp
Normal file
BIN
assets/banner.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 151 KiB |
101
assets/setup.nsi
101
assets/setup.nsi
|
|
@ -1,31 +1,66 @@
|
||||||
#
|
!include "MUI2.nsh"
|
||||||
# Change these values to fit your application...
|
!include "LogicLib.nsh"
|
||||||
#
|
!addplugindir .
|
||||||
|
|
||||||
!define APPNAME "LibreWolf" # Full app name, like: "Gtk+ 2.0 Hello World"
|
!define APPNAME "LibreWolf"
|
||||||
!define PROGNAME "librewolf" # executable name, like: gtk2hello
|
!define PROGNAME "librewolf"
|
||||||
!define PROG_VERSION "pkg_version" # the program version, like: 0.3.0
|
!define EXECUTABLE "${PROGNAME}.exe"
|
||||||
!define ICON_NAME "librewolf.ico" # filename of icon to use for this app
|
!define PROG_VERSION "pkg_version"
|
||||||
!define COMPANYNAME "LibreWolf" # Your name, or company (or just the program name)
|
!define COMPANYNAME "LibreWolf"
|
||||||
!define ESTIMATED_SIZE 190000 # Estimated size (in KB) of installed program for use in "add or remove programs" / 190 MB
|
!define ESTIMATED_SIZE 190000
|
||||||
|
!define MUI_ICON "librewolf.ico"
|
||||||
|
!define MUI_WELCOMEFINISHPAGE_BITMAP "banner.bmp"
|
||||||
|
|
||||||
#
|
Name "${APPNAME}"
|
||||||
# The actual installer/uninstaller, you should not need to change much here below
|
|
||||||
#
|
|
||||||
|
|
||||||
Name "${PROGNAME}"
|
|
||||||
OutFile "${PROGNAME}-${PROG_VERSION}.en-US.win64-setup.exe"
|
OutFile "${PROGNAME}-${PROG_VERSION}.en-US.win64-setup.exe"
|
||||||
InstallDir $PROGRAMFILES64\${APPNAME}
|
InstallDir $PROGRAMFILES64\${APPNAME}
|
||||||
RequestExecutionLevel admin
|
RequestExecutionLevel admin
|
||||||
|
|
||||||
Page directory
|
# Pages
|
||||||
Page instfiles
|
|
||||||
|
|
||||||
function .onInit
|
!define MUI_ABORTWARNING
|
||||||
setShellVarContext all
|
|
||||||
functionEnd
|
|
||||||
|
|
||||||
Section "${PROGNAME}"
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
|
!insertmacro MUI_PAGE_INSTFILES
|
||||||
|
!insertmacro MUI_PAGE_FINISH
|
||||||
|
|
||||||
|
!insertmacro MUI_UNPAGE_CONFIRM
|
||||||
|
!insertmacro MUI_UNPAGE_INSTFILES
|
||||||
|
|
||||||
|
!insertmacro MUI_LANGUAGE "English"
|
||||||
|
|
||||||
|
Section
|
||||||
|
|
||||||
|
# Make sure LibreWolf is closed before the installation
|
||||||
|
nsProcess::_FindProcess "${EXECUTABLE}"
|
||||||
|
Pop $R0
|
||||||
|
${If} $R0 = 0
|
||||||
|
IfSilent 0 +4
|
||||||
|
DetailPrint "${APPNAME} is still running, aborting because of silent install."
|
||||||
|
SetErrorlevel 2
|
||||||
|
Abort
|
||||||
|
|
||||||
|
DetailPrint "${APPNAME} is still running. Closing it gracefully..."
|
||||||
|
nsProcess::_CloseProcess "${EXECUTABLE}"
|
||||||
|
Pop $R0
|
||||||
|
Sleep 2000
|
||||||
|
nsProcess::_FindProcess "${EXECUTABLE}"
|
||||||
|
Pop $R0
|
||||||
|
${If} $R0 = 0
|
||||||
|
DetailPrint "Failed to close ${APPNAME}, killing it..."
|
||||||
|
nsProcess::_KillProcess "${EXECUTABLE}"
|
||||||
|
Sleep 2000
|
||||||
|
nsProcess::_FindProcess "${EXECUTABLE}"
|
||||||
|
Pop $R0
|
||||||
|
${If} $R0 = 0
|
||||||
|
DetailPrint "Failed to kill ${APPNAME}, aborting"
|
||||||
|
MessageBox MB_ICONSTOP "LibreWolf is still running and can't be closed by the installer. Please close it manually and try again."
|
||||||
|
SetErrorlevel 2
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
# Copy files
|
# Copy files
|
||||||
SetOutPath $INSTDIR
|
SetOutPath $INSTDIR
|
||||||
|
|
@ -33,7 +68,7 @@ Section "${PROGNAME}"
|
||||||
|
|
||||||
# Start Menu
|
# Start Menu
|
||||||
createDirectory "$SMPROGRAMS\${COMPANYNAME}"
|
createDirectory "$SMPROGRAMS\${COMPANYNAME}"
|
||||||
createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\${PROGNAME}.exe" "" "$INSTDIR\${ICON_NAME}"
|
createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\${PROGNAME}.exe" "" "$INSTDIR\${MUI_ICON}"
|
||||||
createShortCut "$SMPROGRAMS\${COMPANYNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" ""
|
createShortCut "$SMPROGRAMS\${COMPANYNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" ""
|
||||||
|
|
||||||
# Uninstaller
|
# Uninstaller
|
||||||
|
|
@ -44,7 +79,7 @@ Section "${PROGNAME}"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\${ICON_NAME}$\""
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\${MUI_ICON}$\""
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}"
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "${PROG_VERSION}"
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "${PROG_VERSION}"
|
||||||
# There is no option for modifying or repairing the install
|
# There is no option for modifying or repairing the install
|
||||||
|
|
@ -87,20 +122,18 @@ Section "${PROGNAME}"
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
# Before uninstall, ask for confirmation
|
|
||||||
function un.onInit
|
|
||||||
SetShellVarContext all
|
|
||||||
|
|
||||||
# Verify the uninstaller - last chance to back out
|
|
||||||
# (commented this out, it causes problems with Chocolatey.)
|
|
||||||
# MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
|
|
||||||
# Abort
|
|
||||||
# next:
|
|
||||||
|
|
||||||
functionEnd
|
|
||||||
|
|
||||||
# Uninstaller
|
# Uninstaller
|
||||||
section "uninstall"
|
section "Uninstall"
|
||||||
|
|
||||||
|
# Kill LibreWolf if it is still running
|
||||||
|
nsProcess::_FindProcess "${EXECUTABLE}"
|
||||||
|
Pop $R0
|
||||||
|
${If} $R0 = 0
|
||||||
|
DetailPrint "${APPNAME} is still running, killing it..."
|
||||||
|
nsProcess::_KillProcess "${EXECUTABLE}"
|
||||||
|
Sleep 2000
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
# Remove Start Menu launcher
|
# Remove Start Menu launcher
|
||||||
delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
|
delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
|
||||||
|
|
|
||||||
1
common
Submodule
1
common
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1e529672fc81de6c15d584d41efa17880b28fea4
|
||||||
6
mk.py
Executable file → Normal file
6
mk.py
Executable file → Normal file
|
|
@ -129,10 +129,14 @@ def artifacts():
|
||||||
|
|
||||||
# With that out of the way, we need to create the nsis setup.
|
# With that out of the way, we need to create the nsis setup.
|
||||||
os.chdir('work')
|
os.chdir('work')
|
||||||
|
exec("mkdir x86-ansi")
|
||||||
|
exec("wget -q -O ./x86-ansi/nsProcess.dll https://shorsh.de/upload/we7v/nsProcess.dll")
|
||||||
setupname = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version)
|
setupname = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version)
|
||||||
exec('sed \"s/pkg_version/{}/g\" < ../assets/setup.nsi > tmp.nsi'.format(full_version))
|
exec('sed \"s/pkg_version/{}/g\" < ../assets/setup.nsi > tmp.nsi'.format(full_version))
|
||||||
|
exec('cp -v ../assets/librewolf.ico .')
|
||||||
|
exec('cp -v ../assets/banner.bmp .')
|
||||||
exec('makensis-3.01.exe -V1 tmp.nsi')
|
exec('makensis-3.01.exe -V1 tmp.nsi')
|
||||||
exec('rm -f tmp.nsi')
|
exec('rm -rf tmp.nsi librewolf.ico banner.bmp x86-ansi')
|
||||||
exec("mv {} ..".format(setupname))
|
exec("mv {} ..".format(setupname))
|
||||||
os.chdir('..')
|
os.chdir('..')
|
||||||
|
|
||||||
|
|
|
||||||
1
settings
Submodule
1
settings
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 9075142f3a1b52a949e7f2602b212dc24b6a8cf1
|
||||||
Loading…
Add table
Reference in a new issue