From 469804206a51674d2e512ca523e2a3bf74de2b14 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Wed, 21 Jun 2023 14:25:52 +0000 Subject: [PATCH] Squashed 'alpine-cloud-images/' changes from 59d83fd..064a526 064a526 3.18 Related Fixes 1fd7f83 Update for Tiny Cloud 3.0.0 2ca06ef add 3.18, fix repo_keys, tiny-cloud b7e0d75 Support for custom Alpine repository keys REVERT: 59d83fd Rename option, add docs REVERT: 1c04440 Support for custom Alpine repo keys, which allows package install from them via simple overlay config rather than having to script the install as postinstall git-subtree-dir: alpine-cloud-images git-subtree-split: 064a526fe056463d81affa3c24fac59317d20dff --- configs/alpine.conf | 2 +- configs/bootstrap/cloudinit.conf | 13 +++++++++++++ configs/bootstrap/tiny.conf | 15 +++++++-------- configs/version/3.18.conf | 7 +++++++ configs/version/base/1.conf | 2 ++ scripts/setup | 5 ++++- scripts/setup-tiny | 30 +++++++++++++++++++++++++++--- 7 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 configs/version/3.18.conf diff --git a/configs/alpine.conf b/configs/alpine.conf index 65f533b..1bd93b4 100644 --- a/configs/alpine.conf +++ b/configs/alpine.conf @@ -55,10 +55,10 @@ Default { # profile build matrix Dimensions { version { + "3.18" { include required("version/3.17.conf") } "3.17" { include required("version/3.17.conf") } "3.16" { include required("version/3.16.conf") } "3.15" { include required("version/3.15.conf") } - "3.14" { include required("version/3.14.conf") } edge { include required("version/edge.conf") } } arch { diff --git a/configs/bootstrap/cloudinit.conf b/configs/bootstrap/cloudinit.conf index 07abbcf..478e7c6 100644 --- a/configs/bootstrap/cloudinit.conf +++ b/configs/bootstrap/cloudinit.conf @@ -12,6 +12,19 @@ packages { openssh-server-pam = true e2fsprogs-extra = true # for resize2fs } + +WHEN.nocloud { + # fix for "failed to mount /dev/sr0 when looking for data" + # @see https://git.alpinelinux.org/aports/tree/community/cloud-init/README.Alpine + packages.mount = true + WHEN { + "3.15 3.16" { + packages.mount = null + packages.util-linux-misc = true + } + } +} + services.default.cloud-init-hotplugd = true scripts = [ setup-cloudinit ] diff --git a/configs/bootstrap/tiny.conf b/configs/bootstrap/tiny.conf index 59d96d8..906fc3c 100644 --- a/configs/bootstrap/tiny.conf +++ b/configs/bootstrap/tiny.conf @@ -3,23 +3,22 @@ name = [tiny] bootstrap_name = Tiny Cloud bootstrap_url = "https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud" -services { - sysinit.tiny-cloud-early = true - default.tiny-cloud = true - default.tiny-cloud-final = true -} - WHEN { + "3.13 3.14 3.15 3.16 3.17" { + # tiny-cloud < 3.0.0 doesn't have --setup option + boot.tiny-cloud-early = true + default.tiny-cloud = true + default.tiny-cloud-final = true + } aws { packages.tiny-cloud-aws = true WHEN { "3.12" { - # tiny-cloud-network requires ifupdown-ng (unavailable in 3.12) + # fallback to the old tiny-ec2-bootstrap package packages.tiny-cloud-aws = null services.sysinit.tiny-cloud-early = null services.default.tiny-cloud = null services.default.tiny-cloud-final = null - # fall back to tiny-ec2-bootstrap instead packages.tiny-ec2-bootstrap = true services.default.tiny-ec2-bootstrap = true } diff --git a/configs/version/3.18.conf b/configs/version/3.18.conf new file mode 100644 index 0000000..0032ab5 --- /dev/null +++ b/configs/version/3.18.conf @@ -0,0 +1,7 @@ +# vim: ts=2 et: + +include required("base/5.conf") + +motd { + sudo_removed = "NOTE: 'sudo' is not installed by default, please use 'doas' instead." +} diff --git a/configs/version/base/1.conf b/configs/version/base/1.conf index 9d95504..e257118 100644 --- a/configs/version/base/1.conf +++ b/configs/version/base/1.conf @@ -6,6 +6,8 @@ repos { "https://dl-cdn.alpinelinux.org/alpine/v{version}/testing" = false } +repo_keys = [] + packages { alpine-base = true linux-virt = true diff --git a/scripts/setup b/scripts/setup index 1c826c7..0e3ffa2 100755 --- a/scripts/setup +++ b/scripts/setup @@ -56,7 +56,10 @@ make_filesystem() { mkfs.fat -n EFI "${DEVICE}1" fi - mkfs.ext4 -O ^64bit -L / "$root_dev" + # before Alpine 3.18... + # - grub2 can't handle "metadata_csum_seed" + # - fsck can't handle "orphan_file" + mkfs.ext4 -O ^64bit,^metadata_csum_seed,^orphan_file -L / "$root_dev" mkdir -p "$TARGET" mount -t ext4 "$root_dev" "$TARGET" diff --git a/scripts/setup-tiny b/scripts/setup-tiny index 9fc91fc..64ea5fd 100755 --- a/scripts/setup-tiny +++ b/scripts/setup-tiny @@ -15,7 +15,31 @@ if [ "$VERSION" = "3.12" ]; then echo "EC2_USER=$IMAGE_LOGIN" > /etc/conf.d/tiny-ec2-bootstrap else einfo "Configuring Tiny Cloud..." - sed -i.bak -Ee "s/^#?CLOUD_USER=.*/CLOUD_USER=$IMAGE_LOGIN/" \ - "$TARGET"/etc/conf.d/tiny-cloud - rm "$TARGET"/etc/conf.d/tiny-cloud.bak + + TC_CONF="$TARGET/etc/tiny-cloud.conf" + # tiny-cloud >= 3.0.0 moved configs, the following supports older versions + [ ! -f "$TC_CONF" ] && TC_CONF="$TARGET/etc/conf.d/tiny-cloud" + + sed -i.bak -Ee "s/^#?CLOUD_USER=.*/CLOUD_USER=$IMAGE_LOGIN/" "$TC_CONF" + rm "$TC_CONF.bak" + + # tiny-cloud >= 3.0.0 sets up init scripts with /sbin/tiny-cloud --setup + if [ -f "$TARGET/sbin/tiny-cloud" ]; then + # fixed in tiny-cloud >3.0.1 + #chroot "$TARGET" /sbin/tiny-cloud --enable + # logic directly implemented here, for now + echo -- "- removing tiny-cloud* from all runlevels" + rm -f "$TARGET"/etc/runlevels/*/tiny-cloud* + ln -s /etc/init.d/tiny-cloud-boot "$TARGET"/etc/runlevels/boot + echo -- "+ tiny-cloud-boot service added to boot runlevel" + for p in early main final; do + ln -s "/etc/init.d/tiny-cloud-$p" "$TARGET"/etc/runlevels/default + echo -- "+ tiny-cloud-$p service added to default runlevel" + done + # TODO: will need to update this for >3.18 + elif [ "$VERSION" = "3.18" ]; then + # 3.18 has tiny-cloud 3.0.0, and we didn't find what we expected + echo "Error: /sbin/tiny-cloud not found" >&2 + exit 1 + fi fi