aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2024-10-13 16:42:29 +0200
committerAndreas K. Hüttel <dilfridge@gentoo.org>2024-10-13 22:30:46 +0200
commitf59604b8509bff8469bdbbc5389b3cb5b43e7fcd (patch)
tree6b4775867a3e1ada15a212c3c988c83ca07b26e3
parentSupport scripts for bootloader installation and configuration (diff)
downloadcatalyst-f59604b8509bff8469bdbbc5389b3cb5b43e7fcd.tar.gz
catalyst-f59604b8509bff8469bdbbc5389b3cb5b43e7fcd.tar.bz2
catalyst-f59604b8509bff8469bdbbc5389b3cb5b43e7fcd.zip
Support scripts for diskimage configuration
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
-rwxr-xr-xtargets/support/diskimagefs-update.sh63
1 files changed, 63 insertions, 0 deletions
diff --git a/targets/support/diskimagefs-update.sh b/targets/support/diskimagefs-update.sh
new file mode 100755
index 00000000..45d870a5
--- /dev/null
+++ b/targets/support/diskimagefs-update.sh
@@ -0,0 +1,63 @@
+#!/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)