Skip to content

Commit

Permalink
shift systemd customization from base chroot to images
Browse files Browse the repository at this point in the history
  • Loading branch information
jpalus committed Nov 24, 2022
1 parent 7b1e0b5 commit b3f5603
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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\)=')
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b3f5603

Please sign in to comment.