mirror of
https://github.com/certbot/certbot.git
synced 2026-06-07 15:52:08 -04:00
183 lines
6.3 KiB
Diff
183 lines
6.3 KiB
Diff
--- pyapp.nsi 2020-03-31 01:46:13.118535700 +0200
|
|
+++ template.nsi 2020-03-31 01:45:37.054503000 +0200
|
|
@@ -1,3 +1,13 @@
|
|
+; This NSIS template is based on the built-in one in pynsist 2.4.
|
|
+; If pynsist is upgraded, this template may be updated if necessary using the new built-in one.
|
|
+; Original file can be found here: https://github.com/takluyver/pynsist/blob/2.4/nsist/pyapp.nsi
|
|
+; Diff file is located at .\template-nsi.patch
|
|
+
|
|
+; Require the installer do be installed with admin privileges
|
|
+RequestExecutionLevel admin
|
|
+; Set default installation path (overridable with /D= flag)
|
|
+InstallDir "$PROGRAMFILES\Certbot"
|
|
+
|
|
!define PRODUCT_NAME "[[ib.appname]]"
|
|
!define PRODUCT_VERSION "[[ib.version]]"
|
|
!define PY_VERSION "[[ib.py_version]]"
|
|
@@ -6,24 +16,22 @@
|
|
!define ARCH_TAG "[[arch_tag]]"
|
|
!define INSTALLER_NAME "[[ib.installer_name]]"
|
|
!define PRODUCT_ICON "[[icon]]"
|
|
-
|
|
-; Marker file to tell the uninstaller that it's a user installation
|
|
-!define USER_INSTALL_MARKER _user_install_marker
|
|
-
|
|
+
|
|
SetCompressor lzma
|
|
|
|
-!define MULTIUSER_EXECUTIONLEVEL Highest
|
|
-!define MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER
|
|
-!define MULTIUSER_MUI
|
|
-!define MULTIUSER_INSTALLMODE_COMMANDLINE
|
|
-!define MULTIUSER_INSTALLMODE_INSTDIR "[[ib.appname]]"
|
|
-[% if ib.py_bitness == 64 %]
|
|
-!define MULTIUSER_INSTALLMODE_FUNCTION correct_prog_files
|
|
-[% endif %]
|
|
-!include MultiUser.nsh
|
|
+Function .onInit
|
|
+ ; Check that Powershell is at least 5.0.
|
|
+ nsExec::ExecToStack `powershell -ExecutionPolicy RemoteSigned -Command "Write-Host -NoNewline (Get-Host | Select-Object Version).Version.CompareTo((New-Object -TypeName System.Version -ArgumentList '5.0'))"`
|
|
+ Pop $0
|
|
+ Pop $1
|
|
+ StrCmp $1 "-1" 0 powershellok
|
|
+ MessageBox MB_OK|MB_ICONSTOP "Certbot requires Powershell 5.0+ to work.$\r$\nPlease check the following link to know how to upgrade your system:$\r$\nhttps://docs.microsoft.com/powershell/scripting/install/installing-powershell"
|
|
+ Abort
|
|
+ powershellok:
|
|
+FunctionEnd
|
|
|
|
[% block modernui %]
|
|
-; Modern UI installer stuff
|
|
+; Modern UI installer stuff
|
|
!include "MUI2.nsh"
|
|
!define MUI_ABORTWARNING
|
|
!define MUI_ICON "[[icon]]"
|
|
@@ -35,7 +43,6 @@
|
|
[% if license_file %]
|
|
!insertmacro MUI_PAGE_LICENSE [[license_file]]
|
|
[% endif %]
|
|
-!insertmacro MULTIUSER_PAGE_INSTALLMODE
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
!insertmacro MUI_PAGE_FINISH
|
|
@@ -43,7 +50,7 @@
|
|
!insertmacro MUI_LANGUAGE "English"
|
|
[% endblock modernui %]
|
|
|
|
-Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
|
+Name "${PRODUCT_NAME} (beta) ${PRODUCT_VERSION}"
|
|
OutFile "${INSTALLER_NAME}"
|
|
ShowInstDetails show
|
|
|
|
@@ -56,18 +63,13 @@
|
|
|
|
Section "!${PRODUCT_NAME}" sec_app
|
|
SetRegView [[ib.py_bitness]]
|
|
+ SetShellVarContext all
|
|
SectionIn RO
|
|
File ${PRODUCT_ICON}
|
|
SetOutPath "$INSTDIR\pkgs"
|
|
File /r "pkgs\*.*"
|
|
SetOutPath "$INSTDIR"
|
|
|
|
- ; Marker file for per-user install
|
|
- StrCmp $MultiUser.InstallMode CurrentUser 0 +3
|
|
- FileOpen $0 "$INSTDIR\${USER_INSTALL_MARKER}" w
|
|
- FileClose $0
|
|
- SetFileAttributes "$INSTDIR\${USER_INSTALL_MARKER}" HIDDEN
|
|
-
|
|
[% block install_files %]
|
|
; Install files
|
|
[% for destination, group in grouped_files %]
|
|
@@ -76,14 +78,14 @@
|
|
File "[[ file ]]"
|
|
[% endfor %]
|
|
[% endfor %]
|
|
-
|
|
+
|
|
; Install directories
|
|
[% for dir, destination in ib.install_dirs %]
|
|
SetOutPath "[[ pjoin(destination, dir) ]]"
|
|
File /r "[[dir]]\*.*"
|
|
[% endfor %]
|
|
[% endblock install_files %]
|
|
-
|
|
+
|
|
[% block install_shortcuts %]
|
|
; Install shortcuts
|
|
; The output path becomes the working directory for shortcuts
|
|
@@ -109,17 +111,11 @@
|
|
DetailPrint "Setting up command-line launchers..."
|
|
nsExec::ExecToLog '[[ python ]] -Es "$INSTDIR\_assemble_launchers.py" [[ python ]] "$INSTDIR\bin"'
|
|
|
|
- StrCmp $MultiUser.InstallMode CurrentUser 0 AddSysPathSystem
|
|
- ; Add to PATH for current user
|
|
- nsExec::ExecToLog '[[ python ]] -Es "$INSTDIR\_system_path.py" add_user "$INSTDIR\bin"'
|
|
- GoTo AddedSysPath
|
|
- AddSysPathSystem:
|
|
- ; Add to PATH for all users
|
|
- nsExec::ExecToLog '[[ python ]] -Es "$INSTDIR\_system_path.py" add "$INSTDIR\bin"'
|
|
- AddedSysPath:
|
|
+ ; Add to PATH for all users
|
|
+ nsExec::ExecToLog '[[ python ]] -Es "$INSTDIR\_system_path.py" add "$INSTDIR\bin"'
|
|
[% endif %]
|
|
[% endblock install_commands %]
|
|
-
|
|
+
|
|
; Byte-compile Python files.
|
|
DetailPrint "Byte-compiling Python modules..."
|
|
nsExec::ExecToLog '[[ python ]] -m compileall -q "$INSTDIR\pkgs"'
|
|
@@ -144,6 +140,10 @@
|
|
WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
|
|
"NoRepair" 1
|
|
|
|
+ ; Execute ps script to create the certbot renew & auto-update task
|
|
+ DetailPrint "Setting up certbot renew & auto-update scheduled task"
|
|
+ nsExec::ExecToLog 'powershell -inputformat none -ExecutionPolicy RemoteSigned -File "$INSTDIR\tasks-up.ps1" -InstallDir "$INSTDIR"'
|
|
+
|
|
; Check if we need to reboot
|
|
IfRebootFlag 0 noreboot
|
|
MessageBox MB_YESNO "A reboot is required to finish the installation. Do you wish to reboot now?" \
|
|
@@ -155,11 +155,14 @@
|
|
Section "Uninstall"
|
|
SetRegView [[ib.py_bitness]]
|
|
SetShellVarContext all
|
|
- IfFileExists "$INSTDIR\${USER_INSTALL_MARKER}" 0 +3
|
|
- SetShellVarContext current
|
|
- Delete "$INSTDIR\${USER_INSTALL_MARKER}"
|
|
|
|
- Delete $INSTDIR\uninstall.exe
|
|
+ ; Execute ps script to remove the certbot renew & auto-update task, then delete scripts
|
|
+ nsExec::ExecToLog 'powershell -inputformat none -ExecutionPolicy RemoteSigned -File "$INSTDIR\tasks-down.ps1"'
|
|
+ Delete "$INSTDIR\tasks-down.ps1"
|
|
+ Delete "$INSTDIR\tasks-up.ps1"
|
|
+ Delete "$INSTDIR\auto-update.ps1"
|
|
+
|
|
+ Delete "$INSTDIR\uninstall.exe"
|
|
Delete "$INSTDIR\${PRODUCT_ICON}"
|
|
RMDir /r "$INSTDIR\pkgs"
|
|
|
|
@@ -207,23 +210,6 @@
|
|
[% block mouseover_messages %]
|
|
StrCmp $0 ${sec_app} "" +2
|
|
SendMessage $R0 ${WM_SETTEXT} 0 "STR:${PRODUCT_NAME}"
|
|
-
|
|
+
|
|
[% endblock mouseover_messages %]
|
|
FunctionEnd
|
|
-
|
|
-Function .onInit
|
|
- !insertmacro MULTIUSER_INIT
|
|
-FunctionEnd
|
|
-
|
|
-Function un.onInit
|
|
- !insertmacro MULTIUSER_UNINIT
|
|
-FunctionEnd
|
|
-
|
|
-[% if ib.py_bitness == 64 %]
|
|
-Function correct_prog_files
|
|
- ; The multiuser machinery doesn't know about the different Program files
|
|
- ; folder for 64-bit applications. Override the install dir it set.
|
|
- StrCmp $MultiUser.InstallMode AllUsers 0 +2
|
|
- StrCpy $INSTDIR "$PROGRAMFILES64\${MULTIUSER_INSTALLMODE_INSTDIR}"
|
|
-FunctionEnd
|
|
-[% endif %]
|