revised and updated

This commit is contained in:
Dennis Trinks 2012-07-05 17:12:06 +02:00
parent 09377f3ab8
commit 6f8f604b2d
2 changed files with 197 additions and 101 deletions

View File

@ -0,0 +1,4 @@
rundll32 user32.dll LockWorkStation %windir%
ms-activation.vbs
sc config opsiclientd start= auto
net start opsiclientd

View File

@ -1,101 +1,193 @@
; Copyright (c) uib gmbh (www.uib.de) ; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib ; This sourcecode is owned by uib
; and published under the Terms of the General Public License. ; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/credits/ ; credits: http://www.opsi.org/credits/
[Actions] [Actions]
requiredWinstVersion >= "4.10.8.6" requiredWinstVersion >= "4.10.8.6"
DefVar $MsiId$
DefVar $UninstallProgram$ DefVar $Proxy_Port$
DefVar $LogDir$ DefVar $Flag$
DefVar $ProductId$ DefVar $WinstRegKey$
DefVar $MinimumSpace$ DefVar $MsiId$
DefVar $InstallDir$ DefVar $UninstallProgram$
DefVar $ExitCode$ DefVar $LogDir$
DefVar $LicenseRequired$ DefVar $ProductId$
DefVar $LicenseKey$ DefVar $MinimumSpace$
DefVar $LicensePool$ DefVar $InstallDir$
DefVar $ExitCode$
Set $LogDir$ = "%SystemDrive%\tmp" DefVar $LicenseRequired$
DefVar $LicenseKey$
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh DefVar $LicensePool$
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index] Set $LogDir$ = "%SystemDrive%\tmp"
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst"
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL Set $Flag$ = GetRegistryStringValue32("["+$WinstRegKey$+"] "+"RebootFlag")
; auto generated winst-variables Set $Proxy_Port$ = "pubproxy:3128"
; $IconFile$: path to product picture
; ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
@@BUILDER_VARIABLES@@ ; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; ---------------------------------------------------------------- ; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; - Please edit the following values - ; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; ---------------------------------------------------------------- ; auto generated winst-variables
;$ProductId$ should be the name of the product in opsi ; $IconFile$: path to product picture
; therefore please: only lower letters, no umlauts, ;
; no white space use '-' as a seperator DefVar $VENDOR$
Set $ProductId$ = "windows.activation" Set $VENDOR$ = "microsoft.com"
Set $MinimumSpace$ = "1 MB" DefVar $PN$
; the path were we find the product after the installation Set $PN$ = "windows.activation"
Set $InstallDir$ = "%ProgramFiles32Dir%\<path to the product>" DefVar $VERSION$
Set $LicenseRequired$ = "false" Set $VERSION$ = "1"
Set $LicensePool$ = "p_" + $ProductId$ DefVar $RELEASE$
; ---------------------------------------------------------------- Set $RELEASE$ = "5"
DefVar $PRIORITY$
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$)) Set $PRIORITY$ = "0"
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$ DefVar $ADVICE$
isFatalError Set $ADVICE$ = ""
; Stop process and set installation status to failed DefVar $TYPE$
else Set $TYPE$ = "public"
; comment "Show product picture" DefVar $CREATOR_TAG$
; ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ Set $CREATOR_TAG$ = "dt"
DefVar $CREATOR_NAME$
if FileExists("%ScriptPath%\delsub32.ins") Set $CREATOR_NAME$ = "Dennis Trinks"
comment "Start uninstall sub section" DefVar $CREATOR_EMAIL$
Sub "%ScriptPath%\delsub32.ins" Set $CREATOR_EMAIL$ = "dennis.trinks@dtnet.de"
endif DefVar $IconFile$
Set $IconFile$ = "%ScriptPath%\windows.activation.png"
Message "Installing " + $ProductId$ + " ..."
if $LicenseRequired$ = "true" ; ----------------------------------------------------------------
comment "Licensing required, reserve license and get license key" ; - Please edit the following values -
Sub_get_licensekey ; ----------------------------------------------------------------
endif ;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts,
; no white space use '-' as a seperator
comment "Copy files" Set $ProductId$ = "windows.activation"
Files_install Set $MinimumSpace$ = "1 MB"
; the path were we find the product after the installation
comment "Start setup program" Set $InstallDir$ = "%ProgramFiles32Dir%\<path to the product>"
Winbatch_install Set $LicenseRequired$ = "false"
Sub_check_exitcode Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
comment "Reboot"
ExitWindows /Reboot if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
endif isFatalError
; Stop process and set installation status to failed
[Files_install] else
copy "%ScriptPath%\ms-activation.vbs" %System% ; comment "Show product picture"
; ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
[Winbatch_install]
; Choose one of the following examples as basis for your installation if FileExists("%ScriptPath%\delsub32.ins")
; You can use $LicenseKey$ var to pass a license key to the installer comment "Start uninstall sub section"
; Sub "%ScriptPath%\delsub32.ins"
; === Nullsoft Scriptable Install System ================================================================ endif
ms-activation.vbs Message "Installing " + $ProductId$ + " ..."
[Sub_check_exitcode] if $LicenseRequired$ = "true"
comment "Test for installation success via exit code" comment "Licensing required, reserve license and get license key"
set $ExitCode$ = getLastExitCode Sub_get_licensekey
; informations to exit codes see endif
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx if $Flag$ = ""
if ($ExitCode$ = "0") Set $Flag$ = "1"
comment "Looks good: setup program gives exitcode zero" Registry_SaveRebootFlag
else DOSInAnIcon_AddActivationAdmin
comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ DOSInAnIcon_deactOpsiSrv
isFatalError ; DOSInAnIcon_SetProxy
endif Files_install_servicebatch
Files_install
Registry_SetAutoadmin
Registry_SetRunOnce
ExitWindows /ImmediateReboot
Endif
if $Flag$ = "1"
Set $Flag$ = "2"
DOSInAnIcon_deactOpsiSrv
Registry_SetRunOnce
Registry_SaveRebootFlag
ExitWindows /ImmediateReboot
Endif
if $Flag$ = "2"
Set $Flag$ = "3"
Registry_SaveRebootFlag
Registry_DisableAutoadmin
ExitWindows /ImmediateReboot
Endif
if $Flag$ = "3"
Registry_DeleteRebootFlag
DOSInAnIcon_DeleteActivationAdmin
Endif
endif
[Files_install_servicebatch]
copy "%ScriptPath%\service_batch.bat" "C:\tmp"
[Files_install]
copy "%ScriptPath%\ms-activation.vbs" %System%
[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 ================================================================
ms-activation.vbs
[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$
isFatalError
endif
[Registry_SaveRebootFlag]
openKey [$WinstRegKey$]
set "RebootFlag" = "$Flag$"
[Registry_DeleteRebootFlag]
openKey [$WinstRegKey$]
DeleteVar "RebootFlag"
[Registry_SetAutoadmin]
openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
set "DefaultUserName"="activationadmin"
set "DefaultPassword"="4ct1vat!0n"
set "DefaultDomainName"="%PCName%"
set "AutoAdminLogon"="1"
[Registry_DisableAutoadmin]
openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
set "DefaultUserName"=""
set "DefaultPassword"=""
set "AutoAdminLogon"="0"
[Registry_SetRunOnce]
openkey [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
set "OpsiService"="C:\tmp\service_batch.bat"
[DOSInAnIcon_AddActivationAdmin]
net user activationadmin 4ct1vat!0n /add
net localgroup Administratoren /add activationadmin
[DOSInAnIcon_DeleteActivationAdmin]
net user activationadmin /delete
[DOSInAnIcon_SetProxy]
proxycfg -p $Proxy_Port$
[DOSInAnIcon_deactOpsiSrv]
sc config opsiclientd start= disabled