Differences

This shows you the differences between two versions of the page.

Link to this comparison view

userspace:asap_for_local_use [2019/05/14 10:07] (current)
Thomas_H created
Line 1: Line 1:
 +====== **ASAP For Local Use** ======
  
 +Tested with opsi 4.10.8.6\\
 +requiredWinstVersion >= "​4.10.8.6"​\\
 +For 32 and 64 Bit\\
 +Installation files at https://​www.askus.biz/​files/​askus/​images/​Download/​ASAP_Local.msi
 +
 +questions to:  //​[[thomas.heinrich@polizei.berlin.de|Thomas_H]] 2019/05/14 08:49//
 +
 +history:\\
 +created: ​ --- //​[[thomas.heinrich@polizei.berlin.de|Thomas_H]] 2019/05/14 08:49//
 +
 +"ASAP For Local Use" (no... ;-) 'Not As Soon As Possible',​ it's "​__A__utomatic and __S__ecure __A__dmin-Credentials __P__rovider"​) allows you to run a special program under admin-rights. As the website says, it only allows the defined program, but it avoids, that other programs could be also started under admin-rights,​ while using the fileselectorbox called by the defined program. I haven'​t tested THIS yet. It's a much better alternative to '​runas.exe'​.
 +
 +Tree:\\
 +<​code>​
 +├ ASAP.jpg
 +├ ASAP_Local.msi\\
 +├ setup.ins\\
 +└ uninstall.ins
 +</​code>​
 +
 +
 +==== setup.ins ====
 +<code winst>
 +; 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/​
 +
 +[Initial]
 +SetLogLevel=9
 +;  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
 +
 +
 +[Actions]
 +requiredWinstVersion >= "​4.10.8.6"​
 +
 +DefVar $LogDir$
 +DefVar $ProductId$
 +DefVar $MinimumSpace$
 +DefVar $InstallDir32$
 +DefVar $InstallDir64$
 +DefVar $ExitCode$
 +DefVar $LicenseRequired$
 +DefVar $LicenseKey$
 +DefVar $LicensePool$
 +DefVar $INST_SystemType$
 +DefVar $INST_architecture$
 +DefVar $Version$
 +DefVar $Inst_Cmd$
 +DefVar $Inst_Prg32$
 +DefVar $Inst_Prg64$
 +DefVar $Uninst_Cmd$
 +DefVar $Uninst_Prg$
 +
 +Set $INST_SystemType$ = GetSystemType
 +set $INST_architecture$ = GetProductProperty("​install_architecture","​system specific"​)
 +
 +Set $LogDir$ = "​%SystemDrive%\tmp"​
 +
 +; ----------------------------------------------------------------
 +; - 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$ ​      = "​ASAP"​
 +Set $Version$ ​        = "​2.8.4.0"​
 +Set $MinimumSpace$ ​   = "10 MB"
 +; the path were we find the product after the installation
 +Set $InstallDir32$ ​     = "​%ProgramFiles32Dir%\askus\ASAP"​
 +; Set $InstallDir64$ ​     = "​%ProgramFiles64Dir%\<​programmordner>​\" ​    - nicht genutzt
 +Set $LicenseRequired$ = "​false"​
 +Set $LicensePool$ ​    = "​p_"​ + $ProductId$
 +Set $Inst_Prg32$ ​     = "​Asap_Local.msi"​
 +Set $Inst_Prg64$ ​     = "​Asap_Local.msi"​
 +Set $Uninst_Prg$ ​     = "​c:​\windows\system32\msiexec.exe"​
 +Set $Inst_Cmd$ ​       = ' /qn'
 +Set $Uninst_Cmd$ ​     = ' /​X{FBE8F570-3D8C-42B4-955C-C3E09D568530} /qn'
 +; ----------------------------------------------------------------
 +
 +comment "Show product picture"​
 +ShowBitmap "​%ScriptPath%\"​ + $ProductId$ + "​.jpg"​ $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
 +
 +        if FileExists("​$InstallDir32$"​)
 +                comment "Start uninstall sub section"​
 +                Sub "​%ScriptPath%\delsub.ins"​
 +        endif
 +        if FileExists("​$InstallDir64$"​)
 +                comment "Start uninstall sub section"​
 +                Sub "​%ScriptPath%\delsub.ins"​
 +        endif
 +
 +        if $LicenseRequired$ = "​true"​
 +                comment "​Licensing required, reserve license and get license key"
 +                Sub_get_licensekey
 +        endif
 +
 +        comment "​Installiere "​+$ProductID$+"​..."​
 +
 +        if (($INST_SystemType$ = "x86 System"​) and ($INST_architecture$ = "​system specific"​)) or ($INST_architecture$ = "​both"​) or ($INST_architecture$ = "32 only")
 +                Message "​Installiere " + $ProductId$+"​ (32 Bit)"
 +                comment "Start setup program"​
 +                Winbatch_install_32
 +                Sub_check_exitcode
 +        endif
 +
 +        if ($INST_SystemType$ = "64 Bit System"​) and (($INST_architecture$ = "​system specific"​) or ($INST_architecture$ = "​both"​) or ($INST_architecture$ = "64 only"​))
 +                Message "​Installiere " + $ProductId$+"​ (64 Bit)"
 +                comment "Start setup program"​
 +                Winbatch_install_64
 +                Sub_check_exitcode
 +        endif
 +
 +endif
 +
 +
 +[Winbatch_install_32]
 +msiexec /i %ScriptPath%\$Inst_Prg32$ $Inst_Cmd$
 +
 +[Winbatch_install_64]
 +msiexec /i %ScriptPath%\$Inst_Prg64$ $Inst_Cmd$
 +
 +
 +[Sub_check_exitcode]
 +comment "Test for installation success via exit code"
 +set $ExitCode$ = getLastExitCode
 +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
 +</​code>​
 +
 +
 +==== uninstall.ins ====
 +<code winst>
 +[Initial]
 +ExitOnError=true
 +StayOnTop = true
 +TraceMode = off
 +
 +[Actions]
 +requiredWinstVersion >= "​4.10.5"​
 +
 +DefVar $ProductId$
 +DefVar $ExitCode$
 +DefVar $NTVersioninfo$
 +DefVar $UninstallCommand$
 +DefVar $Parameter$
 +DefVar $UninstallID$
 +DefVar $UninstPrg$
 +DefVar $RegPath$
 +SetLogLevel=6
 +
 +; ----------------------------------------------------------------
 +Set $RegPath$ = "​\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"​
 +Set $UninstallID$ = "​{FBE8F570-3D8C-42B4-955C-C3E09D568530}"​
 +Set $UninstPrg$ = "​C:​\Windows\System32\msiexec.exe"​
 +; ----------------------------------------------------------------
 +
 +Set $ProductId$ = GetRegistrystringvalue32("​[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{FBE8F570-3D8C-42B4-955C-C3E09D568530}] DisplayName"​)
 +ShowBitmap ​ "​%ScriptPath%\ASAP.jpg"​ $ProductId$
 +Message "​Deinstalliert ​ " + $ProductId$ + " ..."
 +
 +if not ($ProductID$ = ""​)
 +    Message "​Deinstalliere "​+$ProductID$
 +
 +    set $UninstallCommand$ = " /x $UninstallID$ /qb-! REBOOT=ReallySuppress"​
 +    Winbatch_remove
 +    Sub_check_exitcode
 +endif
 +
 +[Winbatch_remove]
 +$UninstPrg$ $UninstallCommand$
 +
 +[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
 +</​code>​

QR Code
QR Code userspace:asap_for_local_use (generated for current page)