add new samples and rename OPSI_INI_NAME to OPSI_INI_OPTION (ini typical naming)
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,94 @@
|
||||
; Copyright (c) uib gmbh (www.uib.de)
|
||||
; This sourcecode is owned by uib gmbh
|
||||
; and published under the Terms of the General Public License.
|
||||
; credits: http://www.opsi.org/credits/
|
||||
|
||||
DefVar $MsiId$
|
||||
Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
|
||||
|
||||
Message "Uninstalling " + $ProductId$ + " ..."
|
||||
|
||||
if FileExists($InstallDir$ + "\uninstall.exe")
|
||||
comment "Uninstall program found, starting uninstall"
|
||||
Winbatch_uninstall
|
||||
sub_check_exitcode
|
||||
endif
|
||||
if not (GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
|
||||
comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
|
||||
Winbatch_uninstall_msi
|
||||
sub_check_exitcode
|
||||
endif
|
||||
|
||||
comment "Delete files"
|
||||
Files_uninstall
|
||||
|
||||
comment "Cleanup registry"
|
||||
Registry_uninstall
|
||||
|
||||
comment "Delete program shortcuts"
|
||||
LinkFolder_uninstall
|
||||
|
||||
[Winbatch_uninstall]
|
||||
; Choose one of the following examples as basis for program uninstall
|
||||
;
|
||||
; === Nullsoft Scriptable Install System ================================================================
|
||||
; "$InstallDir$\uninstall.exe" /S
|
||||
;
|
||||
; === Inno Setup ========================================================================================
|
||||
; "$InstallDir$\uninstall.exe" /silent /norestart
|
||||
|
||||
|
||||
[Winbatch_uninstall_msi]
|
||||
msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress
|
||||
|
||||
[Files_uninstall]
|
||||
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
|
||||
;
|
||||
; delete -sf "$InstallDir$\"
|
||||
|
||||
[Registry_uninstall]
|
||||
; Example of deleting a registry key:
|
||||
;
|
||||
; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
|
||||
|
||||
[LinkFolder_uninstall]
|
||||
; Example of deleting a folder from AllUsers startmenu:
|
||||
;
|
||||
; set_basefolder common_programs
|
||||
; delete_subfolder $ProductId$
|
||||
;
|
||||
; Example of deleting a shortcut from AllUsers desktop:
|
||||
;
|
||||
; set_basefolder common_desktopdirectory
|
||||
; set_subfolder ""
|
||||
; delete_element $ProductId$
|
||||
|
||||
[Sub_check_exitcode]
|
||||
comment "Test for installation success via exit code"
|
||||
set $ExitCode$ = getLastExitCode
|
||||
; informations to exit codes see
|
||||
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
||||
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
||||
if ($ExitCode$ = "0")
|
||||
comment "Looks good: setup program gives exitcode zero"
|
||||
else
|
||||
comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
||||
if ($ExitCode$ = "1605")
|
||||
comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
||||
comment "Uninstall of a not installed product failed - no problem"
|
||||
else
|
||||
if ($ExitCode$ = "1641")
|
||||
comment "looks good: setup program gives exitcode 1641"
|
||||
comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
||||
else
|
||||
if ($ExitCode$ = "3010")
|
||||
comment "looks good: setup program gives exitcode 3010"
|
||||
comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
||||
else
|
||||
logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
||||
isFatalError
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
@@ -0,0 +1,207 @@
|
||||
; Copyright (c) uib gmbh (www.uib.de)
|
||||
; This sourcecode is owned by uib
|
||||
; and published under the Terms of the General Public License.
|
||||
; credits: http://www.opsi.org/credits/
|
||||
|
||||
|
||||
[Actions]
|
||||
ExitWindows /Reboot
|
||||
DefVar $LogDir$
|
||||
Set $LogDir$ = "%SystemDrive%\tmp"
|
||||
DefVar $ProductId$
|
||||
DefVar $MinimumSpace$
|
||||
DefVar $NewExe$
|
||||
DefVar $InstallDir$
|
||||
DefVar $ExitCode$
|
||||
DefVar $LicenseRequired$
|
||||
DefVar $LicenseKey$
|
||||
DefVar $LicensePool$
|
||||
|
||||
; ----------------------------------------------------------------
|
||||
; - Please edit the following values -
|
||||
; ----------------------------------------------------------------
|
||||
Set $ProductId$ = "opsi-template"
|
||||
Set $MinimumSpace$ = "1 MB"
|
||||
Set $InstallDir$ = "%ProgramFilesDir%\" + $ProductId$
|
||||
Set $NewExe$ = $InstallDir$ + "\" + $ProductId$ + ".exe"
|
||||
Set $LicenseRequired$ = "false"
|
||||
Set $LicensePool$ = "p_" + $ProductId$
|
||||
; ----------------------------------------------------------------
|
||||
|
||||
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
|
||||
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
|
||||
ExitWindows /Reboot
|
||||
isFatalError
|
||||
; Stop process and set installation status to failed
|
||||
else
|
||||
comment " this is for testing only ...remove on real scripts"
|
||||
if "true" = GetProductProperty("test-set-fatal","true")
|
||||
isFatalError
|
||||
endif
|
||||
|
||||
comment "Show product picture"
|
||||
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
|
||||
|
||||
if FileExists("%ScriptPath%\delsub.ins")
|
||||
comment "Start uninstall sub section"
|
||||
Sub "%ScriptPath%\delsub.ins"
|
||||
endif
|
||||
|
||||
Message "Installing " + $ProductId$ + " ..."
|
||||
|
||||
if not ($LicenseRequired$ = "false")
|
||||
comment "Licensing required, reserve license and get license key"
|
||||
Sub_get_licensekey
|
||||
endif
|
||||
|
||||
comment "Start setup program"
|
||||
Winbatch_install
|
||||
Sub_check_exitcode
|
||||
|
||||
comment "Copy files"
|
||||
Files_install
|
||||
|
||||
comment "Patch Registry"
|
||||
Registry_install
|
||||
|
||||
comment "Create shortcuts"
|
||||
LinkFolder_install
|
||||
|
||||
endif
|
||||
|
||||
|
||||
[Winbatch_install]
|
||||
; Choose one of the following examples as basis for your installation
|
||||
; You can use $LicenseKey$ var to pass a license key to the installer
|
||||
;
|
||||
; === Nullsoft Scriptable Install System ================================================================
|
||||
; "%ScriptPath%\Setup.exe" /S <additional_parameters>
|
||||
;
|
||||
; === MSI package =======================================================================================
|
||||
; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress
|
||||
;
|
||||
; === InstallShield =====================================================================================
|
||||
; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss"
|
||||
; "%ScriptPath%\setup.exe" /s /sms /f1"%ScriptPath%\setup.iss" /f2"$LogDir$\$ProductId$.install_log.txt"
|
||||
;
|
||||
; === Inno Setup ========================================================================================
|
||||
; "%ScriptPath%\setup.exe" /sp- /silent /norestart
|
||||
|
||||
[Files_install]
|
||||
; Example of recursively copying some files into the installation directory:
|
||||
;
|
||||
; copy -s "%ScriptPath%\files\*.*" "$InstallDir$"
|
||||
|
||||
[Registry_install]
|
||||
; Example of setting some values of an registry key:
|
||||
;
|
||||
; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
|
||||
; set "name1" = "some string value"
|
||||
; set "name2" = REG_DWORD:0001
|
||||
; set "name3" = REG_BINARY:00 af 99 cd
|
||||
|
||||
[LinkFolder_install]
|
||||
; Example of deleting a folder from AllUsers startmenu:
|
||||
;
|
||||
; set_basefolder common_programs
|
||||
; delete_subfolder $ProductId$
|
||||
;
|
||||
; Example of creating an shortcut to the installed exe in AllUsers startmenu:
|
||||
;
|
||||
; set_basefolder common_programs
|
||||
; set_subfolder $ProductId$
|
||||
;
|
||||
; set_link
|
||||
; name: $ProductId$
|
||||
; target: $NewExe$
|
||||
; parameters:
|
||||
; working_dir: $InstallDir$
|
||||
; icon_file:
|
||||
; icon_index:
|
||||
; end_link
|
||||
;
|
||||
; Example of creating an shortcut to the installed exe on AllUsers desktop:
|
||||
;
|
||||
; set_basefolder common_desktopdirectory
|
||||
; set_subfolder ""
|
||||
;
|
||||
; set_link
|
||||
; name: $ProductId$
|
||||
; target: $NewExe$
|
||||
; parameters: /some_param
|
||||
; working_dir: $InstallDir$
|
||||
; icon_file: $NewExe$
|
||||
; icon_index: 2
|
||||
; end_link
|
||||
|
||||
[Sub_get_licensekey]
|
||||
if opsiLicenseManagementEnabled
|
||||
comment "License management is enabled and will be used"
|
||||
|
||||
comment "Trying to get a license key"
|
||||
Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
|
||||
; If there is an assignment of exactly one licensepool to the product the following call is possible:
|
||||
; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
|
||||
;
|
||||
; If there is an assignment of a license pool to a windows software id, it is possible to use:
|
||||
; DefVar $WindowsSoftwareId$
|
||||
; $WindowsSoftwareId$ = "..."
|
||||
; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
|
||||
|
||||
DefVar $ServiceErrorClass$
|
||||
set $ServiceErrorClass$ = getLastServiceErrorClass
|
||||
comment "Error class: " + $ServiceErrorClass$
|
||||
|
||||
if $ServiceErrorClass$ = "None"
|
||||
comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
|
||||
else
|
||||
if $ServiceErrorClass$ = "LicenseConfigurationError"
|
||||
LogError "Fatal: license configuration must be corrected"
|
||||
LogError getLastServiceErrorMessage
|
||||
ExitWindows /Reboot
|
||||
isFatalError
|
||||
else
|
||||
if $ServiceErrorClass$ = "LicenseMissingError"
|
||||
LogError "Fatal: required license is not supplied"
|
||||
ExitWindows /Reboot
|
||||
isFatalError
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
else
|
||||
LogError "Fatal: license required, but license management not enabled"
|
||||
ExitWindows /Reboot
|
||||
isFatalError
|
||||
endif
|
||||
|
||||
|
||||
[Sub_check_exitcode]
|
||||
comment "Test for installation success via exit code"
|
||||
set $ExitCode$ = getLastExitCode
|
||||
; informations to exit codes see
|
||||
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
||||
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
||||
if ($ExitCode$ = "0")
|
||||
comment "Looks good: setup program gives exitcode zero"
|
||||
else
|
||||
comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
||||
if ($ExitCode$ = "1605")
|
||||
comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
||||
comment "Uninstall of a not installed product failed - no problem"
|
||||
else
|
||||
if ($ExitCode$ = "1641")
|
||||
comment "looks good: setup program gives exitcode 1641"
|
||||
comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
||||
else
|
||||
if ($ExitCode$ = "3010")
|
||||
comment "looks good: setup program gives exitcode 3010"
|
||||
comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
||||
else
|
||||
logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
||||
ExitWindows /Reboot
|
||||
isFatalError
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
; Copyright (c) uib gmbh (www.uib.de)
|
||||
; This sourcecode is owned by uib gmbh
|
||||
; and published under the Terms of the General Public License.
|
||||
; credits: http://www.opsi.org/credits/
|
||||
|
||||
[Initial]
|
||||
requiredWinstVersion >= "4.8.6"
|
||||
LogLevel=2
|
||||
; Log Errors in Logfile but don't abort:
|
||||
ExitOnError=false
|
||||
; Show syntax errors in the script:
|
||||
ScriptErrorMessages=on
|
||||
; Dont trace step by step through the script:
|
||||
TraceMode=off
|
||||
; Let started programs run in front of the winst window
|
||||
StayOnTop=false
|
||||
|
||||
[Aktionen]
|
||||
DefVar $TEMP$
|
||||
Set $TEMP$ = EnvVar("TEMP")
|
||||
DefVar $LogDir$
|
||||
Set $LogDir$ = "%SystemDrive%\tmp"
|
||||
DefVar $ExitCode$
|
||||
DefVar $ProductId$
|
||||
DefVar $InstallDir$
|
||||
DefVar $LicenseRequired$
|
||||
DefVar $LicensePool$
|
||||
|
||||
; ----------------------------------------------------------------
|
||||
; - Please edit the following values -
|
||||
; ----------------------------------------------------------------
|
||||
Set $ProductId$ = "opsi-template"
|
||||
Set $InstallDir$ = "%ProgramFilesDir%\" + $ProductId$
|
||||
Set $LicenseRequired$ = "false"
|
||||
Set $LicensePool$ = "p_" + $ProductId$
|
||||
; ----------------------------------------------------------------
|
||||
|
||||
|
||||
comment "Show product picture"
|
||||
ShowBitmap /3 "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
|
||||
|
||||
Message "Uninstalling " + $ProductId$ + " ..."
|
||||
|
||||
if FileExists("%ScriptPath%\delsub.ins")
|
||||
comment "Start uninstall sub section"
|
||||
Sub "%ScriptPath%\delsub.ins"
|
||||
endif
|
||||
|
||||
if not ($LicenseRequired$ = "false")
|
||||
comment "Licensing required, free license used"
|
||||
Sub_free_license
|
||||
endif
|
||||
|
||||
[Sub_free_license]
|
||||
if opsiLicenseManagementEnabled
|
||||
comment "License management is enabled and will be used"
|
||||
|
||||
comment "Trying to free license used for the product"
|
||||
DefVar $result$
|
||||
Set $result$ = FreeLicense($LicensePool$)
|
||||
; If there is an assignment of a license pool to the product, it is possible to use
|
||||
; Set $result$ = FreeLicense("", $ProductId$)
|
||||
;
|
||||
; If there is an assignment of a license pool to a windows software id, it is possible to use
|
||||
; DefVar $WindowsSoftwareId$
|
||||
; $WindowsSoftwareId$ = "..."
|
||||
; set $result$ = FreeLicense("", "", $WindowsSoftwareId$)
|
||||
else
|
||||
LogError "Error: licensing required, but license management not enabled"
|
||||
isFatalError
|
||||
endif
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
@@ -0,0 +1,299 @@
|
||||
; Copyright (c) uib gmbh (www.uib.de)
|
||||
; This sourcecode is owned by uib
|
||||
; and published under the Terms of the General Public License.
|
||||
|
||||
; TEMPLATE for
|
||||
; Skript fuer Installationen im Kontext eines temporaeren lokalen Administrators
|
||||
; installations as temporary local admin
|
||||
; see winst_manual.pdf / winst_handbuch.pdf
|
||||
|
||||
; !!! requires winst32.exe version 4.2.x !!!
|
||||
|
||||
;
|
||||
; !!! Das lokale Installations-Skript, das durch den temporaeren lokalen Admin ausgefuehrt wird
|
||||
; !!! (sein Name steht in $LocalSetupScript$), muss mit dem Befehl
|
||||
; !!! exitWindows /Reboot
|
||||
; !!! enden
|
||||
;
|
||||
|
||||
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
; Vorarbeiten/Voraussetzungen/Doku pruefen wie in Winsthandbuch
|
||||
; 8.3 Skript fuer Installationen im Kontext eines lokalen Administrators
|
||||
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
|
||||
[Actions]
|
||||
requiredWinstVersion >= 4.11.3.3
|
||||
setLogLevel=7
|
||||
DefVar $ProductName$
|
||||
DefVar $ProductSizeMB$
|
||||
DefVar $LocalSetupScript$
|
||||
DefVar $LockKeyboard$
|
||||
DefVar $OpsiAdminPass$
|
||||
DefVar $RebootFlag$
|
||||
DefVar $WinstRegKey$
|
||||
DefVar $AutoName$
|
||||
DefVar $AutoPass$
|
||||
DefVar $AutoDom$
|
||||
DefVar $AutoLogon$
|
||||
DefVar $AutoBackupKey$
|
||||
DefVar $LocalFilesPath$
|
||||
DefVar $LocalWinst$
|
||||
DefVar $DefaultLoglevel$
|
||||
DefVar $PasswdLogLevel$
|
||||
DefVar $AdminGroup$
|
||||
DefVar $SearchResult$
|
||||
DefVar $LocalDomain$
|
||||
DefVar $debug$
|
||||
DefVar $isFatal$
|
||||
|
||||
; ----------------------------------------------------------------
|
||||
; - Please edit the following values
|
||||
; ----------------------------------------------------------------
|
||||
Set $ProductName$ = "opsi-template-with-admin"
|
||||
Set $ProductSizeMB$ = "1"
|
||||
Set $LocalSetupScript$ = "setup32.ins"
|
||||
; ----------------------------------------------------------------
|
||||
|
||||
comment "get and set initial values..."
|
||||
set $debug$ = GetProductProperty("debug","false")
|
||||
set $isFatal$ = "false"
|
||||
set $DefaultLoglevel$ = "7"
|
||||
SetLogLevel=$DefaultLoglevel$
|
||||
Set $LocalDomain$ = "%PCNAME%"
|
||||
|
||||
comment "check if we productive or debugging..."
|
||||
if $debug$ = "true"
|
||||
comment "we are in debug mode"
|
||||
Set $LockKeyboard$="false"
|
||||
Set $PasswdLogLevel$="7"
|
||||
else
|
||||
comment "we are in productive mode"
|
||||
comment "set $LockKeyboard$ to true to prevent user hacks while admin is logged in"
|
||||
Set $LockKeyboard$="true"
|
||||
comment " set $PasswdLogLevel$ to 0 for production"
|
||||
Set $PasswdLogLevel$="0"
|
||||
endif
|
||||
|
||||
comment "handle Rebootflag"
|
||||
Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst"
|
||||
Set $RebootFlag$ = GetRegistryStringValue32("["+$WinstRegKey$+"] "+"RebootFlag")
|
||||
|
||||
comment "some paths required"
|
||||
Set $AutoBackupKey$ = $WinstRegKey$+"\AutoLogonBackup"
|
||||
Set $LocalFilesPath$ = "C:\opsi.org\tmp\opsi_local_inst"
|
||||
Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
|
||||
if not( FileExists($LocalWinst$) )
|
||||
LogError "No opsi-winst found. Abborting."
|
||||
isFatalError
|
||||
endif
|
||||
|
||||
comment "show product picture"
|
||||
ShowBitmap "%scriptpath%\localsetup\"+$ProductName$+".png" $ProductName$
|
||||
|
||||
if not (($RebootFlag$ = "1") or ($RebootFlag$ = "2") or ($RebootFlag$ = "3"))
|
||||
comment "Part before first Reboot"
|
||||
comment "just reboot - this must be done if this is the first product after OS installation"
|
||||
comment "handle Rebootflag"
|
||||
Set $RebootFlag$ = "1"
|
||||
Registry_SaveRebootFlag /32bit
|
||||
;ExitWindows /ImmediateReboot
|
||||
endif ; Rebootflag = not (1 or 2 or 3)
|
||||
|
||||
if $RebootFlag$ = "1"
|
||||
comment "Part before second Reboot"
|
||||
setActionProgress "Preparing"
|
||||
|
||||
if not(HasMinimumSpace ("%SYSTEMDRIVE%", ""+$ProductSizeMB$+" MB"))
|
||||
LogError "Not enough space on drive C: . "+$ProductSizeMB$+" MB on C: required for "+$ProductName$
|
||||
isFatalError
|
||||
endif
|
||||
|
||||
comment "Lets work..."
|
||||
Message "Preparing "+$ProductName$+" install step 1..."
|
||||
sub_Prepare_AutoLogon
|
||||
|
||||
comment "we need to reboot now to be sure that the autologon work"
|
||||
comment "handle Rebootflag"
|
||||
Set $RebootFlag$ = "2"
|
||||
Registry_SaveRebootFlag /32bit
|
||||
ExitWindows /ImmediateReboot
|
||||
endif ; Rebootflag = not (1 or 2)
|
||||
|
||||
if ($RebootFlag$ = "2")
|
||||
comment "Part after first Reboot"
|
||||
|
||||
comment "handle Rebootflag"
|
||||
Set $RebootFlag$ = "3"
|
||||
Registry_SaveRebootFlag /32bit
|
||||
|
||||
comment "Lets work..."
|
||||
Message "Preparing "+$ProductName$+" install step 2..."
|
||||
Registry_enable_keyboard /sysnative
|
||||
|
||||
comment "now let the autologon work"
|
||||
comment "it will stop with a reboot"
|
||||
setActionProgress "Run Installation"
|
||||
|
||||
ExitWindows /ImmediateLogout
|
||||
endif ; Rebootflag = 2
|
||||
|
||||
if ($RebootFlag$ = "3")
|
||||
comment "Part after second Reboot"
|
||||
ExitWindows /Reboot
|
||||
setActionProgress "Cleanup"
|
||||
comment "handle Rebootflag"
|
||||
Set $RebootFlag$ = "0"
|
||||
Registry_SaveRebootFlag /32bit
|
||||
|
||||
comment "Lets work..."
|
||||
Message "Cleanup "+$ProductName$+" install (step 3)..."
|
||||
sub_Restore_AutoLogon
|
||||
set $SearchResult$ = GetRegistryStringValueSysnative("[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce] opsi_autologon_setup")
|
||||
if $SearchResult$ = $LocalWinst$+" "+$LocalFilesPath$+"\"+$LocalSetupScript$+" /batch /productid %installingProdName%"
|
||||
LogError "Localscript did not run. We remove the RunOnce entry and abort"
|
||||
Registry_del_runonce /sysnative
|
||||
set $isFatal$ = "true"
|
||||
endif
|
||||
if "true" = getRegistryStringValue32("[HKLM\Software\opsi.org\winst] with-admin-fatal")
|
||||
LogError "set to fatal because the local script stored this result"
|
||||
set $isFatal$ = "true"
|
||||
endif
|
||||
comment "cleanup the registry key which stores a fatal result of the local script"
|
||||
Registry_clean_fatal_flag /32bit
|
||||
if $isFatal$ = "true"
|
||||
isFatalError
|
||||
endif
|
||||
comment "This is the clean end of the installation"
|
||||
endif ; Rebootflag = 3
|
||||
|
||||
|
||||
[sub_Prepare_AutoLogon]
|
||||
comment "copy the setup script and files"
|
||||
Files_copy_Setup_files_local
|
||||
comment "read actual Autologon values for backup"
|
||||
set $AutoName$ = GetRegistryStringValueSysnative("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] DefaultUserName")
|
||||
comment "if AutoLogonName is our setup admin user, something bad happend"
|
||||
comment "then let us cleanup"
|
||||
if ($AutoName$="opsiSetupAdmin")
|
||||
set $AutoName$=""
|
||||
set $AutoPass$=""
|
||||
set $AutoDom$=""
|
||||
set $AutoLogon$="0"
|
||||
else
|
||||
set $AutoPass$ = GetRegistryStringValueSysnative("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] DefaultPassword")
|
||||
set $AutoDom$ = GetRegistryStringValueSysnative("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] DefaultDomainName")
|
||||
set $AutoLogon$ = GetRegistryStringValueSysnative("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] AutoAdminLogon")
|
||||
endif
|
||||
|
||||
comment "backup AutoLogon values"
|
||||
Registry_save_autologon /32bit
|
||||
|
||||
comment "prepare the admin AutoLogon"
|
||||
SetLogLevel=$PasswdLogLevel$
|
||||
set $OpsiAdminPass$= randomstr
|
||||
Registry_autologon /sysnative
|
||||
|
||||
comment "get the name of the admin group"
|
||||
set $AdminGroup$ = SidToName("S-1-5-32-544")
|
||||
comment "create our setup admin user"
|
||||
DosInAnIcon_makeadmin
|
||||
SetLogLevel=$DefaultLoglevel$
|
||||
|
||||
comment "store our setup script as run once"
|
||||
Registry_runOnce /sysnative
|
||||
|
||||
comment "disable keyboard and mouse while the autologin admin works"
|
||||
if ($LockKeyboard$="true")
|
||||
Registry_disable_keyboard /Sysnative
|
||||
endif
|
||||
|
||||
comment "cleanup the registry key which stores a fatal result of the local script"
|
||||
Registry_clean_fatal_flag /32bit
|
||||
|
||||
[sub_Restore_AutoLogon]
|
||||
comment "read AutoLogon values from backup"
|
||||
set $AutoName$ = GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultUserName")
|
||||
set $AutoPass$ = GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultPassword")
|
||||
set $AutoDom$ = GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultDomainName")
|
||||
set $AutoLogon$ = GetRegistryStringValue("["+$AutoBackupKey$+"] AutoAdminLogon")
|
||||
|
||||
comment "restore the values"
|
||||
SetLogLevel = $PasswdLogLevel$
|
||||
Registry_restore_autologon /Sysnative
|
||||
SetLogLevel = $DefaultLoglevel$
|
||||
comment "delete our setup admin user"
|
||||
DosInAnIcon_deleteadmin
|
||||
comment "cleanup setup script, files and profiledir"
|
||||
Files_delete_Setup_files_local
|
||||
comment "delete profiledir"
|
||||
DosInAnIcon_deleteprofile
|
||||
|
||||
[Registry_save_autologon]
|
||||
openkey [$AutoBackupKey$]
|
||||
set "DefaultUserName"="$AutoName$"
|
||||
set "DefaultPassword"="$AutoPass$"
|
||||
set "DefaultDomainName"="$AutoDom$"
|
||||
set "AutoAdminLogon"="$AutoLogon$"
|
||||
|
||||
[Registry_restore_autologon]
|
||||
openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
|
||||
set "DefaultUserName"="$AutoName$"
|
||||
set "DefaultPassword"="$AutoPass$"
|
||||
set "DefaultDomainName"="$AutoDom$"
|
||||
set "AutoAdminLogon"="$AutoLogon$"
|
||||
|
||||
[DosInAnIcon_deleteadmin]
|
||||
NET USER opsiSetupAdmin /DELETE
|
||||
|
||||
[Registry_SaveRebootFlag]
|
||||
openKey [$WinstRegKey$]
|
||||
set "RebootFlag" = "$RebootFlag$"
|
||||
|
||||
[Files_copy_Setup_files_local]
|
||||
copy -s %ScriptPath%\localsetup\*.* $LocalFilesPath$
|
||||
|
||||
[Files_delete_Setup_files_local]
|
||||
del -sf $LocalFilesPath$\
|
||||
; folgender Befehl funktioniert nicht vollst<73>ndig, deshalb ist er zur Zeit auskommentier
|
||||
; der Befehl wird durch die Sektion "DosInAnIcon_deleteprofile" ersetzt (P.Ohler)
|
||||
;delete -sf "%ProfileDir%\opsiSetupAdmin"
|
||||
|
||||
[DosInAnIcon_deleteprofile]
|
||||
rmdir /S /Q "%ProfileDir%\opsiSetupAdmin"
|
||||
|
||||
[DosInAnIcon_makeadmin]
|
||||
NET USER opsiSetupAdmin $OpsiAdminPass$ /ADD
|
||||
NET LOCALGROUP $AdminGroup$ /ADD opsiSetupAdmin
|
||||
|
||||
[Registry_autologon]
|
||||
openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
|
||||
set "DefaultUserName"="opsiSetupAdmin"
|
||||
set "DefaultPassword"="$OpsiAdminPass$"
|
||||
set "DefaultDomainName"="$LocalDomain$"
|
||||
set "AutoAdminLogon"="1"
|
||||
|
||||
[Registry_runonce]
|
||||
openkey [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
|
||||
set "opsi_autologon_setup"='"$LocalWinst$" "$LocalFilesPath$\$LocalSetupScript$" /batch /productid %installingProdName%'
|
||||
|
||||
[Registry_del_runonce]
|
||||
openkey [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
|
||||
DeleteVar "opsi_autologon_setup"
|
||||
|
||||
[Registry_disable_keyboard]
|
||||
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass]
|
||||
set "Start"=REG_DWORD:0x4
|
||||
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mouclass]
|
||||
set "Start"=REG_DWORD:0x4
|
||||
|
||||
[Registry_enable_keyboard]
|
||||
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass]
|
||||
set "Start"=REG_DWORD:0x1
|
||||
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mouclass]
|
||||
set "Start"=REG_DWORD:0x1
|
||||
|
||||
[Registry_clean_fatal_flag]
|
||||
openkey [$WinstRegKey$]
|
||||
DeleteVar "with-admin-fatal"
|
||||
|
||||
122
sample/source/4.0.2/opsi-template-with-admin/OPSI/control
Normal file
122
sample/source/4.0.2/opsi-template-with-admin/OPSI/control
Normal file
@@ -0,0 +1,122 @@
|
||||
[Package]
|
||||
version: 2
|
||||
depends:
|
||||
incremental: False
|
||||
|
||||
[Product]
|
||||
type: localboot
|
||||
id: opsi-template-with-admin
|
||||
name: opsi template for installs with logged in admin
|
||||
description: A opsi demo package
|
||||
advice:
|
||||
version: 4.0.2
|
||||
priority: -20
|
||||
licenseRequired: False
|
||||
productClasses:
|
||||
setupScript: setup.ins
|
||||
uninstallScript: localsetup\uninstall.ins
|
||||
updateScript:
|
||||
alwaysScript:
|
||||
onceScript:
|
||||
customScript:
|
||||
userLoginScript:
|
||||
|
||||
[ProductProperty]
|
||||
type: bool
|
||||
name: debug
|
||||
description: should be false for production: switch off keyboard lock and increase loglevel
|
||||
default: False
|
||||
|
||||
[ProductProperty]
|
||||
type: bool
|
||||
name: test-set-fatal
|
||||
description: test only: if true script result is set to fatal
|
||||
default: False
|
||||
|
||||
[Changelog]
|
||||
opsi-template-with-admin (4.0.2-2) stable; urgency=low
|
||||
|
||||
* requires opsi-winst >= 4.11.3.3
|
||||
* uses /productid switch at opsi-winst call
|
||||
* code cleanup (use of synative instead of 64bit)
|
||||
* property debug: switches loglevel and lock keyboard
|
||||
* code cleanup
|
||||
|
||||
-- detlef oertel <d.oertel@uib.de> Thu, 19 Sep 2012 15:01:53 +0200
|
||||
|
||||
|
||||
opsi-template-with-admin (4.0.2-1) stable; urgency=low
|
||||
|
||||
* requires opsi-winst >= 4.11.3
|
||||
* using SidToName instead of psgetsid.exe
|
||||
* priority set to -20
|
||||
* first reboot is commented (;ExitWindows /ImmediateReboot). Uncomment it if you have problems with the autologon
|
||||
|
||||
-- detlef oertel <d.oertel@uib.de> Wed, 04 Jul 2012 15:01:53 +0200
|
||||
|
||||
|
||||
opsi-template-with-admin (1.0-8) stable; urgency=low
|
||||
|
||||
* localdomain = "%PCNAME%"
|
||||
|
||||
-- Jan Schneider <j.schneider@uib.de> Wed, 4 May 2011 14:09:00 +0100
|
||||
|
||||
opsi-template-with-admin (1.0-7) stable; urgency=low
|
||||
|
||||
* localdomain = "." for nt6
|
||||
|
||||
-- Jan Schneider <j.schneider@uib.de> Tue, 29 Mar 2011 17:56:00 +0100
|
||||
|
||||
opsi-template-with-admin (1.0-6) stable; urgency=low
|
||||
|
||||
* postinst fix: /bin/bash
|
||||
* preinst fix: no more case sensitiv for pcgetsid.exe
|
||||
|
||||
-- detlef oertel <d.oertel@uib.de> Tue, 30 Dec 2010 15:01:53 +0200
|
||||
|
||||
opsi-template-with-admin (1.0-5) testing; urgency=low
|
||||
|
||||
* added support for opsi 4.0 opsi-client-agent
|
||||
* scripts renamed to setup.ins, local_setup.ins and uninstall.ins
|
||||
|
||||
-- detlef oertel <d.oertel@uib.de> Tue, 13 Jun 2010 15:01:53 +0200
|
||||
|
||||
|
||||
opsi-template-with-admin (1.0-4) testing; urgency=low
|
||||
|
||||
* new (64 bit) functions of winst 4.10.3 used
|
||||
|
||||
-- detlef oertel <d.oertel@uib.de> Fri, 16 Apr 2010 15:01:53 +0200
|
||||
|
||||
|
||||
opsi-template-with-admin (1.0-3) testing; urgency=low
|
||||
|
||||
* in [sub_fetch_SearchResult] changed ("$s$") to ('$s$')
|
||||
|
||||
-- detlef oertel <d.oertel@uib.de> Tue, 26 Jan 2010 15:01:53 +0200
|
||||
|
||||
opsi-template-with-admin (1.0-2) stable; urgency=low
|
||||
|
||||
* added support for 64 Bit
|
||||
* code cleanup
|
||||
* added psgetsid for international support
|
||||
|
||||
-- detlef oertel <d.oertel@uib.de> Mon, 14 Dec 2009 15:01:53 +0200
|
||||
|
||||
|
||||
opsi-template-with-admin (1.0-1) stable; urgency=low
|
||||
|
||||
* initial package based on http://www.opsi.org/opsi_wiki/TemplateForInstallationsAsTemporaryLocalAdmin
|
||||
|
||||
-- detlef oertel <d.oertel@uib.de> Mon, 13 Nov 2009 15:01:53 +0200
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
26
sample/source/4.0.2/opsi-template-with-admin/OPSI/postinst
Normal file
26
sample/source/4.0.2/opsi-template-with-admin/OPSI/postinst
Normal file
@@ -0,0 +1,26 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# This script executes after unpacking files from that archive and registering the product at the server.
|
||||
#
|
||||
# The following environment variables can be used to obtain information about the current installation:
|
||||
# PRODUCT_ID: id of the current product
|
||||
# CLIENT_DATA_DIR: directory which contains the installed client data
|
||||
#
|
||||
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
|
||||
|
||||
echo 'Restoring previous files...'
|
||||
if [ -f $TMP_DIR/psgetsid.exe ]; then
|
||||
mv $TMP_DIR/psgetsid.exe $CLIENT_DATA_DIR/ || exit 1
|
||||
fi
|
||||
|
||||
echo 'get files if not present'
|
||||
if [ ! -f "$CLIENT_DATA_DIR/psgetsid.exe" ]; then
|
||||
cd $CLIENT_DATA_DIR
|
||||
echo 'try to get zip'
|
||||
wget http://download.sysinternals.com/Files/PsTools.zip
|
||||
echo 'unzip'
|
||||
unzip -o PsTools.zip
|
||||
fi
|
||||
|
||||
echo "Removing temporary files..."
|
||||
rm -rf $TMP_DIR
|
||||
28
sample/source/4.0.2/opsi-template-with-admin/OPSI/preinst
Normal file
28
sample/source/4.0.2/opsi-template-with-admin/OPSI/preinst
Normal file
@@ -0,0 +1,28 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# preinst script for softprod
|
||||
# This script executes before that package will be unpacked from its archive file.
|
||||
#
|
||||
# The following environment variables can be used to obtain information about the current installation:
|
||||
# PRODUCT_ID: id of the current product
|
||||
# CLIENT_DATA_DIR: directory where client data will be installed
|
||||
#
|
||||
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
|
||||
|
||||
if [ -d $TMP_DIR ]; then
|
||||
echo "Temporary directory $TMP_DIR already exist, aborting!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ ! -d $CLIENT_DATA_DIR ] && mkdir $CLIENT_DATA_DIR
|
||||
mkdir $TMP_DIR
|
||||
|
||||
if [ -d $CLIENT_DATA_DIR ]; then
|
||||
echo "Saving previous files..."
|
||||
if [ -f $CLIENT_DATA_DIR/[pP][sS][gG][eE][tT][sS][iI][dD].[eE][xX][eE] ]; then
|
||||
mv $CLIENT_DATA_DIR/[pP][sS][gG][eE][tT][sS][iI][dD].[eE][xX][eE] $TMP_DIR/psgetsid.exe || exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user