From a52543341c6250e4dd7ba57ac6a03397c184209f Mon Sep 17 00:00:00 2001 From: William Wilson Date: Thu, 30 Mar 2023 09:14:46 -0400 Subject: [PATCH] Only set up oem-config if the user doesn't already exist --- debian/changelog | 4 ++++ .../ubuntu/hooks/099-ubuntu-image-customization.chroot | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index aa6055e6..61e683d1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ livecd-rootfs (2.818) UNRELEASED; urgency=medium + [ Dave Jones ] * raspi: drop mkswap.service and swapfile.swap units in 099-ubuntu-image-customization.chroot in favour of units provided by ubuntu-raspi-settings-desktop @@ -8,6 +9,9 @@ livecd-rootfs (2.818) UNRELEASED; urgency=medium * raspi: drop growfs option from fstab in favour of growroot-almost service provided by ubuntu-raspi-settings-desktop + [ William 'jawn-smith' Wilson ] + * Skip oem-config setup in hooks if the oem user already exists. + -- Dave Jones Tue, 28 Mar 2023 14:38:55 +0100 livecd-rootfs (2.817) lunar; urgency=medium diff --git a/live-build/ubuntu/hooks/099-ubuntu-image-customization.chroot b/live-build/ubuntu/hooks/099-ubuntu-image-customization.chroot index 5fa3f713..91449b61 100644 --- a/live-build/ubuntu/hooks/099-ubuntu-image-customization.chroot +++ b/live-build/ubuntu/hooks/099-ubuntu-image-customization.chroot @@ -11,7 +11,13 @@ if [ "$IMAGEFORMAT" == "none" ]; then touch /var/log/syslog chown syslog:adm /var/log/syslog - # Create the oem user account + # Create the oem user account only if it doesn't already exist + if ! id "oem" &>/dev/null; then + /usr/sbin/useradd -d /home/oem -G adm,sudo -m -N -u 29999 oem + /usr/sbin/oem-config-prepare --quiet + touch "/var/lib/oem-config/run" + fi + /usr/sbin/useradd -d /home/oem -G adm,sudo -m -N -u 29999 oem /usr/sbin/oem-config-prepare --quiet