Seite 1 von 1

Modify opsipxeconfd

Verfasst: 28 Mär 2023, 13:20
von o.ferre
Hi,

with older version of opsi, I modified the /usr/bin/opsipxeconfd file to call a perl script.

With the new version, i'm not sure this run correctly.


In the old version, this is my opsipxeconfd file :

Code: Alles auswählen

def updateBootConfiguration(self, hostId):
                try:
                        hostId = forceHostId(hostId)
                        logger.info(u"Updating PXE boot configuration for host '%s'" % hostId)

                        # Remove current pxe config for host
                        currentPcws = []
                        self._pxeConfigWritersLock.acquire()
                        try:
                                for pcw in self._pxeConfigWriters:
                                        if (pcw.hostId == hostId):
                                                currentPcws.append(pcw)
                                for pcw in currentPcws:
                                        self._pxeConfigWriters.remove(pcw)
                        finally:
                                self._pxeConfigWritersLock.release()
                        for pcw in currentPcws:
                                pcw.stop()
                                while pcw.isAlive():
                                        time.sleep(0.1)
                                logger.notice(u"PXE boot configuration for host '%s' removed" % hostId)
                        # Suppression de la liste des paquets FUSION
                        subprocess.call(["/path_to_perl_script.pl", hostId])
I would like to call this script at beginning of opsi (perhaps I got to modify /usr/lib/opsipxeconfd/opsipxeconfd.py or opsipxeconfdinit.py ? OR is there another way to execute script at the beginning of opsi process ?

Version of OPSI : 4.2.0.3

I used OPSI only for deploy OS by pxe boot.

Thanks for the help
Olivier

Re: Modify opsipxeconfd

Verfasst: 28 Mär 2023, 16:03
von m.radtke
Hi Olivier,

what does this script do?

The current opsipxeconfd is build as a binary and you cannot edit it anymore.

When you tell us what this script did, maybe someone may have another idea how ti implement this into opsi.

Regards

Mathias

Re: Modify opsipxeconfd

Verfasst: 28 Mär 2023, 19:14
von o.ferre
Hi Mathias,
Thanks for your answer. The script make a connection to a GLPI database to remove the packages list of a computer.
After this, a postinst script install the fusioninventory agent on the computer and execute a contact.

This script is useful in case of reinstallation of computer and to make install faster.
Well, I can do this in powershell in a postinst script too... but I have to write it ! :-)

Olivier

Re: Modify opsipxeconfd

Verfasst: 30 Mär 2023, 10:42
von o.ferre
Hi,

to be more precise, I would like to execute a script during the execution of opsi linux boot image
https://ibb.co/qkB6kmC
And after fill in the HostID.

Olivier