commit: 71e3d18876d3b2a825f45bc7a812d262ffbff1e7
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 17:51:46 2024 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 17:51:46 2024 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=71e3d188
Provide some very basic configuration
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
targets/support/diskimage-installation.sh | 51 +++++++++++++++++++++++++++++--
1 file changed, 49 insertions(+), 2 deletions(-)
diff --git a/targets/support/diskimage-installation.sh
b/targets/support/diskimage-installation.sh
index 8599112b..14052f6a 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -2,7 +2,54 @@
source /tmp/chroot-functions.sh
-# do some basic system setup here
+if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] ; then
-# we can't install the boot loader because nothing is mounted anywhere
+# 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
+
+# Set up basic services
+echo "Running systemctl preset-all"
+systemctl preset-all || die "Running systemctl preset-all failed"
+
+# Provide configuration for systemd-firstboot
+# We need enough information so all questions are skipped
+mysfconfigfile=/etc/systemd/system/systemd-firstboot.service.d/00gentoo.conf
+
+mysfconfig_console=$(cat <<END
+[Service]
+ExecStart=systemd-firstboot --locale=en_US.UTF-8 --timezone=UTC
--delete-root-password
+END
+
+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)"
+ ;;
+ console)
+ echo "Setting up console image. Please change the root
password."
+ echo "${mysfconfig_console}" > "${mysfconfigfile}"
+ ;;
+ *)
+ 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)