Hier haben hier ein Paket mit Namen lib welches keine Aktionen ausführen kann ( In der Control kein Eintrag bei Setup,Uninstall etc) und pflegen damit solche Scripte um sie leichter in andere Pakete einbauen zu können.
OPSI/control
Code: Alles auswählen
[Package]
version: 1
depends:
incremental: False
[Product]
type: localboot
id: lib
name: lib
description:
advice:
version: 1.2
priority: 0
licenseRequired: False
productClasses:
setupScript:
uninstallScript:
updateScript:
alwaysScript:
onceScript:
customScript:
userLoginScript:
[Changelog]
lib (1.0-1) testing; urgency=low
* Initial package
-- dkoch <dkoch@westpfalz-klinikum.de> Wed, 20 Nov 2013 14:57:16 +0000
CLIENT_DATA/get_host_info/get_host_info.opiscript
Code: Alles auswählen
include_append "%scriptdrive%\lib\get_host_info\opsiservicecall_gethosthash.opsiscript"
DefVar $hostId$
DefVar $description$
DefVar $created$
DefVar $inventoryNumber$
DefVar $notes$
DefVar $hardwareAddress$
DefVar $lastSeen$
DefVar $oneTimePassword$
DefVar $opsiHostKey$
DefVar $ipAddress$
DefStringlist $hosthash$
Set $hosthash$ = getReturnListFromSection("opsiservicecall_gethosthash")
set $hostId$ = getValue("hostId",$hosthash$)
set $description$ = getValue("description",$hosthash$)
set $created$ = getValue("created",$hosthash$)
set $inventoryNumber$ = getValue("inventoryNumber",$hosthash$)
set $notes$ = getValue("notes",$hosthash$)
set $hardwareAddress$ = getValue("hardwareAddress",$hosthash$)
set $lastSeen$ = getValue("lastSeen",$hosthash$)
set $oneTimePassword$ = getValue("oneTimePassword",$hosthash$)
set $opsiHostKey$ = getValue("opsiHostKey",$hosthash$)
set $ipAddress$ = getValue("ipAddress",$hosthash$)
CLIENT_DATA/get_host_info/opsiservicecall_gethosthash.opsiscript
Code: Alles auswählen
[opsiservicecall_gethosthash]
"method":"getHost_hash"
"params": [
"%hostid%"
]
Diese Paket wird auf allen Depots installiert. Danach kannst du in dein Script(e) mit
Code: Alles auswählen
include_insert "%scriptdrive%\lib\get_host_info\get_host_info.opsiscript"
die Funktion aufrufen.
Durch das Einbinden werden diese Variablen definiert und gesetzt:
- hostId
- description
- created
- inventoryNumber
- notes
- hardwareAddress
- lastSeen
- oneTimePassword
- opsiHostKey
- ipAddress