opsi-script libraries
opsi-script libraries from uib
Documentation of opsi-script libraries that are part of the opsiscript / opsi-script and are mantained by the uib gmbh
Documentation of opsi library: uib_backend.opsiscript
-
Email: d.oertel@uib.de
-
Version: 1.0
-
Copyright: AGPLv3
Documentation of local function setProductsToUninstall
- Definition
-
setProductsToUninstall($productlist$ : stringlist) : string
- Description
-
Sets for the given list of opsi productIds the action request to 'uninstall'
-
Parameter:
$productlist$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$productlist$
Description:
List of opsi product Ids
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Works only in opsi service mode (not in interactive or batch mode)
-
Author: detlef oertel
-
Date: 22.08.2019
-
Example:
[actions]
DefStringlist $productlist$
set $productlist$ = CreateStringList("opsi-logviewer","opsi-configed")
if not(stringtobool(setProductsToUninstall($productlist$)))
comment "call of setProductsToUninstall failed"
endif
Documentation of local function setProductsToSetup
- Definition
-
setProductsToSetup($productlist$ : stringlist) : string
- Description
-
Sets for the given list of opsi productIds the action request to 'setup' (try also resolving the dependencies)
-
Parameter:
$productlist$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$productlist$
Description:
List of opsi product Ids
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Works only in opsi service mode (not in interactive or batch mode) Works without resolving dependencies for use in WAN mode while withdependencies is missing in opsiclientd
-
Author: detlef oertel
-
Date: 05.11.2018
-
Example:
[actions]
DefStringlist $productlist$
set $productlist$ = CreateStringList("opsi-logviewer","opsi-configed")
if not(stringtobool(setProductsToSetup($productlist$)))
comment "call of setProductsToSetup failed"
endif
Documentation of local function handle_setup_after_property
- Definition
-
handle_setup_after_property($propname$ : string) : string
- Description
-
The given parameter $propname$ has to be the name of a property that holds a list of productIds The function takes this list If it is only one string and this string contains ',' it will be splitted to a list Sets for the given list of opsi productIds the action request to 'setup' (try also resolving the dependencies)
-
Parameter:
$propname$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$propname$
Description:
List of opsi product Ids
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Works only in opsi service mode (not in interactive or batch mode)
-
Author: detlef oertel
-
Date: 26.05.2020
-
Example:
[actions]
DefVar $propname$
if not(stringtobool(handle_setup_after_property($propname$)))
comment "call of handle_setup_after_property failed"
endif
Documentation of local function getInstalledLocalbootProducts
- Definition
-
getInstalledLocalbootProducts(ref $productlist$ : stringlist) : string
- Description
-
Gets a list of productIds which are
-
known to the client (productOnClient object exists)
-
and localboot products. to 'setup' (also resolving the dependencies)
-
Parameter:
$productlist$
-
Type:
Stringlist
- Calltype:CallByReference
-
Parameter
$productlist$
Description:
Output list of opsi product Ids that were be found -
Parameter
$productlist$
Advice:
May be empty
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Works only in opsi service mode (not in interactive or batch mode)
-
Author: detlef oertel
-
Date: 20.4.2018
-
Example:
if stringToBool(getInstalledLocalbootProducts($resultlist$))
comment "getInstalledLocalbootProducts successful finished"
else
LogError "getInstalledLocalbootProducts failed"
endif
set $tmplist$ = getListContainingList($baseproducts$,$resultlist$)
if stringToBool(compareLists($tmplist$,$baseproducts$))
comment "check installed products successful finished"
else
LogError "check installed products failed"
endif
comment " now install and rest products ...."
if stringToBool(setProductsToSetup($resetproducts$))
comment "setProductsToSetup successful finished"
else
LogError "setProductsToSetup failed"
endif
Documentation of local function delOpsiPoc
- Definition
-
delOpsiPoc($donotdelList$ : stringlist) : string
- Description
-
Delete all productOnClientObjects for this client and only for localboot products and not for products that are included in the $donotdelList$ parameter
-
Parameter:
$donotdellist$
-
Type:
Stringlist
- Calltype:CallByValue
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Works only in opsi service mode (not in interactive or batch mode)
-
Author: detlef oertel
-
Date: 17.4.2018
-
Example:
set $opsiMetaDataFile$ = $targetDir$+"\poc.json"
if Fileexists($opsiMetaDataFile$)
comment "Delete existing meta data ...."
set $tmplist$ = createStringList ("opsi-vhd-tester","opsi-vhd-control","opsi-vhd-auto-upgrade")
if stringToBool(delOpsiPoc($tmplist$))
comment "Delete existing meta data successful finished"
else
LogError "Delete existing meta data failed"
endif
comment "Restore existing meta data ...."
if stringToBool(restoreOpsiPoc($opsiMetaDataFile$))
comment "Restore existing meta data successful finished"
else
LogError "Restore existing meta data failed"
endif
else
comment "No meta data existing - creating it...."
if stringToBool(backupOpsiPoc($opsiMetaDataFile$))
comment "Backup meta data successful finished"
else
LogError "Backup meta data failed"
endif
endif
Documentation of local function backupOpsiPoc
- Definition
-
backupOpsiPoc($filename$ : string) : string
- Description
-
Get all localboot productOnClient objects for this client and write it to the json file $filename$
-
Parameter:
$filename$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$filename$
Description:
Complete name of the file to create
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Works only in opsi service mode (not in interactive or batch mode)
-
References: [restoreOpsiPoc]
[delOpsiPoc] -
Author: detlef oertel
-
Date: 17.4.2018
-
Example:
see delOpsiPoc
Documentation of local function restoreOpsiPoc
- Definition
-
restoreOpsiPoc($filename$ : string) : string
- Description
-
Load productOnClient objects from $filename$ and write it to to the server
-
Parameter:
$filename$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$filename$
Description:
Complete name of the file to read
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Works only in opsi service mode (not in interactive or batch mode)
-
Author: detlef oertel
-
Date: 17.4.2018
-
Example:
see delOpsiPoc
Documentation of local function getInstalledLocalbootProductsWithVersion
- Definition
-
getInstalledLocalbootProductsWithVersion(ref $productlist$ : stringlist) : string
- Description
-
Get all localboot productOnClient objects for this client and create a key/value list in the format <productId>=<productVersion>-<packageVersion> This list is be written to $productlist$
-
Parameter:
$productlist$
-
Type:
Stringlist
- Calltype:CallByReference
-
Parameter
$productlist$
Description:
The key/value list with all <productId>=<productVersion>-<packageVersion> of the client
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Works only in opsi service mode (not in interactive or batch mode)
-
Author: detlef oertel
-
Date: 17.4.2018
-
Example:
comment "check for installed products ...."
if stringToBool(getInstalledLocalbootProductsWithVersion($installedproducts$))
comment "getInstalledLocalbootProducts successful finished"
else
LogError "getInstalledLocalbootProducts failed"
endif
comment "check for installable products ...."
if stringToBool(getInstallableLocalbootProductsWithVersion($possibleproducts$))
comment "getInstallableLocalbootProductsWithVersion successful finished"
else
LogError "getInstallableLocalbootProductsWithVersion failed"
endif
comment "fill $upgradeproducts$ .."
set $tmplist$ = getKeyList($installedproducts$)
set $possibleproducts$ = getSubListByKey($tmplist$,$possibleproducts$)
for %aktprod% in $installedproducts$ do sub_find_updatable_products
Documentation of local function getInstallableLocalbootProductsWithVersion
- Definition
-
getInstallableLocalbootProductsWithVersion(ref $productlist$ : stringlist) : string
- Description
-
Get all localboot productOnDepot objects for the depot of this client and create a key/value list in the format <productId>=<productVersion>-<packageVersion> This list is be written to $productlist$
-
Parameter:
$productlist$
-
Type:
Stringlist
- Calltype:CallByReference
-
Parameter
$productlist$
Description:
The key/value list with all <productId>=<productVersion>-<packageVersion> of the depot of this client
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Works only in opsi service mode (not in interactive or batch mode)
-
Author: detlef oertel
-
Date: 17.4.2018
-
Example:
see getInstalledLocalbootProductsWithVersion
check_module_activation
- Definition
-
check_module_activation($modulename$ : string) : void
- Description
-
Check if opsi module '$modulename$' is activated
-
Parameter:
$modulename$
-
Type:
String
- Calltype:CallByValue
-
Description: name of the module to check
-
-
Returns: Returns nothing if ok
-
OnError: Calls isFatalError if not activated
-
SpecialCase: Works only in opsi service mode (not in interactive or batch mode)
-
Documentation of opsi library: uib_bootutils.opsiscript
-
Email: d.oertel@uib.de
-
Version: 1.0
-
Copyright: AGPLv3
escapeRegexMetaChars
- Definition
-
escapeRegexMetaChars($instring$ : string) : string
- Description
-
Returns the given string with all regex relevant chars '\^$.|?*+()[{' escaped
-
Parameter:
$instring$
-
Type:
String
- Calltype:CallByValue
-
Description: String to escape
-
-
Returns: Returns the escaped string
-
OnError: Returns the escaped string
-
Links: https://www.regextutorial.org/regular-expression-metacharacters.php
-
Author: detlef oertel
-
Date: 19.06.2023
-
Documentation of local function delFromWindowsBootmanager
- Definition
-
delFromWindowsBootmanager($bootlabel$ : string) : string
- Description
-
Deletes the boot entry given given by the parameter $bootlabel$ from Windows boot manager by using bcdedit
-
Parameter:
$bootlabel$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$bootlabel$
Description:
Windows boot manager entry label found in 'bcdedit /v'
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only
-
References: [getWinBcdbootGuid]
[bootNextToWinLabel]
[bootNextToUefiLabel]
[getUefiBcdbootGuid] -
Author: detlef oertel
-
Date: 18.01.2022
-
Example:
[actions]
DefStringlist $productlist$
set $productlist$ = CreateStringList("opsi-logviewer","opsi-configed")
if not(stringtobool(setProductsToSetup($productlist$)))
comment "call of setProductsToSetup failed"
endif
Documentation of local function getWinBcdbootGuid
- Definition
-
getWinBcdbootGuid($bootlabel$ : string) : string
- Description
-
Get the boot entry GUID for the label given by the parameter $bootlabel$ from Windows boot manager by using bcdedit
-
Parameter:
$bootlabel$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$bootlabel$
Description:
Windows boot manager entry label found in 'bcdedit /v'
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only
-
References: [delFromWindowsBootmanager]
[bootNextToWinLabel]
[bootNextToUefiLabel]
[getUefiBcdbootGuid] -
Author: detlef oertel
-
Date: 18.01.2022
-
Example:
Message "get windows boot guid ...."
set $windows_bcd_guid$ = getWinBcdbootGuid("WINDOWS.vhdx")
Documentation of local function getUefiBcdbootGuid
- Definition
-
getUefiBcdbootGuid($bootlabel$ : string) : string
- Description
-
Get the boot entry GUID for the label given by the parameter $bootlabel$ from Windows boot manager by using bcdedit
-
Parameter:
$bootlabel$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$bootlabel$
Description:
UEFI boot manager entry label found in 'bcdedit /enum firmware'
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only
-
References: [delFromWindowsBootmanager]
[bootNextToWinLabel]
[bootNextToUefiLabel]
[getUefiBcdbootGuid] -
Author: detlef oertel
-
Date: 27.10.2023
-
Example:
if runningonUefi
set $peuefiguid$ = getUefiBcdbootGuid("opsitempwinpe")
set $exitcode$ = getlastexitcode
if $exitcode$ = "0"
if not ($peuefiguid$ = "")
shellCall("bcdedit /delete "+$peuefiguid$)
endif
endif
endif
Documentation of local function bootNextToWinLabel
- Definition
-
bootNextToWinLabel($bootlabel$ : string) : string
- Description
-
Sets the Windows bootmanager to boot next to the label given by the parameter $bootlabel$ from Windows boot manager by using bcdedit
-
Parameter:
$bootlabel$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$bootlabel$
Description:
Windows boot manager entry label found in 'bcdedit /v'
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only
-
References: [delFromWindowsBootmanager]
[getUefiBcdbootGuid]
[bootNextToUefiLabel] -
Author: detlef oertel
-
Date: 17.5.2018
-
Example:
See bootNextToUefiLabel
Documentation of local function bootNextToUefiLabel
- Definition
-
bootNextToUefiLabel($bootlabel$ : string) : string
- Description
-
Sets the uefi bootmanager to boot next to the label given by the parameter $bootlabel$ from uefi boot manager by using bcdedit
-
Parameter:
$bootlabel$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$bootlabel$
Description:
UEFI boot manager entry label found in 'bcdedit /enum firmware'
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only
-
References: [delFromWindowsBootmanager]
[getUefiBcdbootGuid]
[bootNextToUefiLabel] -
Author: detlef oertel
-
Date: 17.5.2018
-
Example:
Message "Enable PE boot...."
if runningonuefi
set $bootLabel$ = "opsitempwinpe"
if not(stringToBool(bootNextToUefiLabel($bootLabel$)))
logerror "Activating peboot is failed"
isFatalError "failed peboot"
endif
else
set $bootLabel$ = "ramdisk=[boot]\sources\boot.wim"
if not(stringToBool(bootNextToWinLabel($bootLabel$)))
logerror "Activating peboot is failed"
;isFatalError "failed peboot"
endif
endif
delUefiBootNextByLabel
- Definition
-
delUefiBootNextByLabel($bootlabel$ : string) : string
- Description
-
Remove the uefi bootmanager boot next entry if it has the label given by the parameter $bootlabel$ by using bcdedit
-
Parameter:
$bootlabel$
-
Type:
String
- Calltype:CallByValue
-
Description: UEFI boot manager entry label found in 'bcdedit /enum firmware'
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only
-
References: [delFromWindowsBootmanager]
[getUefiBcdbootGuid]
[bootNextToUefiLabel] -
Author: detlef oertel
-
Date: 28.1.2022
-
Example:
Message "Enable PE boot...."
if runningonuefi
set $bootLabel$ = "opsitempwinpe"
if not(stringToBool(delUefiBootNextByLabel($bootLabel$)))
logerror "Removing nextboot for winpe is failed"
isFatalError "failed peboot"
endif
endif
delUefiBootNext
- Definition
-
delUefiBootNext() : string
- Description
-
Remove the uefi bootmanager boot next entry by using bcdedit
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only
-
References: [delFromWindowsBootmanager]
[getUefiBcdbootGuid]
[bootNextToUefiLabel] -
Author: detlef oertel
-
Date: 28.1.2022
-
getUefiBootOrder
- Definition
-
getUefiBootOrder() : stringlist
- Description
-
get the displayorder from the uefi bootmanager by using bcdedit
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only
-
References: [delFromWindowsBootmanager]
[getUefiBcdbootGuid]
[bootNextToUefiLabel] -
Author: detlef oertel
-
Date: 26.1.2022
-
setUefiLabelToFirstBootOrder
- Definition
-
setUefiLabelToFirstBootOrder($bootlabel$ : string) : string
- Description
-
Sets the uefi bootmanager to add the label $bootlabel$ to the first place in the uefi boot order by using bcdedit
-
Parameter:
$bootlabel$
-
Type:
String
- Calltype:CallByValue
-
Description: UEFI boot manager entry label found in 'bcdedit /enum firmware'
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only
-
References: [delFromWindowsBootmanager]
[getUefiBcdbootGuid]
[bootNextToUefiLabel] -
Author: detlef oertel
-
Date: 28.1.2022
-
Example:
Message "Enable PE boot...."
if runningonuefi
set $bootLabel$ = "opsitempwinpe"
if not(stringToBool(setUefiLabelToFirstBootOrder($bootLabel$)))
logerror "Activating peboot is failed"
isFatalError "failed peboot"
endif
endif
Documentation of local function getDiskUuid
- Definition
-
getDiskUuid($disknumber$ : string , $tmpdir$ : string ) : string
- Description
-
Gets the disk uuid for the disk with the number $disknumber$ by using diskpart or powershell The temporary diskpart script is written to $tmpdir$
-
Parameter:
$disknumber$
-
Type:
String
- Calltype:CallByValue
-
Description: UEFI boot manager entry label found in 'bcdeit /enum firmware'
-
-
Parameter:
$tmpdir$
-
Type:
String
- Calltype:CallByValue
-
Description: Temporary directory to use
-
Advice: Directory must exist
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only
-
References: [enablePEPartition]
-
Author: detlef oertel
-
Date: 27.5.2022
-
Example:
for %disk% = "0" to calculate($diskcount1$+" -1") do set $aktdisklist$ = addtolist($aktdisklist$,getDiskUuid("%disk%", "x:")+"=%disk%")
set $disk$ = getvalue($diskuuid$,$aktdisklist$)
Documentation of local function enablePEPartition
- Definition
-
enablePEPartition($disknumber$ : string , $partitionNumber$ : string, $pepartletter$ : string, $useGpt$ : string) : string
- Description
-
Try to make the partition $partitionNumber$ on the disk $disknumber$ visible, bootable and give it the Windows disk letter $pepartletter$ by using diskpart or powershell
-
Parameter:
$disknumber$
-
Type:
String
- Calltype:CallByValue
-
Description: Number of the disk where we look for the partition
-
Advice: First disk = 0
-
-
Parameter:
$partitionnumber$
-
Type:
String
- Calltype:CallByValue
-
Description: Number of the partition on the given disk
-
Advice: First partition = 1
-
-
Parameter:
$pepartletter$
-
Type:
String
- Calltype:CallByValue
-
Description: Windows disk letter that the given partition should have
-
-
Parameter:
$usegpt$
-
Type:
String
- Calltype:CallByValue
-
Description: Should we expect GPT or MBR partitions ('true' or 'false')
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only, works in PE
-
References: [getDiskUuid]
-
Author: detlef oertel
-
Date: 17.5.2022
-
Example:
Message "Enable PE partition...."
if not(stringToBool(enablePEPartition($disknumber$, $swapPartitionNumber$, $pepartletter$, $useGpt$)))
LogError "Could not activate PE partition ..."
isFatalError "failed not activate PE partition"
endif
if not (isDriveReady($pePartLetter$))
logerror "PE drive "+$pePartLetter$+": not ready"
isFatalError "PE drive "+$pePartLetter$+": not ready"
set $errorList$ = addtolist($errorList$, " failed pe_drive_ready")
set $fatal_error$ = "true"
endif
hidePartition2
- Definition
-
hidePartition2($disknumber$ : string , $partitionNumber$ : string, $partLetter$ : string, $useGpt$ : string, $onlyNoAutomount$ : string) : string
- Description
-
Try to make the partition $partitionNumber$ on the disk $disknumber$ hidden by using diskpart or powershell
-
Parameter:
$disknumber$
-
Type:
String
- Calltype:CallByValue
-
Description: Number of the disk where we look for the partition
-
Advice: First disk = 0
-
-
Parameter:
$partitionnumber$
-
Type:
String
- Calltype:CallByValue
-
Description: Number of the partition on the given disk
-
Advice: First partition = 1
-
-
Parameter:
$partletter$
-
Type:
String
- Calltype:CallByValue
-
-
Parameter:
$usegpt$
-
Type:
String
- Calltype:CallByValue
-
Description: Should we expect GPT or MBR partitions ('true' or 'false')
-
-
Parameter:
$onlynoautomount$
-
Type:
String
- Calltype:CallByValue
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
SpecialCase: Winows only, works in PE
-
References: [enablePEPartition]
-
Author: detlef oertel
-
Date: 27.5.2022
-
Example:
Message "Hide PE partition...."
if not(stringToBool(hidePartition($disknumber$, $swapPartitionNumber$, $pepartletter$, $useGpt$)))
LogError "Could not hide PE partition ..."
isFatalError "failed hide PE partition"
endif
if isDriveReady($pePartLetter$)
logerror "PE drive "+$pePartLetter$+": is still ready"
isFatalError "PE drive "+$pePartLetter$+": is still ready"
set $errorList$ = addtolist($errorList$, " failed pe_drive_still_ready")
set $fatal_error$ = "true"
endif
hidePartition
- Definition
-
hidePartition($disknumber$ : string , $partitionNumber$ : string, $partLetter$ : string, $useGpt$ : string) : string
- Description
-
Calls hidepartition2 with Parameter:
$onlynoautomount$
=false
-
Parameter:
$disknumber$
-
Type:
String
- Calltype:CallByValue
-
-
Parameter:
$partitionnumber$
-
Type:
String
- Calltype:CallByValue
-
-
Parameter:
$partletter$
-
Type:
String
- Calltype:CallByValue
-
-
Parameter:
$usegpt$
-
Type:
String
- Calltype:CallByValue
-
-
noAutomountPartition
- Definition
-
noAutomountPartition($disknumber$ : string , $partitionNumber$ : string, $partLetter$ : string, $useGpt$ : string) : string
- Description
-
Calls hidepartition2 with Parameter:
$onlynoautomount$
=true
-
Parameter:
$disknumber$
-
Type:
String
- Calltype:CallByValue
-
-
Parameter:
$partitionnumber$
-
Type:
String
- Calltype:CallByValue
-
-
Parameter:
$partletter$
-
Type:
String
- Calltype:CallByValue
-
-
Parameter:
$usegpt$
-
Type:
String
- Calltype:CallByValue
-
-
Documentation of opsi library: uib_exitcode.opsiscript
-
Email: d.oertel@uib.de
-
Version: 1.0.2
-
Copyright: AGPLv3
Documentation of local function isMsiExitcodeFatal
- Definition
-
isMsiExitcodeFatal($exitcode$ : string, $allowRebootRequest$ : string, ref $ErrorString$ : string) : string
- Description
-
Evaluates the given $exitcode$ as MSI Error and and gives back a resulting error message on $ErrorString$ If the Error require a reboot the given parameter $allowRebootRequest$ is used to decide if a 'ExitWindows /Reboot' is called or not
-
Parameter:
$exitcode$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$exitcode$
Description:
Exit code given by msiexec
-
-
Parameter:
$allowrebootrequest$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$allowrebootrequest$
Description:
Should we call 'ExitWindows /Reboot' if the exit code require this ('true' or 'false')
-
-
Parameter:
$errorstring$
-
Type:
String
- Calltype:CallByReference
-
Parameter
$errorstring$
Description:
Here we get the error string that belongs to the given exit code
-
-
Returns: Returns string "true" if the exit code points to a critical error. Returns string "true" if the exit code is not a number (not valid). Returns string "false" if the exit code is valid but not critical.
-
OnError: Returns string "true"
-
SpecialCase: Winows only
-
References: [isMsExitcodeFatal_short]
[isAdvancedMsiExitcodeFatal]
[isInnoExitcodeFatal]
[isInstallshieldExitcodeFatal]
[isNsisExitcodeFatal] -
Links: http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa368542.aspx -
Author: detlef oertel
-
Date: 19.9.2018
-
Example:
[actions]
DefVar $ExitCode$
DefVar $ErrorString$
(...)
set $ExitCode$ = getlastexitcode
if stringtobool(isMsiExitcodeFatal($exitcode$, "true", $ErrorString$ ))
LogError $ErrorString$
isfatalerror $ErrorString$
else
Comment $ErrorString$
endif
Documentation of local function isMsiExitcodeFatal_short
- Definition
-
isMsiExitcodeFatal_short($exitcode$ : string, $allowRebootRequest$ : string, ref $ErrorString$ : string) : string
- Description
-
Evaluates the given $exitcode$ as MS Error and and gives back a resulting error message on $ErrorString$ if the exit code is well known. For full list of exit dodes use isMsiExitcodeFatal If the Error require a reboot the given parameter $allowRebootRequest$ is used to decide if a 'ExitWindows /Reboot' is called or not
-
Parameter:
$exitcode$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$exitcode$
Description:
Exit code given by ms
-
-
Parameter:
$allowrebootrequest$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$allowrebootrequest$
Description:
Should we call 'ExitWindows /Reboot' if the exit code require this ('true' or 'false')
-
-
Parameter:
$errorstring$
-
Type:
String
- Calltype:CallByReference
-
Parameter
$errorstring$
Description:
Here we get the error string that belongs to the given exit code
-
-
Returns: Returns string "true" if the exit code points to a critical error. Returns string "true" if the exit code is not a number (not valid). Returns string "false" if the exit code is valid but not critical.
-
OnError: Returns string "true"
-
SpecialCase: Winows only
-
References: [isMsiExitcodeFatal]
[isAdvancedMsiExitcodeFatal]
[isInnoExitcodeFatal]
[isInstallshieldExitcodeFatal]
[isNsisExitcodeFatal] -
Links: http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa368542.aspx -
Author: detlef oertel
-
Date: 19.9.2018
-
Documentation of local function isMsExitcodeFatal_short
- Definition
-
isMsExitcodeFatal_short($exitcode$ : string, $allowRebootRequest$ : string, ref $ErrorString$ : string) : string
- Description
-
Is a wrapper for
isMsiExitcodeFatal_short
which is internally called
Documentation of local function isAdvancedMsiExitcodeFatal
- Definition
-
isAdvancedMsiExitcodeFatal($exitcode$ : string, $allowRebootRequest$ : string, ref $ErrorString$ : string) : string
- Description
-
Please note: Import complete file uib_exitcode (not only isAdvancedMsiExitcodeFatal) Evaluates the given $exitcode$ as AdvancedMsi Error and and gives back a resulting error message on $ErrorString$ It is also checked if the exit code is one from the embedded msi. There for is isMsiExitcodeFatal used If the Error require a reboot the given parameter $allowRebootRequest$ is used to decide if a 'ExitWindows /Reboot' is called or not
-
Parameter:
$exitcode$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$exitcode$
Description:
Exit code given by AdvancedMsi
-
-
Parameter:
$allowrebootrequest$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$allowrebootrequest$
Description:
Should we call 'ExitWindows /Reboot' if the exit code require this ('true' or 'false')
-
-
Parameter:
$errorstring$
-
Type:
String
- Calltype:CallByReference
-
Parameter
$errorstring$
Description:
Here we get the error string that belongs to the given exit code
-
-
Returns: Returns string "true" if the exit code points to a critical error. Returns string "true" if the exit code is not a number (not valid). Returns string "false" if the exit code is valid but not critical.
-
OnError: Returns string "true"
-
SpecialCase: Winows only
-
References: [isMsiExitcodeFatal]
[isAdvancedMsiExitcodeFatal]
[isInnoExitcodeFatal]
[isInstallshieldExitcodeFatal]
[isNsisExitcodeFatal] -
Author: detlef oertel
-
Date: 14.05.2019
-
Documentation of local function isInnoExitcodeFatal
- Definition
-
isInnoExitcodeFatal($exitcode$ : string, $allowRebootRequest$ : string, ref $ErrorString$ : string) : string
- Description
-
Evaluates the given $exitcode$ as Inno Error and and gives back a resulting error message on $ErrorString$ If the Error require a reboot the given parameter $allowRebootRequest$ is used to decide if a 'ExitWindows /Reboot' is called or not
-
Parameter:
$exitcode$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$exitcode$
Description:
Exit code given by Inno
-
-
Parameter:
$allowrebootrequest$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$allowrebootrequest$
Description:
Should we call 'ExitWindows /Reboot' if the exit code require this ('true' or 'false')
-
-
Parameter:
$errorstring$
-
Type:
String
- Calltype:CallByReference
-
Parameter
$errorstring$
Description:
Here we get the error string that belongs to the given exit code
-
-
Returns: Returns string "true" if the exit code points to a critical error. Returns string "true" if the exit code is not a number (not valid). Returns string "false" if the exit code is valid but not critical.
-
OnError: Returns string "true"
-
SpecialCase: Winows only
-
References: [isMsiExitcodeFatal]
[isAdvancedMsiExitcodeFatal]
[isInnoExitcodeFatal]
[isInstallshieldExitcodeFatal]
[isNsisExitcodeFatal] -
Author: detlef oertel
-
Date: 17.5.2018
-
Documentation of local function isInstallshieldExitcodeFatal
- Definition
-
isInstallshieldExitcodeFatal($exitcode$ : string, $allowRebootRequest$ : string, ref $ErrorString$ : string) : string
- Description
-
Please note: Import complete file uib_exitcode (not only isAdvancedMsiExitcodeFatal) Evaluates the given $exitcode$ as Installshield Error and and gives back a resulting error message on $ErrorString$ It is also checked if the exit code is one from the embedded msi. There for is isMsiExitcodeFatal used If the Error require a reboot the given parameter $allowRebootRequest$ is used to decide if a 'ExitWindows /Reboot' is called or not
-
Parameter:
$exitcode$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$exitcode$
Description:
Exit code given by Installshield
-
-
Parameter:
$allowrebootrequest$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$allowrebootrequest$
Description:
Should we call 'ExitWindows /Reboot' if the exit code require this ('true' or 'false')
-
-
Parameter:
$errorstring$
-
Type:
String
- Calltype:CallByReference
-
Parameter
$errorstring$
Description:
Here we get the error string that belongs to the given exit code
-
-
Returns: Returns string "true" if the exit code points to a critical error. Returns string "true" if the exit code is not a number (not valid). Returns string "false" if the exit code is valid but not critical.
-
OnError: Returns string "true"
-
SpecialCase: Winows only
-
References: [isMsiExitcodeFatal]
[isAdvancedMsiExitcodeFatal]
[isInnoExitcodeFatal]
[isInstallshieldExitcodeFatal]
[isNsisExitcodeFatal] -
Author: detlef oertel
-
Date: 14.05.2019
-
Documentation of local function isNsisExitcodeFatal
- Definition
-
isNsisExitcodeFatal($exitcode$ : string, $allowRebootRequest$ : string, ref $ErrorString$ : string) : string
- Description
-
Evaluates the given $exitcode$ as Nsis Error and and gives back a resulting error message on $ErrorString$ If the Error require a reboot the given parameter $allowRebootRequest$ is used to decide if a 'ExitWindows /Reboot' is called or not
-
Parameter:
$exitcode$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$exitcode$
Description:
Exit code given by Nsis
-
-
Parameter:
$allowrebootrequest$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$allowrebootrequest$
Description:
Should we call 'ExitWindows /Reboot' if the exit code require this ('true' or 'false')
-
-
Parameter:
$errorstring$
-
Type:
String
- Calltype:CallByReference
-
Parameter
$errorstring$
Description:
Here we get the error string that belongs to the given exit code
-
-
Returns: Returns string "true" if the exit code points to a critical error. Returns string "true" if the exit code is not a number (not valid). Returns string "false" if the exit code is valid but not critical.
-
OnError: Returns string "true"
-
SpecialCase: Winows only
-
References: [isMsiExitcodeFatal]
[isAdvancedMsiExitcodeFatal]
[isInnoExitcodeFatal]
[isInstallshieldExitcodeFatal]
[isNsisExitcodeFatal] -
Author: detlef oertel
-
Date: 17.5.2018
-
Documentation of local function isGenericExitcodeFatal
- Definition
-
isGenericExitcodeFatal($exitcode$ : string, $allowRebootRequest$ : string, ref $ErrorString$ : string) : string
- Description
-
Evaluates the given $exitcode$ as Generic Error and and gives back a resulting error message on $ErrorString$ If the Error require a reboot the given parameter $allowRebootRequest$ is used to decide if a 'ExitWindows /Reboot' is called or not
-
Parameter:
$exitcode$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$exitcode$
Description:
Exit code given
-
-
Parameter:
$allowrebootrequest$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$allowrebootrequest$
Description:
Should we call 'ExitWindows /Reboot' if the exit code require this ('true' or 'false')
-
-
Parameter:
$errorstring$
-
Type:
String
- Calltype:CallByReference
-
Parameter
$errorstring$
Description:
Here we get the error string that belongs to the given exit code
-
-
Returns: Returns string "true" if the exit code points to a critical error. Returns string "true" if the exit code is not a number (not valid). Returns string "false" if the exit code is valid but not critical.
-
OnError: Returns string "true"
-
References: [isMsiExitcodeFatal]
[isAdvancedMsiExitcodeFatal]
[isInnoExitcodeFatal]
[isInstallshieldExitcodeFatal]
[isNsisExitcodeFatal] -
Author: detlef oertel
-
Date: 16.2.2021
-
Documentation of local function boolToGenericExitcode
- Definition
-
boolToGenericExitcode($BoolString$ : string) : string
- Description
-
Converts the given $BoolString$ as Generic Exitcode: "True": returns "0" "False": returns "1" is used to decide if a 'ExitWindows /Reboot' is called or not
-
Parameter:
$boolstring$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$boolstring$
Description:
boolean string given -
Parameter
$boolstring$
Advice:
if not "true" default result is "1"
-
-
Returns: Returns string "0" or "1"
-
OnError: Returns string "1"
-
Author: detlef oertel
-
Date: 08.3.2021
-
Documentation of opsi library: uib_strlistutils.opsiscript
-
Email: d.oertel@uib.de
-
Version: 1.0
-
Copyright: AGPLv3
Documentation of local function compareLists
- Definition
-
compareLists($list1$ : stringlist, $list2$ : stringlist) : string
- Description
-
Checks if two string lists are completely identical or not. The check is not case sensitive.
-
Parameter:
$list1$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$list1$
Description:
First stringlist to compare
-
-
Parameter:
$list2$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$list2$
Description:
Second stringlist (to compare with first)
-
-
Returns: Returns string "true" if the given lists are identical. Returns string "false" if the given lists are not identical
-
OnError: Returns string "false"
-
Author: detlef oertel
-
Date: 17.5.2018
-
Email: d.oertel@uib.de
-
Version: 1.0
-
Copyright: AGPLv3
-
Example:
set $tmplist$ = getListContainingList($baseproducts$,$resultlist$)
if stringToBool(compareLists($tmplist$,$baseproducts$))
comment "check installed products successful finished"
else
LogError "check installed products failed"
set $errorList$ = addtolist($errorList$, "check installed products failed")
;set $fatal_error$ = "true"
endif
Documentation of opsi library: uib_driver_install.opsiscript
-
Email: d.oertel@uib.de
-
Version: 1.0
-
Copyright: AGPLv3
replaceDriverPathChars
- Definition
-
replaceDriverPathChars($path$ : string) : string
- Description
-
Replaces in a given path to a driver the not allowed chars for netboot driver repository
-
Parameter:
$path$
-
Type:
String
- Calltype:CallByValue
-
Description: path to a driver
-
-
Returns: Returns string with given $path$ with replaced chars
-
OnError: Returns string $path$
-
Author: detlef oertel
-
Date: 10.05.2023
-
Example:
set $computerVendor$ = replaceDriverPathChars($computerVendor$)
set $computerModel$ = replaceDriverPathChars($computerModel$)
set $testpath$ = "%scriptdrive%\..\"+$myNetbootPtoduct$+"\drivers\drivers\additional\byAudit\"+$computerVendor$+"\"+$computerModel$
isPnputilSyntaxLegacy
- Definition
-
isPnputilSyntaxLegacy() : string
- Description
-
checks if pnputil.exe on this system uses legacy syntax only
-
Returns: Returns string 'true' / 'false'
-
OnError: Returns string 'true'
-
Links: https://learn.microsoft.com/de-de/windows-hardware/drivers/devtest/pnputil-command-syntax
-
Author: detlef oertel
-
Date: 10.05.2023
-
Example:
set $legacy_pnp_syntax$ = isPnputilSyntaxLegacy()
if $legacy_pnp_syntax$ = "false"
set $exitcode$ = processCall('"%System%\pnputil.exe" /add-driver "'+$inffile$+'" /install' ) /TimeOutSeconds 20 /SysNative
else
set $exitcode$ = processCall('"%System%\pnputil.exe" -i -a "'+$inffile$+'"' ) /TimeOutSeconds 20 /SysNative
endif
install_driver_certificates_recursive_from_dir
- Definition
-
install_driver_certificates_recursive_from_dir($driverbasedir$ : string, ref $errorstrings$ : stringlist) : string
- Description
-
collect recursiv all certificates (*.cer) and import the to certificare store as TrustedPublisher
-
Parameter:
$driverbasedir$
-
Type:
String
- Calltype:CallByValue
-
Description: path to a driver repository
-
-
Parameter:
$errorstrings$
-
Type:
Stringlist
- Calltype:CallByReference
-
Description: list of error messages
-
-
Returns: Returns string 'true' / 'false'
-
OnError: Returns string 'false' ; Error messages in $errorstrings$
-
Author: detlef oertel
-
Date: 10.05.2023
-
Example:
set $boolresult$ = install_driver_certificates_recursive_from_dir($driverdir$, $errorstrings$)
if boolresult = "false"
for %errmsg% in $errorstrings$ do logerror '%errmsg%'
endif
Documentation of local function install_driver_recursive_from_dir
- Definition
-
install_driver_recursive_from_dir($driverdir$ : string, ref $errorstrings$ : stringlist) : string
- Description
-
collect recursiv all certificates (.cer) and import the to certificare store as TrustedPublisher (call install_driver_certificates_recursive_from_dir) collect recursiv all drivers (.inf) and try to install via pnputil if failed retry with dpinst
-
Parameter:
$driverdir$
-
Type:
String
- Calltype:CallByValue
-
Description: path to a driver repository
-
-
Parameter:
$errorstrings$
-
Type:
Stringlist
- Calltype:CallByReference
-
Description: list of error messages
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"
-
Author: detlef oertel
-
Date: 10.05.2023
-
Example:
set $boolresult$ = install_driver_recursive_from_dir($driverdir$, $errorstrings$)
if boolresult = "false"
for %errmsg% in $errorstrings$ do logerror '%errmsg%'
endif
Documentation of local function setFirewallExceptionsTcpUdp4product4profile
- Definition
-
setFirewallExceptionsTcpUdp4product4profile($rulename$ : string, $fwprofile$ : string, $path2product$ : string) : void
- Description
-
Adds a new firewall rule: $rulename$ for the program: $path2product$ Allows for this program incoming connections via TCP and UDP
-
Parameter:
$rulename$
-
Type:
String
- Calltype:CallByValue
-
Description: Name of the rule to create
-
-
Parameter:
$fwprofile$
-
Type:
String
- Calltype:CallByValue
-
Description: Name of the firewall profile to create rule in
-
-
Parameter:
$path2product$
-
Type:
String
- Calltype:CallByValue
-
Description: Path to the program that is subject of the rule
-
-
Returns: Returns nothing
-
OnError: Returns nothing
-
Author: detlef oertel
-
Date: 10.05.2023
-
install_driver_via_pnputil
- Definition
-
install_driver_via_pnputil($soucedriverPath$ : string, ref $outstring$ : string) : string
- Description
-
try to install the driver given by $soucedriverPath$ via pnputil $outstring$ returns messages of success or errors
-
Parameter:
$soucedriverpath$
-
Type:
String
- Calltype:CallByValue
-
Description: path to a driver (*.inf)
-
-
Parameter:
$outstring$
-
Type:
String
- Calltype:CallByReference
-
Description: list of messages
-
-
Returns: Returns string 'true' / 'false'
-
OnError: Returns string 'false'
-
Author: detlef oertel
-
Date: 10.05.2023
-
Example:
comment "install driver: %infpath%"
set $boolresult$ = install_driver_via_pnputil('%infpath%', $messagestr$)
if $boolresult$ = "false"
set $errorstrings$ = addToList($errorstrings$, $messagestr$)
else
set $messagestrings$ = addToList($messagestrings$, $messagestr$)
endif
Documentation of opsi library: uib_reboot_lib.opsiscript
Documentation of local function prepare_uefi_boot_to
- Definition
-
prepare_uefi_boot_to($prefer_boot_option$ : string) : void
- Description
-
if this is an uefi OS, then prepare the uefi nextboot to the stored uefi bootlabel that belongs to the boot target $prefer_boot_option$
-
Parameter:
$prefer_boot_option$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$prefer_boot_option$
Description:
'network' or "local-stored-bootimage" defaults to 'network' if empty
-
-
Returns: Returns string "void"
-
OnError: nothing
-
Author: detlef oertel
-
Date: 27.10.2023
-
Example:
[actions]
prepare_uefi_boot_to('network')
ExitWindows /Reboot
Documentation of opsi library: uib_state_and_condition.opsiscript
-
Email: d.oertel@uib.de
-
Version: 1.0
-
Copyright: AGPLv3
Documentation of local function isRebootPending
- Definition
-
isRebootPending() : string
- Description
-
Checks if a Windows or Linux client needs a reboot
-
Returns: Returns string "true" if reboot is required
-
OnError: Returns string "false"
-
Links: https://ilovepowershell.com/2015/09/10/how-to-check-if-a-server-needs-a-reboot/
https://www.windowspro.de/script/ausstehende-reboots-nach-updates-pruefen-powershell-regexe
https://serverfault.com/questions/122178/how-can-i-check-from-the-command-line-if-a-reboot-is-required-on-rhel-or-centos
https://askubuntu.com/questions/164/how-can-i-tell-from-the-command-line-whether-the-machine-requires-a-reboot
https://megamorf.gitlab.io/2019/06/10/check-if-reboot-is-required-after-installing-linux-updates.html -
Author: detlef oertel
-
Date: 21.05.2020
-
Example:
[actions]
if stringToBool(isRebootPending())
comment "we need a reboot"
else
comment "we do not need a reboot"
endif
Documentation of local function get_dotnet4_version
- Definition
-
get_dotnet4_version() : string
- Description
-
Checks which dotnet 4.x is installed
-
Returns: Returns string with the version number (aka "4.6") or empty string if no dotnet 4 is installed
-
OnError: Returns string ""
-
Author: detlef oertel
-
Date: 27.08.2019
-
Example:
[actions]
if ("" = get_dotnet4_version()) or CompareDotSeparatedNumbers(get_dotnet4_version(), "<","4.6")
comment "No dotnet 4 >= 4.6 installed"
else
comment "dotnet 4 >= 4.6 installed"
endif
Documentation of local function isdotnet_3_5_installed
- Definition
-
isdotnet_3_5_installed() : string
- Description
-
Checks if a dotnet 3.5 is installed
-
Returns: Returns string "true" dotnet 3.5 is installed
-
OnError: Returns string "false"
-
Author: detlef oertel
-
Date: 27.08.2019
-
Example:
[actions]
if stringToBool(isdotnet_3_5_installed())
comment "dotnet 3.5 is installed"
else
comment "No dotnet 3.5 found"
endif
Documentation of local function getOpsiNetworkMedium
- Definition
-
getOpsiNetworkMedium() : string
- Description
-
Try to detect the network medium (cable / wifi) which is used for the connection to the opsi server
-
Returns: Returns string "cable" if cable connection is detected
-
Returns string "wifi" if wifi connection is detected
-
Returns string "unknown" in any other case
-
OnError: Returns string "unknown"
-
SpecialCase: Works only in opsi service mode (not in interactive or batch mode)
-
Author: detlef oertel
-
Date: 27.08.2019
-
Example:
[actions]
comment "opsi-server: %opsiserver% is connected by: " + getOpsiNetworkMedium()
Documentation of local function isVhdMode
- Definition
-
isVhdMode() : string
- Description
-
check if this installation is a 'vhd-reset' installation
-
Returns: Returns string "true" if vhd is detected
-
OnError: Returns string "false"
-
Author: detlef oertel
-
Date: 22.08.2019
-
Example:
[actions]
if stringtobool(isVhdMode())
comment "vhd mode detected"
endif
Documentation of local function isOliMode
- Definition
-
isOliMode() : string
- Description
-
check if this installation is a 'opsi local image' (oli) installation
-
Returns: Returns string "true" if oli is detected
-
OnError: Returns string "false"
-
Author: detlef oertel
-
Date: 22.08.2019
-
Example:
[actions]
if stringtobool(isOliMode())
comment "oli mode detected"
endif
opsi Library uib_lin_install.opsiscript
Local Function cleanupPackageSystem
- Definition
-
cleanupPackageSystem() : void
- Description
-
reads repo list und try to repair well known problems should be called after modifying the repo list or after failed installs
-
Returns: nothing
-
OnError: error counter increased ; Error messages in the log
-
Author: Detlef Oertel
-
Date: 19.08.2020
-
Example:
[Actions]
importlib "uib_lin_install"
DefStringlist $packages$
DefVar $installresult$
DefStringlist $errorList$
DefVar $fatal_error$
DefVar $result_string$
comment "update and clean package system"
cleanupPackageSystem()
comment "install pending updates"
set $result_string$ = installupdates()
comment "install new needed packages"
set $packages$ = CreateStringlist("lsb-release","cifs-utils","xterm", "dnsutils","lsof","openssl","pkg-config","desktop-file-utils","libnotify-bin","libgtk2.0-0")
comment "if we are on debian / ubuntu we can use debinstall()"
set $installresult$ = debinstall($packages$)
if not(stringtobool($installresult$))
if waitForPackageLock("300", "false")
comment "we got the package lock."
else
LogError "could not get Package Lock"
endif
cleanupPackageSystem()
set $installresult$ = debinstall($packages$)
if not(stringtobool($installresult$))
LogError "failed dependent packages"
Message "failed dependent packages"
;isFatalError "failed dependent packages"
set $fatal_error$ = "true"
setloglevel = 6
set $errorList$ = addtolist($errorList$, " failed dependent_packages")
endif
endif
Local Function installupdates
- Definition
-
installupdates() : string
- Description
-
try to install pending updates from the known repsitories should be called after modifying the repo list or after failed installs
-
Returns: nothing
-
OnError: Returns string "false"; error counter increased ; Error messages in the log
-
Author: Detlef Oertel
-
Date: 19.08.2020
-
Example:
see: cleanupPackageSystem()
Local Function runCommandWithList
- Definition
-
runCommandWithList($command$ : string, $list$ : stringlist) : string
- Description
-
-
Parameter:
$command$
-
Type:
String
- Calltype:CallByValue
-
-
Parameter:
$list$
-
Type:
Stringlist
- Calltype:CallByValue
-
-
Local Function debinstall
- Definition
-
debinstall($packagelist$ : stringlist) : string
- Description
-
try to install the packages given by $packagelist$
-
Parameter:
$packagelist$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$packagelist$
Description:
stringlist with packages to install
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"; error counter increased ; Error messages in the log
-
References: Local Function cleanupPackageSystem,
Local Function installupdates,
Local Function redinstall,
Local Function suseinstall,
Local Function ucsinstall -
Author: Detlef Oertel
-
Date: 09.02.2022
-
Example:
see: cleanupPackageSystem()
Local Function redinstall
- Definition
-
redinstall($packagelist$ : stringlist) : string
- Description
-
try to install the packages given by $packagelist$
-
Parameter:
$packagelist$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$packagelist$
Description:
stringlist with packages to install
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"; error counter increased ; Error messages in the log
-
References: Local Function cleanupPackageSystem,
Local Function installupdates,
Local Function debinstall,
Local Function suseinstall,
Local Function ucsinstall -
Author: Detlef Oertel
-
Date: 19.08.2020
-
Example:
see: cleanupPackageSystem()
Local Function suseinstall
- Definition
-
suseinstall($packagelist$ : stringlist) : string
- Description
-
try to install the packages given by $packagelist$
-
Parameter:
$packagelist$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$packagelist$
Description:
stringlist with packages to install
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"; error counter increased ; Error messages in the log
-
References: Local Function cleanupPackageSystem,
Local Function installupdates,
Local Function debinstall,
Local Function redinstall,
Local Function ucsinstall -
Author: Detlef Oertel
-
Date: 19.08.2020
-
Example:
see: cleanupPackageSystem()
Local Function ucsinstall
- Definition
-
ucsinstall($packagelist$ : stringlist) : string
- Description
-
try to install the packages given by $packagelist$
-
Parameter:
$packagelist$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$packagelist$
Description:
stringlist with packages to install
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"; error counter increased ; Error messages in the log
-
References: Local Function cleanupPackageSystem,
Local Function installupdates,+ Local Function debinstall,
Local Function redinstall,
Local Function suseinstall -
Author: Detlef Oertel
-
Date: 19.08.2020
-
Example:
see: cleanupPackageSystem()
Local Function genericLinInstall
- Definition
-
genericLinInstall($packagelist$ : stringlist) : string
- Description
-
try to determine the Linux familily and try to install the packages given by $packagelist$
-
Parameter:
$packagelist$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$packagelist$
Description:
stringlist with packages to install
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"; error counter increased ; Error messages in the log
-
References: Local Function cleanupPackageSystem,
Local Function installupdates,
Local Function debinstall,
Local Function redinstall,
Local Function suseinstall -
Author: Detlef Oertel
-
Date: 08.03.2021
-
Example:
see: cleanupPackageSystem()
Local Function linuxInstallOneOf
- Definition
-
linuxInstallOneOf($packagelist$ : stringlist) : string
- Description
-
try to install any package given by $packagelist$ This can be used specifying a package with different names for different linux distributions.
-
Parameter:
$packagelist$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$packagelist$
Description:
stringlist with packages to install
-
-
Returns: Returns string 'True' if one package was successfully installed
-
OnError: Returns string 'False'
-
References: Local Function isOneInstalled,
Local Function getLinuxCommand -
Author: Nils Doerrer
-
Date: 16.11.2020
-
Example:
[Actions]
importlib "uib_lin_install"
if isOneInstalled(createStringList("lsusb", "usbutils")) = "False"
message "installing lsusb or usbutils"
set $success$ = linuxInstallOneOf(createStringList("lsusb", "usbutils"))
endif
Local Function isOneInstalled
- Definition
-
isOneInstalled($packagelist$ : stringlist) : string
- Description
-
check for installation status and return if any of $packagelist$ exists This can be used to check a package with different names for different linux distributions.
-
Parameter:
$packagelist$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$packagelist$
Description:
stringlist with packages to check
-
-
Returns: Returns string 'True' if one specified package is installed
-
OnError: Returns string 'False'
-
References: Local Function linuxInstallOneOf,
Local Function getLinuxCommand -
Author: Nils Doerrer
-
Date: 16.11.2020
-
Local Function getLinuxCommand
- Definition
-
getLinuxCommand($type$ : string) : string
- Description
-
Determine package manager and return command.
-
Parameter:
$type$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$type$
Description:
type of desired command 'install','check', 'localpackage'
-
-
Returns: Package manager command according to type
-
OnError: Returns string 'False'
-
References: Local Function linuxInstallOneOf,
Local Function isOneInstalled -
Author: Nils Doerrer, Detlef Oertel
-
Date: 14.01.2021
-
Local Function getLinuxCommandAgnostic
- Definition
-
getLinuxCommandAgnostic($type$ : string) : string
- Description
-
Determine package manager and return command.
-
Parameter:
$type$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$type$
Description:
type of desired command 'install' or 'check'
-
-
Returns: Package manager command according to type
-
OnError: Returns string 'False'
-
References: Local Function linuxInstallOneOf,
Local Function isOneInstalled,
Local Function getLinuxCommand -
Author: Nils Doerrer
-
Date: 16.11.2020
-
Local Function linuxInstallOneFile
- Definition
-
linuxInstallOneFile($packagefile$ : string) : string
- Description
-
try to install the local file package given by $packagefile$ This can be used specifying a package with different names for different linux distributions.
-
Parameter:
$packagefile$
-
Type:
String
- Calltype:CallByValue
-
-
Returns: Returns string '0' if one package was successfully installed
-
OnError: Returns string '-1'
-
References: Local Function isOneInstalled,
Local Function getLinuxCommand -
Author: Detlef Oertel
-
Date: 08.02.2021
-
Example:
[Actions]
importlib "uib_lin_install"
if if "0" = linuxInstallOneFile("/tmp/dummy.deb")
comment "success"
endif
Local Function linuxRemoveOnePackage
- Definition
-
linuxRemoveOnePackage($packagename$ : string) : string
- Description
-
try to remove the package given by $packagename$ This can be used specifying a package with different names for different linux distributions.
-
Parameter:
$packagename$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$packagename$
Description:
string with the name of a package to remove
-
-
Returns: Returns string '0' if package was successfully removed or was not installed
-
OnError: Returns string '-1'
-
References: Local Function isOneInstalled,
Local Function getLinuxCommand -
Author: Detlef Oertel
-
Date: 08.02.2021
-
Example:
[Actions]
importlib "uib_lin_install"
if "0" = linuxRemoveOnePackage("dummy")
comment "success"
endif
Local Function linuxRemoveOneOf
- Definition
-
linuxRemoveOneOf($packagelist$ : stringlist) : string
- Description
-
try to remove any package given by $packagelist$ This can be used specifying a package with different names for different linux distributions.
-
Parameter:
$packagelist$
-
Type:
Stringlist
- Calltype:CallByValue
-
Parameter
$packagelist$
Description:
stringlist with packages to install
-
-
Returns: Returns string 'True' if one package was successfully installed
-
OnError: Returns string 'False'
-
References: Local Function isOneInstalled,
Local Function getLinuxCommand -
Author: Nils Doerrer, Detlef Oertel
-
Date: 16.11.2020
-
Example:
[Actions]
importlib "uib_lin_install"
if isOneInstalled(createStringList("lsusb", "usbutils")) = "True"
message "installing lsusb or usbutils"
set $success$ = linuxRemoveOneOf(createStringList("lsusb", "usbutils"))
endif
opsi Library uib_macosinstalllib.opsiscript
Local Function install_macos_app
- Definition
-
install_macos_app($myapp$ : string) : string
- Description
-
try to install the app given by $myapp$
-
Parameter:
$myapp$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$myapp$
Description:
string with path to app to install
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"; error counter increased ; Error messages in the log
-
References: Local Function install_macos_pkg,
Local Function install_macos_dmg,
Local Function install_macos_zip,
Local Function install_macos_generic -
Author: Detlef Oertel
-
Date: 28.12.2020
-
Example:
[Actions]
importlib "uib_macosinstalllib"
DefVar $installfile$
DefVar $installresult$
comment "we have a *.app (directory) and install with install_macos_app"
set $installfile$ = "%scriptpath%/files/my_macos_app.app"
set $installresult$ = install_macos_app($installfile$)
if stringtobool($installresult$)
comment "installation succseeded"
else
LogError "installation failed"
endif
Local Function install_macos_pkg
- Definition
-
install_macos_pkg($mypkg$ : string) : string
- Description
-
try to install the pkg file given by $mypkg$
-
Parameter:
$mypkg$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$mypkg$
Description:
string with path to pkg file to install
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"; error counter increased ; Error messages in the log
-
References: Local Function install_macos_app,
Local Function install_macos_dmg,
Local Function install_macos_zip,
Local Function install_macos_generic -
Author: Detlef Oertel
-
Date: 28.12.2020
-
Example:
[Actions]
importlib "uib_macosinstalllib"
DefVar $installfile$
DefVar $installresult$
comment "we have a *.pkg and install with install_macos_pkg"
set $installfile$ = "%scriptpath%/files/my_macos_app.pkg"
set $installresult$ = install_macos_pkg($installfile$)
if stringtobool($installresult$)
comment "installation succseeded"
else
LogError "installation failed"
endif
Local Function install_macos_dmg
- Definition
-
install_macos_dmg($mydmg$ : string) : string
- Description
-
try to install the dmg file given by $mydmg$
-
Parameter:
$mydmg$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$mydmg$
Description:
string with path to dmg file to install
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"; error counter increased ; Error messages in the log
-
References: Local Function install_macos_app,
Local Function install_macos_pkg,
Local Function install_macos_zip,
Local Function install_macos_generic -
Author: Detlef Oertel
-
Date: 28.12.2020
-
Example:
[Actions]
importlib "uib_macosinstalllib"
DefVar $installfile$
DefVar $installresult$
comment "we have a *.dmg and install with install_macos_dmg"
set $installfile$ = "%scriptpath%/files/my_macos_app.dmg"
set $installresult$ = install_macos_dmg($installfile$)
if stringtobool($installresult$)
comment "installation succseeded"
else
LogError "installation failed"
endif
Local Function install_macos_zip
- Definition
-
install_macos_zip($myzip$ : string) : string
- Description
-
try to install the zip file given by $myzip$ unzips the file and try to find a installable part (*.app, *.pkg, *.dmg) and try to install this
-
Parameter:
$myzip$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$myzip$
Description:
string with path to zip file to install
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"; error counter increased ; Error messages in the log
-
References: Local Function install_macos_app,
Local Function install_macos_dmg,
Local Function install_macos_pkg,
Local Function install_macos_generic -
Author: Detlef Oertel
-
Date: 28.12.2020
-
Example:
[Actions]
importlib "uib_macosinstalllib"
DefVar $installfile$
DefVar $installresult$
comment "we have a *.zip and install with install_macos_zip"
set $installfile$ = "%scriptpath%/files/my_macos_app.zip"
set $installresult$ = install_macos_zip($installfile$)
if stringtobool($installresult$)
comment "installation succseeded"
else
LogError "installation failed"
endif
Local Function install_macos_generic
- Definition
-
install_macos_generic($myfile$ : string) : string
- Description
-
try to install the file given by $myfile$ Checks if the file is a well known installable (*.app, *.pkg, *.dmg, *.zip) and try to install this
-
Parameter:
$myfile$
-
Type:
String
- Calltype:CallByValue
-
Parameter
$myfile$
Description:
string with path to pkg file to install
-
-
Returns: Returns string "true" if all is ok
-
OnError: Returns string "false"; error counter increased ; Error messages in the log
-
References: Local Function install_macos_app,
Local Function install_macos_dmg,
Local Function install_macos_zip,
Local Function install_macos_pkg -
Author: Detlef Oertel
-
Date: 28.12.2020
-
Example:
see: install_macos_generic
[Actions]
importlib "uib_macosinstalllib"
DefVar $installfile$
DefVar $installresult$
comment "we have a *.* and install with install_macos_generic"
set $installfile$ = "%scriptpath%/files/opsi-script.app"
set $installresult$ = install_macos_generic($installfile$)
if stringtobool($installresult$)
comment "installation succseeded"
else
Error "installation failed"
endif