diff options
author | 2024-10-13 17:17:09 +0200 | |
---|---|---|
committer | 2024-10-13 17:17:09 +0200 | |
commit | c4a8f58dab1a1757a8cb10d432caa4339f93665a (patch) | |
tree | f35e7676086afa62db0ef3bc5168a4d17301274a | |
parent | We need no bootloader action (is done at the end during qcow2 creation) (diff) | |
download | catalyst-c4a8f58dab1a1757a8cb10d432caa4339f93665a.tar.gz catalyst-c4a8f58dab1a1757a8cb10d432caa4339f93665a.tar.bz2 catalyst-c4a8f58dab1a1757a8cb10d432caa4339f93665a.zip |
Move diskimage-installation into diskimagefs-update, simpler
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
-rw-r--r-- | catalyst/targets/diskimage_stage2.py | 3 | ||||
-rwxr-xr-x | targets/diskimage-stage2/controller.sh | 7 | ||||
-rwxr-xr-x | targets/support/diskimage-installation.sh | 63 | ||||
-rwxr-xr-x | targets/support/diskimagefs-update.sh | 62 |
4 files changed, 61 insertions, 74 deletions
diff --git a/catalyst/targets/diskimage_stage2.py b/catalyst/targets/diskimage_stage2.py index cf7fcec5..bcad8b0d 100644 --- a/catalyst/targets/diskimage_stage2.py +++ b/catalyst/targets/diskimage_stage2.py @@ -71,9 +71,6 @@ class diskimage_stage2(StageBase): clear_dir(self.settings['target_path']) def run_local(self): - # let's first start with the controller file - StageBase.run_local(self) - # what modules do we want to blacklist? if "diskimage/modblacklist" in self.settings: path = normpath(self.settings["chroot_path"] + diff --git a/targets/diskimage-stage2/controller.sh b/targets/diskimage-stage2/controller.sh index 7b1aa4bd..b168e98c 100755 --- a/targets/diskimage-stage2/controller.sh +++ b/targets/diskimage-stage2/controller.sh @@ -3,11 +3,6 @@ source ${clst_shdir}/support/functions.sh case $1 in - run) - # We need to install grub's EFI files and do very basic configuration - exec_in_chroot "${clst_shdir}/support/diskimage-installation.sh" || exit 1 - ;; - pre-kmerge) # Sets up the build environment before any kernels are compiled exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh @@ -33,7 +28,7 @@ case $1 in ;; diskimage-update) - # Now, finalize and tweak the livecd fs (inside of the chroot) + # We need to install grub's EFI files and do very basic configuration exec_in_chroot ${clst_shdir}/support/diskimagefs-update.sh ;; diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh deleted file mode 100755 index 45d870a5..00000000 --- a/targets/support/diskimage-installation.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -source /tmp/chroot-functions.sh - -if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] ; then - -# We are using systemd. - -# Types of bootable disk images planned for (diskimage/type): -# cloud-init - an image that starts cloud-init for configuration and then can be -# used out of the box -# console - an image that has an empty root password and allows passwordless -# login on the console only -# ssh - an image that populates /root/.ssh/authorized_keys and starts dhcp -# as well as sshd; obviously not fit for public distribution -# generic - an image with no means of logging in... needs postprocessing -# no services are started - -echo "Generating /etc/locale.gen" -cat > /etc/locale.gen <<END -en_US ISO-8859-1 -en_US.UTF-8 UTF-8 -END - -echo "Running systemctl preset-all" -systemctl preset-all || die "Running systemctl preset-all failed" - -echo "Setting locale" -echo 'LANG="en_US.UTF-8"' > /etc/locale.conf || die "Failed to set locale" -env-update || die "Failed to run env-update" - -echo "Setting keymap" -echo "KEYMAP=us" > /etc/vconsole.conf || die "Failed to set keymap" - -echo "Disk image type is ${clst_diskimage_type}" -case ${clst_diskimage_type} in - generic) - echo "Setting up generic image (warning, not very useful on its own)" - echo "Running systemd-firstboot" - systemd-firstboot --timezone=UTC || die "Failed running systemd-firstboot" - ;; - console) - echo "Setting up console log-in image. Please set the root password ASAP." - echo "Removing root password" - passwd -d root || die "Failed removing root password" - echo "Running systemd-firstboot" - systemd-firstboot --timezone=UTC || die "Failed running systemd-firstboot" - ;; - *) - die "As yet unsupported image type" - ;; -esac - -else - -# We are using OpenRC. - -die "OpenRC is as yet unsupported." - -fi - -# all done -# (we can't install the boot loader here because nothing is mounted) diff --git a/targets/support/diskimagefs-update.sh b/targets/support/diskimagefs-update.sh index ae8daf78..45d870a5 100755 --- a/targets/support/diskimagefs-update.sh +++ b/targets/support/diskimagefs-update.sh @@ -1,5 +1,63 @@ #!/bin/bash -RUN_DEFAULT_FUNCS="no" - source /tmp/chroot-functions.sh + +if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] ; then + +# We are using systemd. + +# Types of bootable disk images planned for (diskimage/type): +# cloud-init - an image that starts cloud-init for configuration and then can be +# used out of the box +# console - an image that has an empty root password and allows passwordless +# login on the console only +# ssh - an image that populates /root/.ssh/authorized_keys and starts dhcp +# as well as sshd; obviously not fit for public distribution +# generic - an image with no means of logging in... needs postprocessing +# no services are started + +echo "Generating /etc/locale.gen" +cat > /etc/locale.gen <<END +en_US ISO-8859-1 +en_US.UTF-8 UTF-8 +END + +echo "Running systemctl preset-all" +systemctl preset-all || die "Running systemctl preset-all failed" + +echo "Setting locale" +echo 'LANG="en_US.UTF-8"' > /etc/locale.conf || die "Failed to set locale" +env-update || die "Failed to run env-update" + +echo "Setting keymap" +echo "KEYMAP=us" > /etc/vconsole.conf || die "Failed to set keymap" + +echo "Disk image type is ${clst_diskimage_type}" +case ${clst_diskimage_type} in + generic) + echo "Setting up generic image (warning, not very useful on its own)" + echo "Running systemd-firstboot" + systemd-firstboot --timezone=UTC || die "Failed running systemd-firstboot" + ;; + console) + echo "Setting up console log-in image. Please set the root password ASAP." + echo "Removing root password" + passwd -d root || die "Failed removing root password" + echo "Running systemd-firstboot" + systemd-firstboot --timezone=UTC || die "Failed running systemd-firstboot" + ;; + *) + die "As yet unsupported image type" + ;; +esac + +else + +# We are using OpenRC. + +die "OpenRC is as yet unsupported." + +fi + +# all done +# (we can't install the boot loader here because nothing is mounted) |