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)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/credits/
[Actions]
requiredWinstVersion >= "4.10.8.6"
DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
Set $LogDir$ = "%SystemDrive%\tmp"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; 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
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts,
; no white space use '-' as a seperator
Set $ProductId$ = "windows.activation"
Set $MinimumSpace$ = "1 MB"
; the path were we find the product after the installation
Set $InstallDir$ = "%ProgramFiles32Dir%\<path to the product>"
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$
isFatalError
; Stop process and set installation status to failed
else
; comment "Show product picture"
; ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
if FileExists("%ScriptPath%\delsub32.ins")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub32.ins"
endif
Message "Installing " + $ProductId$ + " ..."
if $LicenseRequired$ = "true"
comment "Licensing required, reserve license and get license key"
Sub_get_licensekey
endif
comment "Copy files"
Files_install
comment "Start setup program"
Winbatch_install
Sub_check_exitcode
comment "Reboot"
ExitWindows /Reboot
endif
[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
; 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]
requiredWinstVersion >= "4.10.8.6"
DefVar $Proxy_Port$
DefVar $Flag$
DefVar $WinstRegKey$
DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
Set $LogDir$ = "%SystemDrive%\tmp"
Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst"
Set $Flag$ = GetRegistryStringValue32("["+$WinstRegKey$+"] "+"RebootFlag")
Set $Proxy_Port$ = "pubproxy:3128"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; 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
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
DefVar $VENDOR$
Set $VENDOR$ = "microsoft.com"
DefVar $PN$
Set $PN$ = "windows.activation"
DefVar $VERSION$
Set $VERSION$ = "1"
DefVar $RELEASE$
Set $RELEASE$ = "5"
DefVar $PRIORITY$
Set $PRIORITY$ = "0"
DefVar $ADVICE$
Set $ADVICE$ = ""
DefVar $TYPE$
Set $TYPE$ = "public"
DefVar $CREATOR_TAG$
Set $CREATOR_TAG$ = "dt"
DefVar $CREATOR_NAME$
Set $CREATOR_NAME$ = "Dennis Trinks"
DefVar $CREATOR_EMAIL$
Set $CREATOR_EMAIL$ = "dennis.trinks@dtnet.de"
DefVar $IconFile$
Set $IconFile$ = "%ScriptPath%\windows.activation.png"
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts,
; no white space use '-' as a seperator
Set $ProductId$ = "windows.activation"
Set $MinimumSpace$ = "1 MB"
; the path were we find the product after the installation
Set $InstallDir$ = "%ProgramFiles32Dir%\<path to the product>"
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$
isFatalError
; Stop process and set installation status to failed
else
; comment "Show product picture"
; ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
if FileExists("%ScriptPath%\delsub32.ins")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub32.ins"
endif
Message "Installing " + $ProductId$ + " ..."
if $LicenseRequired$ = "true"
comment "Licensing required, reserve license and get license key"
Sub_get_licensekey
endif
if $Flag$ = ""
Set $Flag$ = "1"
Registry_SaveRebootFlag
DOSInAnIcon_AddActivationAdmin
DOSInAnIcon_deactOpsiSrv
; DOSInAnIcon_SetProxy
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