
Ich habe nun die ersten zwei Werte ausgefüllt, was ja richtig zu sein scheint:
Code: Alles auswählen
[installation]
service_user=adminuser
service_password=none
service_hidden_password=
Danke und Grüße
SirTux
Code: Alles auswählen
[installation]
service_user=adminuser
service_password=none
service_hidden_password=
Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.
Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.
uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de
Or if every client gets the same image, perhaps using multicast is an option? This is what ghost uses when ghostcasting to multiple clients.SirTux hat geschrieben:Ah ja, gibt es eigentlich schon sowas wie eine Warteschleife, so daß nicht alle Clients gleichzeitig saugen?
Das wäre eine Möglichkeit ja. Gibt es dabei was zu beachten bzw. einzustellen? Oder macht Clonezilla das automatisch?SisterOfMercy hat geschrieben:Or if every client gets the same image, perhaps using multicast is an option? This is what ghost uses when ghostcasting to multiple clients.
Scheint wohl leider nicht zu klappen. Dann werde ich das wohl direkt ins Paket einpflegen müssen.SirTux hat geschrieben:Hallo, diese Weg ist inzwischen auch von mir präferiert. Ausführen lassen kann ich das Script über drbl_ocs_conf? Welche Anforderungen werden denn dann an die Scripte gestellt? Muß der Pfad aus Server- oder aus Clientsicht angegeben werden?
Code: Alles auswählen
if installclientagent:
target = '/mnt/hd'
windowsPartitionNumber = '/dev/sda1'
source = '/mnt/opsi/opsi-clonezilla-postrun/opsi-install'
srcDriversDir = source + '/drivers'
dstDriversDir = target + '/drv'
dstPeDriversDir = target + '/drvpe'
# Do hardware inventory
logger.notice(u"Fetching opsi hw audit configuration")
hwconfig = backend.auditHardware_getConfig()
logger.notice(u"Running hardware inventory")
auditHardwareOnHosts = auditHardware(config = hwconfig, hostId = clientId)
logger.notice(u"Sending hardware information to service")
backend.auditHardwareOnHost_setObsolete(clientId)
backend.auditHardwareOnHost_updateObjects(auditHardwareOnHosts)
# Get harddisks
disks = getHarddisks()
# use first disk
disk = disks[0]
# check the mount point
exitcode = os.system("test -d %s >> /dev/null 2>&1" % (target))
if (0 == int(exitcode)):
logger.notice(u"%s exists as directory - fine" % target)
else:
logger.notice(u"%s does not exists as directory - creating" % target)
os.makedirs(target)
# Mount partition
# use -t vfat for raid
logger.notice(u"mount winpe partition")
execute('mount.ntfs-3g %s %s' % (windowsPartition, target))
# Copy opsi files
depot.copy(source + '/opsi', target + '/')
# Copy opsi-client-agent
depot.copy('/opsi-client-agent', target + '/opsi/')
copy(target + '/opsi/opsi-client-agent/files/opsi/postinst.d/*', target + '/opsi/postinst.d/')
## Copy custom files
#depot.copy(source + '/custom/unattend.xml', target + '/opsi/')
#depot.copy(source + '/custom/postinst.d/*', target + '/opsi/postinst.d/')
# Copy sysconf.ini to opsi-client-agent config dir
copy(SYSCONF_INI , target + '/opsi/opsi-client-agent/files/opsi/cfg')
# Integrate drivers
os.makedirs(dstDriversDir)
os.makedirs(dstPeDriversDir)
if depot.exists(srcDriversDir):
scriptMessageSubject.setMessage("Treiber-Verzeichnis '%s' gefunden, starte Treiberintegration" % srcDriversDir)
additionalDrivers = [ ad.strip() for ad in (u','.join(productPropertyValues.get('additional_drivers', [u'']))).split(u',') ]
integrateAdditionalWindowsDrivers(srcDriversDir + u'/drivers/additional', dstDriversDir, additionalDrivers, messageSubject = scriptMessageSubject, srcRepository = depot, auditHardwareOnHosts = auditHardwareOnHosts)
integrateWindowsHardwareDrivers(srcDriversDir, dstDriversDir, auditHardwareOnHosts, messageSubject = scriptMessageSubject, srcRepository = depot)
# Patch files
logger.notice(u"Patching unattend.xml and config.ini")
for i in ( target + '/opsi/unattend.xml', target + '/opsi/opsi-client-agent/files/opsi/cfg/config.ini' ):
execute('/usr/local/bin/patcha %s' % i)
execute('/usr/local/bin/patcha -f %s %s' % (PATCHA_IN, i))
# Debug output of file content
for fn in ('/opsi/work.cmd', '/opsi/startnet.cmd', '/opsi/diskpart.txt'):
execute("%s '%s'" % (which('cat'), target + fn))
# Umount partition
logger.notice(u"umount %s >> /tmp/gpt.log 2>&1" % (windowsPartition))
execute('/bin/umount %s' % (windowsPartition))
Code: Alles auswählen
##################################################################################################
# Begin of changes
##################################################################################################
if (str(productProperties.get('installclientagent', 'true')).lower() == 'false'):
installclientagent = False
else:
installclientagent = True
if installclientagent:
##############################################################################################
# opsi-client-agent
##############################################################################################
target = '/mnt/hd'
windowsPartition = '/dev/sda1'
source = '/mnt/opsi/opsi-clonezilla-postrun/opsi-install'
srcDriversDir = source + '/drivers'
dstDriversDir = target + '/drv'
dstPeDriversDir = target + '/drvpe'
# Do hardware inventory
logger.notice(u"Fetching opsi hw audit configuration")
hwconfig = backend.auditHardware_getConfig()
logger.notice(u"Running hardware inventory")
auditHardwareOnHosts = auditHardware(config = hwconfig, hostId = clientId)
logger.notice(u"Sending hardware information to service")
backend.auditHardwareOnHost_setObsolete(clientId)
backend.auditHardwareOnHost_updateObjects(auditHardwareOnHosts)
# check the mount point
exitcode = os.system("test -d %s >> /dev/null 2>&1" % (target))
if (0 == int(exitcode)):
logger.notice(u"%s exists as directory - fine" % target)
else:
logger.notice(u"%s does not exists as directory - creating" % target)
os.makedirs(target)
# Mount partition
# use -t vfat for raid
logger.notice(u"mount winpe partition")
execute('mount.ntfs-3g %s %s' % (windowsPartition, target))
# Copy opsi files
depot.copy(source + '/opsi', target + '/')
# Copy opsi-client-agent
depot.copy('/opsi-client-agent', target + '/opsi/')
copy(target + '/opsi/opsi-client-agent/files/opsi/postinst.d/*', target + '/opsi/postinst.d/')
## Copy custom files
#depot.copy(source + '/custom/unattend.xml', target + '/opsi/')
#depot.copy(source + '/custom/postinst.d/*', target + '/opsi/postinst.d/')
# Copy sysconf.ini to opsi-client-agent config dir
copy(SYSCONF_INI , target + '/opsi/opsi-client-agent/files/opsi/cfg')
# Integrate drivers
os.makedirs(dstDriversDir)
os.makedirs(dstPeDriversDir)
if depot.exists(srcDriversDir):
scriptMessageSubject.setMessage("Treiber-Verzeichnis '%s' gefunden, starte Treiberintegration" % srcDriversDir)
additionalDrivers = [ ad.strip() for ad in (u','.join(productPropertyValues.get('additional_drivers', [u'']))).split(u',') ]
integrateAdditionalWindowsDrivers(srcDriversDir + u'/drivers/additional', dstDriversDir, additionalDrivers, messageSubject = scriptMessageSubject, srcRepository = depot, auditHardwareOnHosts = auditHardwareOnHosts)
integrateWindowsHardwareDrivers(srcDriversDir, dstDriversDir, auditHardwareOnHosts, messageSubject = scriptMessageSubject, srcRepository = depot)
# Patch files
logger.notice(u"Patching unattend.xml and config.ini")
for i in ( target + '/opsi/unattend.xml', target + '/opsi/opsi-client-agent/files/opsi/cfg/config.ini' ):
execute('/usr/local/bin/patcha %s' % i)
execute('/usr/local/bin/patcha -f %s %s' % (PATCHA_IN, i))
# Debug output of file content
for fn in ('/opsi/work.cmd', '/opsi/startnet.cmd', '/opsi/diskpart.txt'):
execute("%s '%s'" % (which('cat'), target + fn))
# Umount partition
logger.notice(u"umount %s >> /tmp/gpt.log 2>&1" % (windowsPartition))
execute('/bin/umount %s' % (windowsPartition))
##############################################################################################
# GRUB
##############################################################################################
import fileinput
import sys
def replaceAll(file,searchExp,replaceExp):
for line in fileinput.input(file, inplace=1):
if searchExp in line:
line = line.replace(searchExp,replaceExp)
sys.stdout.write(line)
bootPartition = '/dev/sda2'
rootPartition = '/dev/sda4'
execute('mount %s /mnt/hd' % (rootPartition))
execute('mount %s /mnt/hd/boot' % (bootPartition))
logger.notice(u"Changing grub default to windows")
replaceAll("/mnt/hd/boot/grub/menu.lst","default 0","default 1")
execute('hostname > /mnt/hd/etc/hostname')
execute('umount /mnt/hd/boot')
execute('umount /mnt/hd')
##################################################################################################
# End of changes
##################################################################################################
Code: Alles auswählen
import ConfigParser
from OPSI.Util.File import IniFile
from OPSI.Backend.BackendManager import BackendManager
from OPSI.Backend.JSONRPC import JSONRPCBackend
from OPSI.Util import md5sum
from hashlib import md5
from twisted.conch.ssh import keys