From b3f5603cac1bed1e38c426bf7224c04eefa51cef Mon Sep 17 00:00:00 2001 From: Jan Palus Date: Thu, 24 Nov 2022 15:41:05 +0100 Subject: [PATCH] shift systemd customization from base chroot to images --- release.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/release.sh b/release.sh index da0e4d0..e9bb601 100755 --- a/release.sh +++ b/release.sh @@ -118,11 +118,6 @@ create() { run_log_priv "Setting up temporary chroot in $CHROOT_DIR" rpm --initdb --root "$CHROOT_DIR" poldek_install "Installing packages from $SCRIPT_DIR/base.pkgs" --pset="$SCRIPT_DIR/base.pkgs" --root="$CHROOT_DIR" --pmopt='--define=_tmppath\ /tmp' - run_log_priv "Setting systemd default target to multi-user.target" ln -sf /lib/systemd/system/multi-user.target "$CHROOT_DIR/etc/systemd/system/default.target" - run_log_priv "Disabling network.service" rm "$CHROOT_DIR/etc/systemd/system/multi-user.target.wants/network.service" - run_log_priv "Creating /etc/systemd/system/local-fs.target.wants" mkdir -p "$CHROOT_DIR/etc/systemd/system/local-fs.target.wants" - run_log_priv "Enabling tmp.mount" ln -s /lib/systemd/system/tmp.mount "$CHROOT_DIR/etc/systemd/system/local-fs.target.wants/tmp.mount" - run_log_priv "Masking pld-clean-tmp.service" ln -s /dev/null "$CHROOT_DIR/etc/systemd/system/pld-clean-tmp.service" if [ ! -f "$SCRIPT_DIR/jpalus.asc" ]; then run_log "Fetching public key" wget http://jpalus.fastmail.com/jpalus.asc -O "$SCRIPT_DIR/jpalus.asc" fi @@ -267,6 +262,14 @@ image_install_basic_pkgs() { poldek_install "Installing basic packages" --root "$IMAGE_MOUNT_DIR" -n jpalus -n th $BASIC_PKGS } +image_systemd_setup() { + run_log_priv "Setting systemd default target to multi-user.target" ln -sf /lib/systemd/system/multi-user.target "$IMAGE_MOUNT_DIR/etc/systemd/system/default.target" + run_log_priv "Disabling network.service" rm "$IMAGE_MOUNT_DIR/etc/systemd/system/multi-user.target.wants/network.service" + run_log_priv "Creating /etc/systemd/system/local-fs.target.wants" mkdir -p "$IMAGE_MOUNT_DIR/etc/systemd/system/local-fs.target.wants" + run_log_priv "Enabling tmp.mount" ln -s /lib/systemd/system/tmp.mount "$IMAGE_MOUNT_DIR/etc/systemd/system/local-fs.target.wants/tmp.mount" + run_log_priv "Masking pld-clean-tmp.service" ln -s /dev/null "$IMAGE_MOUNT_DIR/etc/systemd/system/pld-clean-tmp.service" +} + _part_id() { local UUID LABEL eval $($SUDO blkid --output export "$1" | grep '^\(LABEL\|UUID\)=') @@ -448,6 +451,7 @@ image_create() { image_dispatch image_mount_fs run_log_priv "Extracting $RELEASE_NAME to $IMAGE_MOUNT_DIR" tar xf "$SCRIPT_DIR/$RELEASE_NAME.tar.xz" -C "$IMAGE_MOUNT_DIR" image_dispatch image_install_basic_pkgs + image_dispatch image_systemd_setup image_dispatch image_prepare_fstab echo -e 'pld\npld' | run_log_priv "Setting root password" chroot "$IMAGE_MOUNT_DIR" passwd image_dispatch image_install_bootloader