aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJake Buchholz <tomalok@gmail.com>2019-04-30 21:56:48 -0700
committerJake Buchholz <tomalok@gmail.com>2019-04-30 21:56:48 -0700
commit92dcbe24ef3cbbcdd961f155b3af6bb7623665a8 (patch)
tree82b58db3ed9d9c6fb3bd249dd78afd80c6c30498
parentc8b443e75148a97c926239f2a734a3fcd72b8646 (diff)
downloadalpine-ec2-ami-92dcbe24ef3cbbcdd961f155b3af6bb7623665a8.tar.bz2
alpine-ec2-ami-92dcbe24ef3cbbcdd961f155b3af6bb7623665a8.tar.xz
alpine-ec2-ami-92dcbe24ef3cbbcdd961f155b3af6bb7623665a8.zip
build profiles - feature complete
* setup-ami.sh + fix partitioning + proper path to grub-install + don't forget to umount /boot/efi during cleanup * version/edge - newer kernel trusts CPU for entropy, don't need haveged anmore * test.conf + reduce ami_regions to just us-west-2 + entropy stuff moved to version/edge + adds edge-aarch64 build (though AMI's arch isn't set properly - https://github.com/hashicorp/packer/issues/7358 * alpine-amis.conf - prepend 'r' to revision number
-rw-r--r--profiles/alpine-amis.conf2
-rw-r--r--profiles/test.conf23
-rw-r--r--profiles/version/edge5
-rwxr-xr-xscripts/setup-ami.sh15
4 files changed, 24 insertions, 21 deletions
diff --git a/profiles/alpine-amis.conf b/profiles/alpine-amis.conf
index f5db1b7..a6b9926 100644
--- a/profiles/alpine-amis.conf
+++ b/profiles/alpine-amis.conf
@@ -5,7 +5,7 @@ arch-x86_64 { include "arch/x86_64" }
5 5
6# profile vars 6# profile vars
7alpine-amis { 7alpine-amis {
8 revision = "1" 8 revision = "r1"
9 build_region = "us-west-2" 9 build_region = "us-west-2"
10 build_subnet = "subnet-b80c36e2" 10 build_subnet = "subnet-b80c36e2"
11 ami_access { 11 ami_access {
diff --git a/profiles/test.conf b/profiles/test.conf
index eeec6a5..01d38d6 100644
--- a/profiles/test.conf
+++ b/profiles/test.conf
@@ -3,13 +3,13 @@
3version-current { include "version/current" } 3version-current { include "version/current" }
4version-edge { include "version/edge" } 4version-edge { include "version/edge" }
5arch-x86_64 { include "arch/x86_64" } 5arch-x86_64 { include "arch/x86_64" }
6arch-aarch64 { include "arch/aarch64" }
6 7
7# specific to this profile's builds 8# specific to this profile's builds
8test { 9test {
9 build_region = "us-west-2" 10 build_region = "us-west-2"
10 build_subnet = "subnet-033a30d7b5220d177" 11 build_subnet = "subnet-033a30d7b5220d177"
11 ami_regions { 12 ami_regions {
12 us-east-1 = true
13 us-west-2 = true 13 us-west-2 = true
14 } 14 }
15} 15}
@@ -21,19 +21,12 @@ builds {
21 revision = "test" 21 revision = "test"
22 } 22 }
23 23
24 # merge version, arch, profile, and build vars 24 # merge version, arch, and profile vars (no build-specific vars)
25 edge-x86_64 = ${version-edge} ${arch-x86_64} ${test} { 25 edge-x86_64 = ${version-edge} ${arch-x86_64} ${test}
26 ami_regions { 26
27 us-east-1 = false 27 ### NOTE: aarch64 builds, but won't be launchable, see...
28 } 28 ### https://github.com/hashicorp/packer/issues/7358
29 # try rng-tools instead of haveged 29 edge-aarch64 = ${version-edge} ${arch-aarch64} ${test} {
30 pkgs { 30 build_subnet = "subnet-08dfc622745f7d96a" # other subnet doesn't do a1.* instances
31 haveged = false
32 rng-tools = true
33 }
34 svcs {
35 haveged = false
36 rngd = "boot"
37 }
38 } 31 }
39} 32}
diff --git a/profiles/version/edge b/profiles/version/edge
index 371e7e4..13195fe 100644
--- a/profiles/version/edge
+++ b/profiles/version/edge
@@ -9,9 +9,12 @@ release = "edge"
9end_of_life = "@TODAY@" 9end_of_life = "@TODAY@"
10revision = "@NOW@" 10revision = "@NOW@"
11 11
12repos = null # undo "current" repos 12repos = null # reset hash from 'current'
13repos { 13repos {
14 "http://dl-cdn.alpinelinux.org/alpine/edge/main": true 14 "http://dl-cdn.alpinelinux.org/alpine/edge/main": true
15 "http://dl-cdn.alpinelinux.org/alpine/edge/community": true 15 "http://dl-cdn.alpinelinux.org/alpine/edge/community": true
16 "http://dl-cdn.alpinelinux.org/alpine/edge/testing": true 16 "http://dl-cdn.alpinelinux.org/alpine/edge/testing": true
17} 17}
18# haveged/rngd no longer needed with Alpine kernels >= 4.19.36
19pkgs { haveged = false }
20svcs { haveged = false }
diff --git a/scripts/setup-ami.sh b/scripts/setup-ami.sh
index 72157a5..2c0a1a6 100755
--- a/scripts/setup-ami.sh
+++ b/scripts/setup-ami.sh
@@ -72,10 +72,15 @@ setup_partitions() {
72 *) echo "$start,$line"; start= ;; 72 *) echo "$start,$line"; start= ;;
73 esac 73 esac
74 done 74 done
75 ) | sfdisk --quiet --label $DISKLABEL $diskdev 75 ) | sfdisk --quiet --label dos $diskdev
76 76
77 # create device nodes if not exist 77 # we assume that the build host will create the new devices within 5s
78 mdev -s 78 local tries=5
79 while [ ! -e "${diskdev}1" ]; do
80 [ $tries -eq 0 ] && break || sleep 1
81 tries=$(( $tries - 1 ))
82 done
83 [ -e "${diskdev}1" ] || die "Expected new device ${diskdev}1 not created"
79} 84}
80 85
81make_filesystem() { 86make_filesystem() {
@@ -227,7 +232,7 @@ install_grub_efi() {
227 #mkdir -p "$target"/boot/efi 232 #mkdir -p "$target"/boot/efi
228 233
229 # disable nvram so grub doesn't call efibootmgr 234 # disable nvram so grub doesn't call efibootmgr
230 chroot "$target" /sbin/grub-install --target=$grub_target --efi-directory=/boot/efi \ 235 chroot "$target" /usr/sbin/grub-install --target=$grub_target --efi-directory=/boot/efi \
231 --bootloader-id=alpine --boot-directory=/boot --no-nvram 236 --bootloader-id=alpine --boot-directory=/boot --no-nvram
232 237
233 # fallback mode 238 # fallback mode
@@ -325,6 +330,8 @@ cleanup() {
325 "$target"/root/.ash_history \ 330 "$target"/root/.ash_history \
326 "$target"/etc/*- 331 "$target"/etc/*-
327 332
333 [ "$BOOTLOADER" = 'grub-efi' ] && umount "$target"/boot/efi
334
328 umount \ 335 umount \
329 "$target"/dev \ 336 "$target"/dev \
330 "$target"/proc \ 337 "$target"/proc \