diff --git a/packer.conf b/packer.conf index 08a0d2c..b7ab850 100644 --- a/packer.conf +++ b/packer.conf @@ -80,10 +80,7 @@ provisioners = [ "RELEASE={{user `release`}}" "REVISION={{user `revision`}}" "ARCH={{user `arch`}}" - "APK_TOOLS={{user `apk_tools`}}" - "APK_TOOLS_SHA256={{user `apk_tools_sha256`}}" - "ALPINE_KEYS={{user `alpine_keys`}}" - "ALPINE_KEYS_SHA256={{user `alpine_keys_sha256`}}" + "BOOTLOADER={{user `bootloader`}}" "REPOS={{user `repos`}}" "PKGS={{user `pkgs`}}" "SVCS={{user `svcs`}}" diff --git a/profiles/arch/aarch64-1 b/profiles/arch/aarch64-1 index 2d1acf7..34eb665 100644 --- a/profiles/arch/aarch64-1 +++ b/profiles/arch/aarch64-1 @@ -2,9 +2,6 @@ # vim: ts=2 et: arch = "aarch64" +bootloader = "grub-efi" build_arch = "arm64" build_instance_type = "t4g.nano" -apk_tools = "https://github.com/alpinelinux/apk-tools/releases/download/v2.10.3/apk-tools-2.10.3-aarch64-linux.tar.gz" -apk_tools_sha256 = "58a07e547c83c3a30eb0a0bd73db57d6bbaf92cc093df7a1d9805631f7d349e3" -alpine_keys = "http://dl-cdn.alpinelinux.org/alpine/v3.12/main/aarch64/alpine-keys-2.2-r0.apk" -alpine_keys_sha256 = "94f287d541a03017d37895e46dc43bb62ce2e66ee99bb96b8c3de5c6638d5953" diff --git a/profiles/arch/x86_64-1 b/profiles/arch/x86_64-1 index 2818c17..3deceff 100644 --- a/profiles/arch/x86_64-1 +++ b/profiles/arch/x86_64-1 @@ -2,9 +2,6 @@ # vim: ts=2 et: arch = "x86_64" +bootloader = "syslinux" build_arch = "x86_64" build_instance_type = "t3a.nano" -apk_tools = "https://github.com/alpinelinux/apk-tools/releases/download/v2.10.4/apk-tools-2.10.4-x86_64-linux.tar.gz" -apk_tools_sha256 = "efe948160317fe78058e207554d0d9195a3dfcc35f77df278d30448d7b3eb892" -alpine_keys = "http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/alpine-keys-2.2-r0.apk" -alpine_keys_sha256 = "d75cfd3eb6c863779f4eccb55ab5b6c5a8e47e4538c717fae580d3c47c70574a" diff --git a/profiles/base/1 b/profiles/base/1 index a6a9043..814a6e9 100644 --- a/profiles/base/1 +++ b/profiles/base/1 @@ -34,17 +34,14 @@ ami_desc_prefix = "Alpine Linux " ami_desc_suffix = "" ami_volume_size = "1" ami_encrypt = "false" -ami_user = "alpine" # modification currently not supported +ami_user = "alpine" # NOTE: the following are python format strings, resolved in builder.py ami_name = "{var.ami_name_prefix}{var.release}-{var.arch}-{var.revision}{var.ami_name_suffix}" ami_desc = "{var.ami_desc_prefix}{var.release} {var.arch} {var.revision}{var.ami_desc_suffix}" # AMI configuration -apk_tools = null -apk_tools_sha256 = null -alpine_keys = null -alpine_keys_sha256 = null +bootloader = null repos {} pkgs { linux-virt = true diff --git a/profiles/base/2 b/profiles/base/2 index 6b07ada..0ee84bc 100644 --- a/profiles/base/2 +++ b/profiles/base/2 @@ -41,10 +41,7 @@ ami_name = "{var.ami_name_prefix}{var.release}-{var.arch}-{var.revision}{ ami_desc = "{var.ami_desc_prefix}{var.release} {var.arch} {var.revision}{var.ami_desc_suffix}" # AMI configuration -apk_tools = null -apk_tools_sha256 = null -alpine_keys = null -alpine_keys_sha256 = null +bootloader = null repos {} pkgs { linux-virt = true diff --git a/profiles/test.conf b/profiles/test.conf index 36fd15e..5c0c17a 100644 --- a/profiles/test.conf +++ b/profiles/test.conf @@ -11,6 +11,7 @@ arch-aarch64 { include required("arch/aarch64") } # specific to this profile's builds test { + #bootloader = "EFI_STUB" # currently does not work ami_name_prefix = "test-" ami_desc_prefix = "Alpine Test " ami_user = "test" diff --git a/scripts/setup-ami b/scripts/setup-ami index f7bfdb3..9063021 100755 --- a/scripts/setup-ami +++ b/scripts/setup-ami @@ -7,8 +7,8 @@ DEVICE=/dev/xvdf TARGET=/mnt/target SETUP=/tmp/setup-ami.d -# what bootloader should we use? -[ -d "/sys/firmware/efi" ] && BOOTLOADER=grub-efi || BOOTLOADER=syslinux +[ "$VERSION" = 'edge' ] && V= || V=v +MAIN_REPO="https://dl-cdn.alpinelinux.org/alpine/$V$VERSION/main/$ARCH" die() { printf '\033[1;31mERROR:\033[0m %s\n' "$@" >&2 # bold red @@ -30,15 +30,6 @@ rc_add() { done } -wgets() ( - url="$1" # url to fetch - sha256="$2" # expected SHA256 sum of output - dest="$3" # output path and filename - - wget -T 10 -q -O "$dest" "$url" - echo "$sha256 $dest" | sha256sum -c > /dev/null -) - validate_block_device() { lsblk -P --fs "$DEVICE" >/dev/null 2>&1 || \ die "'$DEVICE' is not a valid block device" @@ -48,14 +39,18 @@ validate_block_device() { fi } +main_repo_pkgs() { + wget -T 10 -q -O - "$MAIN_REPO/" | grep '^> "$TARGET/etc/fstab" fi } @@ -323,7 +351,10 @@ cleanup() { "$TARGET/root/.ash_history" \ "$TARGET/etc/"*- - [ "$BOOTLOADER" = grub-efi ] && umount "$TARGET/boot/efi" + # unmount extra EFI mount + if [ "$BOOTLOADER" = grub-efi ] || [ "$BOOTLOADER" = EFI_STUB ]; then + umount "$TARGET/boot/efi" + fi umount \ "$TARGET/dev" \ @@ -358,7 +389,7 @@ main() { einfo "Installing core packages" install_core_packages - einfo "Configuring and enabling boot loader" + einfo "Configuring and enabling '$BOOTLOADER' boot loader" create_initfs install_bootloader