From 97f9193bcdb7973b081c55087d1bac12a662c871 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Mon, 21 Mar 2022 12:57:04 +0100 Subject: [PATCH] Squashed 'alpine-cloud-images/' changes from 99474a8..190e7f0 190e7f0 Merge branch 'main' of https://gitlab.alpinelinux.org/alpine/cloud/alpine-cloud-images dd0e7b2 filter out non-tiny bootstrap images 7ac2029 Minor Fixes 5e89670 always apk upgrade builder VM, fix --clean of symlinked dirs 3399bde Fine tune apk upgrade git-subtree-dir: alpine-cloud-images git-subtree-split: 190e7f014539314b2ab29bd92156eec933da785f --- build | 5 ++++- configs/alpine.conf | 4 ++-- configs/bootstrap/cloudinit.conf | 3 +++ configs/bootstrap/tiny.conf | 28 +++++++++++++++++++++------- gen_releases.py | 3 +++ scripts/setup | 2 +- scripts/setup-tiny | 14 ++++++++++---- 7 files changed, 44 insertions(+), 15 deletions(-) diff --git a/build b/build index f269bf9..59290e3 100755 --- a/build +++ b/build @@ -185,7 +185,10 @@ def install_qemu_firmware(): log.error('STDERR:\n%s', err.decode('utf8')) sys.exit(1) - os.symlink(bin, os.path.join(firm_dir, f"uefi-{arch}.bin")) + firm_bin = os.path.join(firm_dir, f"uefi-{arch}.bin") + os.symlink(bin, firm_bin) + log.info('Padding "%s" to 67108864 bytes', firm_bin) + subprocess.run(['truncate', '-s', '67108864', firm_bin]) ### Command Line & Logging diff --git a/configs/alpine.conf b/configs/alpine.conf index 81606c6..6b44962 100644 --- a/configs/alpine.conf +++ b/configs/alpine.conf @@ -23,8 +23,8 @@ Default { "See ." version_notes = "Release Notes:\n"\ - "* " - release_notes = "* " + release_notes = "* " } # initial provisioning script and data directory diff --git a/configs/bootstrap/cloudinit.conf b/configs/bootstrap/cloudinit.conf index 19f2bd7..bd35331 100644 --- a/configs/bootstrap/cloudinit.conf +++ b/configs/bootstrap/cloudinit.conf @@ -1,6 +1,9 @@ # vim: ts=2 et: name = [cloudinit] +# start cloudinit images with 3.15 +EXCLUDE = ["3.12", "3.13", "3.14"] + packages { cloud-init = true openssh-server-pam = true diff --git a/configs/bootstrap/tiny.conf b/configs/bootstrap/tiny.conf index 018d424..351ccf8 100644 --- a/configs/bootstrap/tiny.conf +++ b/configs/bootstrap/tiny.conf @@ -1,17 +1,31 @@ # vim: ts=2 et: name = [tiny] -WHEN { - aws.packages.tiny-cloud-aws = true - # azure.packages.tiny-cloud-azure = true - # gcp.packages.tiny-cloud-gcp = true - # oci.packages.tiny-cloud-oci = true -} - services { sysinit.tiny-cloud-early = true default.tiny-cloud = true default.tiny-cloud-final = true } +WHEN { + aws { + packages.tiny-cloud-aws = true + WHEN { + "3.12" { + # tiny-cloud-network requires ifupdown-ng (unavailable in 3.12) + 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 + } + } + } + # azure.packages.tiny-cloud-azure = true + # gcp.packages.tiny-cloud-gcp = true + # oci.packages.tiny-cloud-oci = true +} + scripts = [ setup-tiny ] \ No newline at end of file diff --git a/gen_releases.py b/gen_releases.py index dd9cae2..707242f 100755 --- a/gen_releases.py +++ b/gen_releases.py @@ -93,6 +93,9 @@ yaml = YAML() releases = dictfactory() for i_key, i_cfg in configs.get().items(): + if i_cfg.bootstrap != 'tiny': + continue + release = i_cfg.version if i_cfg.version == 'edge' else i_cfg.release releases[release][i_key][i_cfg.tags.name] = dict(i_cfg.tags) | { 'creation_date': i_cfg.published, diff --git a/scripts/setup b/scripts/setup index 3bd3726..8f00d29 100755 --- a/scripts/setup +++ b/scripts/setup @@ -23,7 +23,7 @@ setup_builder() { setup-apkrepos -1 # main repo via dl-cdn # ODO? also uncomment community repo? # Always use latest versions within the release, security patches etc. - apk upgrade -U --available --no-cache + apk upgrade --no-cache --available apk --no-cache add \ e2fsprogs \ dosfstools \ diff --git a/scripts/setup-tiny b/scripts/setup-tiny index 7081842..9fc91fc 100755 --- a/scripts/setup-tiny +++ b/scripts/setup-tiny @@ -9,7 +9,13 @@ einfo() { printf '\n\033[1;7;36m> %s <\033[0m\n' "$@" >&2 # bold reversed cyan } -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 \ No newline at end of file +if [ "$VERSION" = "3.12" ]; then + # tiny-cloud-network requires ifupdown-ng, not in 3.12 + einfo "Configuring Tiny EC2 Bootstrap..." + 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 +fi