Nabuchodonozor
Nabuchodonozor

Reputation: 736

Install systemd service on Debian installation

I'm building custom Debian ISO with simple-cdd utility. It worked well till the moment when I attached my own .deb package.

build-simple-cdd --dist stretch --profiles moj --force-root --local-packages /root/iso/deb

build-simple-cdd works properly, because I saw my deb package in tmp directory structure and iso image is created successfully. However debian installation failsenter image description here

I suspect, that postinst script fails, since it uses systemctl command when it may be unavailable.

#!/bin/sh
set -e

echo $1
if [ "$1" = "configure" ]; then 
    echo "Configuring privileges..."
    chown user:user /usr/bin/Koncentrator
    chmod 0755 /usr/bin/Koncentrator

    echo "Enabling Koncentrator services..." 
    systemctl daemon-reload
    systemctl enable Xvfb.service
    systemctl enable Koncentrator.service
fi

I've added systemd dependency to control file, but it doesn't work.

Upvotes: 0

Views: 916

Answers (1)

Nabuchodonozor
Nabuchodonozor

Reputation: 736

I made workaround for this issue. simple-cdd allows to prepare post installation script. apt install is called there without problems. Two steps are required to use this solution:

  1. Add deb package to installation disk. This is configured via profile configuration file (moj.conf):
all_extras="$all_extras /root/iso/files/customapackage_0.1.3.deb"
  1. Run apt install in moj.postinst script:
#!/bin/sh

mount /dev/cdrom /media/cdrom
cd /media/cdrom/simple-cdd
apt install ./custompackage_0.1.3.deb
cd /
sync
umount /media/cdrom

If you want to debug your postinst script, you can insert there long sleep:

#!/bin/sh

sleep 10000000
...

And switch terminal (Ctrl+Alt+F1-6) during finish-install phase. Than call chroot /target to switch in-target environemnent

Upvotes: 0

Related Questions