From 8fb446609079377fa4d422b643eb1434fdb39bb5 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Jan 2024 11:45:17 -0600 Subject: [PATCH 01/29] Add Alpine --- distros/alpine/3.19.0/amd64.pkrvars.hcl | 19 +++++++ distros/alpine/3.19.0/finalize.sh | 2 + distros/alpine/3.19.0/http/answers.cfg.sh | 60 +++++++++++++++++++++++ distros/alpine/3.19.0/http/in-chroot.sh | 49 ++++++++++++++++++ distros/alpine/3.19.0/qemu.sh | 2 + distros/alpine/3.19.0/virtualbox.sh | 2 + distros/alpine/3.19.0/vmware.sh | 4 ++ distros/alpine/supports.yml | 7 +++ scripts/vagrant.sh | 2 +- vagrant/amd64.rb | 1 + 10 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 distros/alpine/3.19.0/amd64.pkrvars.hcl create mode 100644 distros/alpine/3.19.0/finalize.sh create mode 100644 distros/alpine/3.19.0/http/answers.cfg.sh create mode 100644 distros/alpine/3.19.0/http/in-chroot.sh create mode 100644 distros/alpine/3.19.0/qemu.sh create mode 100644 distros/alpine/3.19.0/virtualbox.sh create mode 100644 distros/alpine/3.19.0/vmware.sh create mode 100644 distros/alpine/supports.yml diff --git a/distros/alpine/3.19.0/amd64.pkrvars.hcl b/distros/alpine/3.19.0/amd64.pkrvars.hcl new file mode 100644 index 0000000..5bd7124 --- /dev/null +++ b/distros/alpine/3.19.0/amd64.pkrvars.hcl @@ -0,0 +1,19 @@ +distro = "alpine" +version = "3.19.0" +iso = { + url = "https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-standard-3.19.0-x86_64.iso" + checksum = "4cf7cd3bad64122a8a2423e78369a486a02334d4d88645aab9d08120bb76b0f9" +} +boot_command = [ + "root", + "echo 'iface eth0 inet dhcp' > /etc/network/interfaces", + "ifup eth0", + "wget -O answers.cfg.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/answers.cfg.sh", + "", + "wget -O in-chroot.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/in-chroot.sh", + "", + "/bin/ash ./answers.cfg.sh 2>&1 | tee install.log", +] +http_directory = "distros/alpine/3.19.0/http/" +boot_wait = "20s" +shutdown_command = "sudo poweroff" \ No newline at end of file diff --git a/distros/alpine/3.19.0/finalize.sh b/distros/alpine/3.19.0/finalize.sh new file mode 100644 index 0000000..5a01809 --- /dev/null +++ b/distros/alpine/3.19.0/finalize.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +set -ex \ No newline at end of file diff --git a/distros/alpine/3.19.0/http/answers.cfg.sh b/distros/alpine/3.19.0/http/answers.cfg.sh new file mode 100644 index 0000000..f989671 --- /dev/null +++ b/distros/alpine/3.19.0/http/answers.cfg.sh @@ -0,0 +1,60 @@ +#!/bin/ash + +set -ex -o pipefail + +if [ -e /dev/vda ]; then + disk="/dev/vda" +else + disk="/dev/sda" +fi + +cat << EOF > answers.cfg +KEYMAPOPTS="us us" + +HOSTNAMEOPTS="vagrant" + +DEVDOPTS=mdev + +INTERFACESOPTS="auto lo +iface lo inet loopback + +auto eth0 +iface eth0 inet dhcp +hostname vagrant.local" + +TIMEZONEOPTS="UTC" + +PROXYOPTS="none" + +# Add first CDN mirror +APKREPOSOPTS="-1" + +USEROPTS="-a -u -g audio,video,netdev vagrant" + +SSHDOPTS=openssh + +NTPOPTS=none + +DISKOPTS="-m sys ${disk}" + +LBUOPTS=none + +APKCACHEOPTS=none +EOF + +setup-alpine -e -f answers.cfg -q +yes y | setup-disk -m sys "${disk}" || true +# It isn't setting up disk in initial run, but +# it also can't setup disk before the rest of it +# is setup properly. There might be a better workaround +# but this is what I'm choosing to do +setup-alpine -e -f answers.cfg -q + +mount "${disk}3" /mnt +mount "${disk}1" /mnt/boot + +mv in-chroot.sh /mnt +for fs in proc sys dev sys/firmware/efi/efivars; do mount -o bind /${fs} /mnt/${fs}; done +chroot /mnt /bin/ash /in-chroot.sh +rm /mnt/in-chroot.sh +reboot \ No newline at end of file diff --git a/distros/alpine/3.19.0/http/in-chroot.sh b/distros/alpine/3.19.0/http/in-chroot.sh new file mode 100644 index 0000000..e860a7e --- /dev/null +++ b/distros/alpine/3.19.0/http/in-chroot.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env sh +set -ex -o pipefail + +# Enables packages like "sudo" +sed -i 's/#\(.*\/community\)/\1/' /etc/apk/repositories + +# Install bare minimal packages +apk add curl efibootmgr openssh sudo virt-what +efibootmgr --bootnext "$(efibootmgr | grep 'Misc' | awk '{print $1}' | sed -E 's/[^0-9]//g')" + +rc-update add sshd default + +# Configure systems +echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant-nopasswd +echo 'Defaults !requiretty' >> /etc/sudoers +sed -i 's/.*UseDNS.*/UseDNS no/' /etc/ssh/sshd_config +cat > /etc/ssh/sshd_config.d/10-vagrant-insecure-rsa-key.conf < Date: Tue, 9 Jan 2024 11:45:34 -0600 Subject: [PATCH 02/29] Tidy up del_box warnings --- del_boxes.xsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/del_boxes.xsh b/del_boxes.xsh index ce0816b..79cb6ed 100755 --- a/del_boxes.xsh +++ b/del_boxes.xsh @@ -2,5 +2,5 @@ virsh -q vol-list default | awk '{print $1}' | xargs -r -L 1 virsh vol-delete --pool default sudo virsh -q vol-list default | awk '{print $1}' | sudo xargs -r -L 1 virsh vol-delete --pool default -vagrant box list | grep virtualbox | awk '{print $1}' | sort -u | xargs -l vagrant box remove --provider virtualbox --force -vagrant box list | grep libvirt | awk '{print $1}' | sort -u | xargs -l vagrant box remove --provider libvirt --force +vagrant box list | grep virtualbox | awk '{print $1}' | sort -u | xargs -r -l vagrant box remove --provider virtualbox --force +vagrant box list | grep libvirt | awk '{print $1}' | sort -u | xargs -r -l vagrant box remove --provider libvirt --force From 8ff8fdfac2ca7d6afd1c967eefc2e14a6ced2d1d Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Jan 2024 15:19:06 -0600 Subject: [PATCH 03/29] Add OpenSuSE Leap 15.5 --- distros/opensuse/15.5/amd64.pkrvars.hcl | 13 +++ distros/opensuse/15.5/finalize.sh | 4 + distros/opensuse/15.5/http/autoinst.xml | 125 ++++++++++++++++++++++++ distros/opensuse/15.5/qemu.sh | 6 ++ distros/opensuse/15.5/virtualbox.sh | 2 + distros/opensuse/15.5/vmware.sh | 2 + distros/opensuse/supports.yml | 9 ++ 7 files changed, 161 insertions(+) create mode 100644 distros/opensuse/15.5/amd64.pkrvars.hcl create mode 100644 distros/opensuse/15.5/finalize.sh create mode 100644 distros/opensuse/15.5/http/autoinst.xml create mode 100644 distros/opensuse/15.5/qemu.sh create mode 100644 distros/opensuse/15.5/virtualbox.sh create mode 100644 distros/opensuse/15.5/vmware.sh create mode 100644 distros/opensuse/supports.yml diff --git a/distros/opensuse/15.5/amd64.pkrvars.hcl b/distros/opensuse/15.5/amd64.pkrvars.hcl new file mode 100644 index 0000000..0ee1fab --- /dev/null +++ b/distros/opensuse/15.5/amd64.pkrvars.hcl @@ -0,0 +1,13 @@ +distro = "opensuse" +version = "15.5" +iso = { + url = "https://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-NET-x86_64-Media.iso" + checksum = "a2f7f2f1b6b3d3ef96f5c8f804d87ebd01e5cf982357c533f4c39c33cd20ec56" +} +boot_command = [ + "e", + "", + " autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinst.xml textmode=1", + "x" +] +http_directory = "distros/opensuse/15.5/http/" diff --git a/distros/opensuse/15.5/finalize.sh b/distros/opensuse/15.5/finalize.sh new file mode 100644 index 0000000..b29f91f --- /dev/null +++ b/distros/opensuse/15.5/finalize.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +zypper clean -a \ No newline at end of file diff --git a/distros/opensuse/15.5/http/autoinst.xml b/distros/opensuse/15.5/http/autoinst.xml new file mode 100644 index 0000000..65753c6 --- /dev/null +++ b/distros/opensuse/15.5/http/autoinst.xml @@ -0,0 +1,125 @@ + + + + + + + false + true + + + + + wheel + vagrant + + + vagrant + vagrant + + + + true + external + + + public + + eth0 + + + ssh + + + + + + + all + + + /boot + 512MiB + + + / + max + + + + + + en_US + + + network_manager + + + + + sshd + + + + + + openssh + sudo + + true + false + + + UTC + UTC + + + + root + vagrant + false + + + vagrant + vagrant + false + + + + + + + + + + /etc/sudoers.d/vagrant + + + + 440 + root + + + /home/vagrant/.ssh/authorized_keys + 600 + vagrant + https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub + + + \ No newline at end of file diff --git a/distros/opensuse/15.5/qemu.sh b/distros/opensuse/15.5/qemu.sh new file mode 100644 index 0000000..8bc20c1 --- /dev/null +++ b/distros/opensuse/15.5/qemu.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -ex + +zypper install -y qemu-guest-agent +systemctl start qemu-guest-agent +systemctl enable qemu-guest-agent diff --git a/distros/opensuse/15.5/virtualbox.sh b/distros/opensuse/15.5/virtualbox.sh new file mode 100644 index 0000000..087d718 --- /dev/null +++ b/distros/opensuse/15.5/virtualbox.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -ex \ No newline at end of file diff --git a/distros/opensuse/15.5/vmware.sh b/distros/opensuse/15.5/vmware.sh new file mode 100644 index 0000000..4cfad53 --- /dev/null +++ b/distros/opensuse/15.5/vmware.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -ex diff --git a/distros/opensuse/supports.yml b/distros/opensuse/supports.yml new file mode 100644 index 0000000..88d59b1 --- /dev/null +++ b/distros/opensuse/supports.yml @@ -0,0 +1,9 @@ +15.5: + - arch: amd64 + provider: qemu + - arch: amd64 + provider: virtualbox-iso + - arch: amd64 + provider: vmware-iso + - arch: amd64 + provider: hyperv-iso \ No newline at end of file From 3f12d679c1c0a395a19649702d41470654f533b6 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Jan 2024 16:47:46 -0600 Subject: [PATCH 04/29] Add OpenSuSE Tumbleweed --- .gitignore | 1 + distros/opensuse/supports.yml | 5 +- .../opensuse/tumbleweed/amd64.pkrvars.hcl.sh | 34 +++++ distros/opensuse/tumbleweed/finalize.sh | 4 + distros/opensuse/tumbleweed/http/autoinst.xml | 123 ++++++++++++++++++ distros/opensuse/tumbleweed/qemu.sh | 6 + distros/opensuse/tumbleweed/virtualbox.sh | 2 + distros/opensuse/tumbleweed/vmware.sh | 2 + 8 files changed, 175 insertions(+), 2 deletions(-) create mode 100755 distros/opensuse/tumbleweed/amd64.pkrvars.hcl.sh create mode 100644 distros/opensuse/tumbleweed/finalize.sh create mode 100644 distros/opensuse/tumbleweed/http/autoinst.xml create mode 100644 distros/opensuse/tumbleweed/qemu.sh create mode 100644 distros/opensuse/tumbleweed/virtualbox.sh create mode 100644 distros/opensuse/tumbleweed/vmware.sh diff --git a/.gitignore b/.gitignore index 211b1c5..104b1e3 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ Vagrantfile distros/fedora/rawhide/*.hcl distros/nixos/**/*.hcl distros/centos-stream/**/*.hcl +distros/opensuse/tumbleweed/*.hcl __pycache__ *.pyc diff --git a/distros/opensuse/supports.yml b/distros/opensuse/supports.yml index 88d59b1..db4b95f 100644 --- a/distros/opensuse/supports.yml +++ b/distros/opensuse/supports.yml @@ -1,4 +1,4 @@ -15.5: +15.5: &supp - arch: amd64 provider: qemu - arch: amd64 @@ -6,4 +6,5 @@ - arch: amd64 provider: vmware-iso - arch: amd64 - provider: hyperv-iso \ No newline at end of file + provider: hyperv-iso +tumbleweed: *supp \ No newline at end of file diff --git a/distros/opensuse/tumbleweed/amd64.pkrvars.hcl.sh b/distros/opensuse/tumbleweed/amd64.pkrvars.hcl.sh new file mode 100755 index 0000000..3d8110e --- /dev/null +++ b/distros/opensuse/tumbleweed/amd64.pkrvars.hcl.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +name="${0%.sh}" + +base="https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso" + +# Working directory +tmp="$(mktemp -d)" +checksums="${tmp}/checksums" + +# Read the SHA256 sum value +sums="${base}.sha256" +until curl -f -L -o "${checksums}" "${sums}"; do + sleep 1 +done +sha="$(cut -d' ' -f 1 "${checksums}")" + +cat << EOF > "${name}" +distro = "opensuse" +version = "tumbleweed" +iso = { + url = "${base}" + checksum = "${sha}" +} +boot_command = [ + "e", + "", + " autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinst.xml textmode=1", + "x" +] +http_directory = "distros/opensuse/tumbleweed/http/" +EOF + +rm -r "${tmp}" \ No newline at end of file diff --git a/distros/opensuse/tumbleweed/finalize.sh b/distros/opensuse/tumbleweed/finalize.sh new file mode 100644 index 0000000..b29f91f --- /dev/null +++ b/distros/opensuse/tumbleweed/finalize.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +zypper clean -a \ No newline at end of file diff --git a/distros/opensuse/tumbleweed/http/autoinst.xml b/distros/opensuse/tumbleweed/http/autoinst.xml new file mode 100644 index 0000000..68f4eec --- /dev/null +++ b/distros/opensuse/tumbleweed/http/autoinst.xml @@ -0,0 +1,123 @@ + + + + + + + false + true + + + + + wheel + vagrant + + + + true + external + + + public + + eth0 + + + ssh + + + + + + + all + + + /boot + 512MiB + + + / + max + + + + + + en_US + + + network_manager + + + + + sshd + + + + + + openssh + sudo + + true + false + + openSUSE + + + + UTC + UTC + + + + root + vagrant + false + + + vagrant + vagrant + false + + + + + + + + + + /etc/sudoers.d/vagrant + + + + 440 + root + + + /home/vagrant/.ssh/authorized_keys + 600 + vagrant + https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub + + + \ No newline at end of file diff --git a/distros/opensuse/tumbleweed/qemu.sh b/distros/opensuse/tumbleweed/qemu.sh new file mode 100644 index 0000000..8bc20c1 --- /dev/null +++ b/distros/opensuse/tumbleweed/qemu.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -ex + +zypper install -y qemu-guest-agent +systemctl start qemu-guest-agent +systemctl enable qemu-guest-agent diff --git a/distros/opensuse/tumbleweed/virtualbox.sh b/distros/opensuse/tumbleweed/virtualbox.sh new file mode 100644 index 0000000..087d718 --- /dev/null +++ b/distros/opensuse/tumbleweed/virtualbox.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -ex \ No newline at end of file diff --git a/distros/opensuse/tumbleweed/vmware.sh b/distros/opensuse/tumbleweed/vmware.sh new file mode 100644 index 0000000..4cfad53 --- /dev/null +++ b/distros/opensuse/tumbleweed/vmware.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -ex From c7362f94f8fa92ee08fea6eba61248b259ae83a5 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Jan 2024 16:50:14 -0600 Subject: [PATCH 05/29] Mark off new distros in TODO --- TODO.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TODO.txt b/TODO.txt index e1c2995..e34a690 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,8 +1,8 @@ Distros: * Arch -- Done * NixOS -- Done -* Alpine -* SuSE +* Alpine -- Done +* SuSE -- Done * PopOS * Mint * Rocky From c2b661c8bfd2122789af963d75da33e9c1e93a12 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Jan 2024 17:55:22 -0600 Subject: [PATCH 06/29] Add Rocky support --- TODO.txt | 2 +- distros/rockylinux/8/amd64.pkrvars.hcl | 13 ++ distros/rockylinux/8/disc/ks.cfg | 158 +++++++++++++++++++++++++ distros/rockylinux/8/finalize.sh | 4 + distros/rockylinux/8/qemu.sh | 6 + distros/rockylinux/8/virtualbox.sh | 9 ++ distros/rockylinux/8/vmware.sh | 4 + distros/rockylinux/9/amd64.pkrvars.hcl | 13 ++ distros/rockylinux/9/disc/ks.cfg | 155 ++++++++++++++++++++++++ distros/rockylinux/9/finalize.sh | 4 + distros/rockylinux/9/qemu.sh | 6 + distros/rockylinux/9/virtualbox.sh | 9 ++ distros/rockylinux/9/vmware.sh | 4 + distros/rockylinux/supports.yml | 10 ++ 14 files changed, 396 insertions(+), 1 deletion(-) create mode 100644 distros/rockylinux/8/amd64.pkrvars.hcl create mode 100644 distros/rockylinux/8/disc/ks.cfg create mode 100644 distros/rockylinux/8/finalize.sh create mode 100644 distros/rockylinux/8/qemu.sh create mode 100644 distros/rockylinux/8/virtualbox.sh create mode 100644 distros/rockylinux/8/vmware.sh create mode 100644 distros/rockylinux/9/amd64.pkrvars.hcl create mode 100644 distros/rockylinux/9/disc/ks.cfg create mode 100644 distros/rockylinux/9/finalize.sh create mode 100644 distros/rockylinux/9/qemu.sh create mode 100644 distros/rockylinux/9/virtualbox.sh create mode 100644 distros/rockylinux/9/vmware.sh create mode 100644 distros/rockylinux/supports.yml diff --git a/TODO.txt b/TODO.txt index e34a690..944f042 100644 --- a/TODO.txt +++ b/TODO.txt @@ -5,7 +5,7 @@ Distros: * SuSE -- Done * PopOS * Mint -* Rocky +* Rocky -- Done * Alma * Oracle * Gentoo diff --git a/distros/rockylinux/8/amd64.pkrvars.hcl b/distros/rockylinux/8/amd64.pkrvars.hcl new file mode 100644 index 0000000..9845b21 --- /dev/null +++ b/distros/rockylinux/8/amd64.pkrvars.hcl @@ -0,0 +1,13 @@ +distro = "rockylinux" +version = "8" +iso = { + url = "http://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.3-x86_64-boot.iso" + checksum = "eb096f0518e310f722d5ebd4c69f0322df4fc152c6189f93c5c797dc25f3d2e1" +} +boot_command = [ + "e", + "", + " inst.text inst.ks=cdrom:/ks.cfg", + "x" +] +cd_files = [ "distros/rockylinux/9/disc/*" ] diff --git a/distros/rockylinux/8/disc/ks.cfg b/distros/rockylinux/8/disc/ks.cfg new file mode 100644 index 0000000..8e17c57 --- /dev/null +++ b/distros/rockylinux/8/disc/ks.cfg @@ -0,0 +1,158 @@ +url --mirrorlist=http://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=rocky-BaseOS-$releasever +repo --name=AppStream --mirrorlist=http://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=rocky-AppStream-$releasever +network --bootproto=dhcp --activate +reboot + +text +keyboard --vckeymap us +lang en_US +skipx +rootpw --plaintext vagrant +firewall --disabled +timezone --utc UTC +services --enabled=vmtoolsd +# The biosdevname and ifnames options ensure we get "eth0" as our interface +# even in environments like virtualbox that emulate a real NW card +bootloader --timeout=1 --append="no_timer_check console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 elevator=noop" +zerombr +clearpart --all +autopart --type=plain + +user --name=vagrant --plaintext --password=vagrant + +%packages --instLangs=en +bash-completion +man-pages +bzip2 +rsync +nfs-utils +cifs-utils +chrony +yum-utils +hyperv-daemons +open-vm-tools +# Vagrant boxes aren't normally visible, no need for Plymouth +-plymouth +# Microcode updates cannot work in a VM +-microcode_ctl +# Firmware packages are not needed in a VM +-iwl100-firmware +-iwl1000-firmware +-iwl105-firmware +-iwl135-firmware +-iwl2000-firmware +-iwl2030-firmware +-iwl3160-firmware +-iwl3945-firmware +-iwl4965-firmware +-iwl5000-firmware +-iwl5150-firmware +-iwl6000-firmware +-iwl6000g2a-firmware +-iwl6050-firmware +-iwl7260-firmware +# Don't build rescue initramfs +-dracut-config-rescue +%end + +# kdump needs to reserve 160MB + 2bits/4kB RAM, and automatic allocation only +# works on systems with at least 2GB RAM (which excludes most Vagrant boxes) +# CBS doesn't support %addon yet https://bugs.centos.org/view.php?id=12169 +%addon com_redhat_kdump --disable +%end + +%post --erroronfail +dnf update -y + +# configure swap to a file +fallocate -l 2G /swapfile +chmod 600 /swapfile +mkswap /swapfile +echo "/swapfile none swap defaults 0 0" >> /etc/fstab + +# sudo +echo "%vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant +chmod 0440 /etc/sudoers.d/vagrant + +# Fix for https://github.com/CentOS/sig-cloud-instance-build/issues/38 +cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF +DEVICE="eth0" +BOOTPROTO="dhcp" +ONBOOT="yes" +TYPE="Ethernet" +PERSISTENT_DHCLIENT="yes" +EOF + +# sshd: disable password authentication and DNS checks +ex -s /etc/ssh/sshd_config <>/etc/sysconfig/sshd <> /etc/ssh/sshd_config + +# Decrease connection time by preventing reverse DNS lookups +# (see https://lists.centos.org/pipermail/centos-devel/2016-July/014981.html +# and man sshd for more information) +OPTIONS="-u0" +EOF + +# Fix for issue #76, regular users can gain admin privileges via su +ex -s /etc/pam.d/su <<'EOF' +# allow vagrant to use su, but prevent others from becoming root or vagrant +/^account\s\+sufficient\s\+pam_succeed_if.so uid = 0 use_uid quiet$/ +:append +account [success=1 default=ignore] \\ + pam_succeed_if.so user = vagrant use_uid quiet +account required pam_succeed_if.so user notin root:vagrant +. +:update +:quit +EOF + +# systemd should generate a new machine id during the first boot, to +# avoid having multiple Vagrant instances with the same id in the local +# network. /etc/machine-id should be empty, but it must exist to prevent +# boot errors (e.g. systemd-journald failing to start). +:>/etc/machine-id + +echo 'vag' > /etc/yum/vars/infra + +# Blacklist the floppy module to avoid probing timeouts +echo blacklist floppy > /etc/modprobe.d/nofloppy.conf +chcon -u system_u -r object_r -t modules_conf_t /etc/modprobe.d/nofloppy.conf + +# Customize the initramfs +pushd /etc/dracut.conf.d +# Enable VMware PVSCSI support for VMware Fusion guests. +echo 'add_drivers+=" vmw_pvscsi "' > vmware-fusion-drivers.conf +echo 'add_drivers+=" hv_netvsc hv_storvsc hv_utils hv_vmbus hid-hyperv "' > hyperv-drivers.conf +# There's no floppy controller, but probing for it generates timeouts +echo 'omit_drivers+=" floppy "' > nofloppy.conf +popd +# Fix the SELinux context of the new files +restorecon -f - <&1 | tee /root/vbox_addon_install.log +umount /mnt +rm /home/vagrant/VBoxGuestAdditions.iso diff --git a/distros/rockylinux/8/vmware.sh b/distros/rockylinux/8/vmware.sh new file mode 100644 index 0000000..058afc2 --- /dev/null +++ b/distros/rockylinux/8/vmware.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +dnf install -y open-vm-tools diff --git a/distros/rockylinux/9/amd64.pkrvars.hcl b/distros/rockylinux/9/amd64.pkrvars.hcl new file mode 100644 index 0000000..0a9ccea --- /dev/null +++ b/distros/rockylinux/9/amd64.pkrvars.hcl @@ -0,0 +1,13 @@ +distro = "rockylinux" +version = "9" +iso = { + url = "http://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.3-x86_64-boot.iso" + checksum = "eb096f0518e310f722d5ebd4c69f0322df4fc152c6189f93c5c797dc25f3d2e1" +} +boot_command = [ + "e", + "", + " inst.text inst.ks=cdrom:/ks.cfg", + "x" +] +cd_files = [ "distros/rockylinux/9/disc/*" ] diff --git a/distros/rockylinux/9/disc/ks.cfg b/distros/rockylinux/9/disc/ks.cfg new file mode 100644 index 0000000..74978d4 --- /dev/null +++ b/distros/rockylinux/9/disc/ks.cfg @@ -0,0 +1,155 @@ +url --mirrorlist=http://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=rocky-BaseOS-$releasever +repo --name=AppStream --mirrorlist=http://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=rocky-AppStream-$releasever +network --bootproto=dhcp --activate +reboot + +text +keyboard --vckeymap us +lang en_US +skipx +rootpw --plaintext vagrant +firewall --disabled +timezone --utc UTC +services --enabled=vmtoolsd +# The biosdevname and ifnames options ensure we get "eth0" as our interface +# even in environments like virtualbox that emulate a real NW card +bootloader --timeout=1 --append="no_timer_check console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 elevator=noop" +clearpart --all +autopart --type=plain +zerombr + +user --name=vagrant --plaintext --password=vagrant + +%packages --inst-langs=en +bash-completion +man-pages +bzip2 +rsync +nfs-utils +cifs-utils +chrony +yum-utils +hyperv-daemons +open-vm-tools +# Vagrant boxes aren't normally visible, no need for Plymouth +-plymouth +# Microcode updates cannot work in a VM +-microcode_ctl +# Firmware packages are not needed in a VM +-iwl100-firmware +-iwl1000-firmware +-iwl105-firmware +-iwl135-firmware +-iwl2000-firmware +-iwl2030-firmware +-iwl3160-firmware +-iwl3945-firmware +-iwl4965-firmware +-iwl5000-firmware +-iwl5150-firmware +-iwl6000-firmware +-iwl6000g2a-firmware +-iwl6050-firmware +-iwl7260-firmware +# Don't build rescue initramfs +-dracut-config-rescue +%end + +# kdump needs to reserve 160MB + 2bits/4kB RAM, and automatic allocation only +# works on systems with at least 2GB RAM (which excludes most Vagrant boxes) +# CBS doesn't support %addon yet https://bugs.centos.org/view.php?id=12169 +%addon com_redhat_kdump --disable +%end + +%post --erroronfail +dnf update -y + +# configure swap to a file +fallocate -l 2G /swapfile +chmod 600 /swapfile +mkswap /swapfile +echo "/swapfile none swap defaults 0 0" >> /etc/fstab + +# sudo +echo "%vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant +chmod 0440 /etc/sudoers.d/vagrant + +# Fix for https://github.com/CentOS/sig-cloud-instance-build/issues/38 +cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF +DEVICE="eth0" +BOOTPROTO="dhcp" +ONBOOT="yes" +TYPE="Ethernet" +PERSISTENT_DHCLIENT="yes" +EOF + +# sshd: disable password authentication and DNS checks +ex -s /etc/ssh/sshd_config <>/etc/sysconfig/sshd < /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf +PubkeyAcceptedKeyTypes +ssh-rsa +EOF + +# Fix for issue #76, regular users can gain admin privileges via su +ex -s /etc/pam.d/su <<'EOF' +# allow vagrant to use su, but prevent others from becoming root or vagrant +/^account\s\+sufficient\s\+pam_succeed_if.so uid = 0 use_uid quiet$/ +:append +account [success=1 default=ignore] \ + pam_succeed_if.so user = vagrant use_uid quiet +account required pam_succeed_if.so user notin root:vagrant +. +:update +:quit +EOF + +# systemd should generate a new machine id during the first boot, to +# avoid having multiple Vagrant instances with the same id in the local +# network. /etc/machine-id should be empty, but it must exist to prevent +# boot errors (e.g. systemd-journald failing to start). +:>/etc/machine-id + +echo 'vag' > /etc/yum/vars/infra + +# Blacklist the floppy module to avoid probing timeouts +echo blacklist floppy > /etc/modprobe.d/nofloppy.conf +chcon -u system_u -r object_r -t modules_conf_t /etc/modprobe.d/nofloppy.conf + +# Customize the initramfs +pushd /etc/dracut.conf.d +# Enable VMware PVSCSI support for VMware Fusion guests. +echo 'add_drivers+=" vmw_pvscsi "' > vmware-fusion-drivers.conf +echo 'add_drivers+=" hv_netvsc hv_storvsc hv_utils hv_vmbus hid-hyperv "' > hyperv-drivers.conf +# There's no floppy controller, but probing for it generates timeouts +echo 'omit_drivers+=" floppy "' > nofloppy.conf +popd +# Fix the SELinux context of the new files +restorecon -f - <&1 | tee /root/vbox_addon_install.log +umount /mnt +rm /home/vagrant/VBoxGuestAdditions.iso diff --git a/distros/rockylinux/9/vmware.sh b/distros/rockylinux/9/vmware.sh new file mode 100644 index 0000000..058afc2 --- /dev/null +++ b/distros/rockylinux/9/vmware.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +dnf install -y open-vm-tools diff --git a/distros/rockylinux/supports.yml b/distros/rockylinux/supports.yml new file mode 100644 index 0000000..533b6df --- /dev/null +++ b/distros/rockylinux/supports.yml @@ -0,0 +1,10 @@ +8: &supp + - arch: amd64 + provider: qemu + - arch: amd64 + provider: virtualbox-iso + - arch: amd64 + provider: vmware-iso + - arch: amd64 + provider: hyperv-iso +9: *supp From 4caccc6bcfda2285458b29bb7a32ac316fec156a Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Jan 2024 17:57:49 -0600 Subject: [PATCH 07/29] Added Alma support --- TODO.txt | 4 +- distros/almalinux/8/amd64.pkrvars.hcl | 13 +++ distros/almalinux/8/disc/ks.cfg | 158 +++++++++++++++++++++++++ distros/almalinux/8/finalize.sh | 4 + distros/almalinux/8/qemu.sh | 6 + distros/almalinux/8/virtualbox.sh | 9 ++ distros/almalinux/8/vmware.sh | 4 + distros/almalinux/9/amd64.pkrvars.hcl | 13 +++ distros/almalinux/9/disc/ks.cfg | 161 ++++++++++++++++++++++++++ distros/almalinux/9/finalize.sh | 4 + distros/almalinux/9/qemu.sh | 6 + distros/almalinux/9/virtualbox.sh | 9 ++ distros/almalinux/9/vmware.sh | 4 + distros/almalinux/supports.yml | 10 ++ 14 files changed, 403 insertions(+), 2 deletions(-) create mode 100644 distros/almalinux/8/amd64.pkrvars.hcl create mode 100644 distros/almalinux/8/disc/ks.cfg create mode 100644 distros/almalinux/8/finalize.sh create mode 100644 distros/almalinux/8/qemu.sh create mode 100644 distros/almalinux/8/virtualbox.sh create mode 100644 distros/almalinux/8/vmware.sh create mode 100644 distros/almalinux/9/amd64.pkrvars.hcl create mode 100644 distros/almalinux/9/disc/ks.cfg create mode 100644 distros/almalinux/9/finalize.sh create mode 100644 distros/almalinux/9/qemu.sh create mode 100644 distros/almalinux/9/virtualbox.sh create mode 100644 distros/almalinux/9/vmware.sh create mode 100644 distros/almalinux/supports.yml diff --git a/TODO.txt b/TODO.txt index 944f042..b34fc50 100644 --- a/TODO.txt +++ b/TODO.txt @@ -6,14 +6,14 @@ Distros: * PopOS * Mint * Rocky -- Done -* Alma +* Alma -- Done * Oracle * Gentoo * Elementary OS * Manjaro Providers: -* VMWare -- Done +* VMWare -- Done, but can't seem to automate install * Parallels -- Requires money * Hyper-V -- Done diff --git a/distros/almalinux/8/amd64.pkrvars.hcl b/distros/almalinux/8/amd64.pkrvars.hcl new file mode 100644 index 0000000..379b8d1 --- /dev/null +++ b/distros/almalinux/8/amd64.pkrvars.hcl @@ -0,0 +1,13 @@ +distro = "almalinux" +version = "8" +iso = { + url = "https://mirrors.kernel.org/almalinux/8.9/isos/x86_64/AlmaLinux-8.9-x86_64-boot.iso" + checksum = "ab861d80c8b68634f3c16d414a4141759a082548ad7b251d8924675fa09decab" +} +boot_command = [ + "e", + "", + " inst.text inst.ks=cdrom:/ks.cfg", + "x" +] +cd_files = [ "distros/almalinux/8/disc/*" ] diff --git a/distros/almalinux/8/disc/ks.cfg b/distros/almalinux/8/disc/ks.cfg new file mode 100644 index 0000000..ab98110 --- /dev/null +++ b/distros/almalinux/8/disc/ks.cfg @@ -0,0 +1,158 @@ +url --mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos +repo --name=AppStream --mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream +network --bootproto=dhcp --activate +reboot + +text +keyboard --vckeymap us +lang en_US +skipx +rootpw --plaintext vagrant +firewall --disabled +timezone --utc UTC +services --enabled=vmtoolsd +# The biosdevname and ifnames options ensure we get "eth0" as our interface +# even in environments like virtualbox that emulate a real NW card +bootloader --timeout=1 --append="no_timer_check console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 elevator=noop" +zerombr +clearpart --all +autopart --type=plain + +user --name=vagrant --plaintext --password=vagrant + +%packages --instLangs=en +bash-completion +man-pages +bzip2 +rsync +nfs-utils +cifs-utils +chrony +yum-utils +hyperv-daemons +open-vm-tools +# Vagrant boxes aren't normally visible, no need for Plymouth +-plymouth +# Microcode updates cannot work in a VM +-microcode_ctl +# Firmware packages are not needed in a VM +-iwl100-firmware +-iwl1000-firmware +-iwl105-firmware +-iwl135-firmware +-iwl2000-firmware +-iwl2030-firmware +-iwl3160-firmware +-iwl3945-firmware +-iwl4965-firmware +-iwl5000-firmware +-iwl5150-firmware +-iwl6000-firmware +-iwl6000g2a-firmware +-iwl6050-firmware +-iwl7260-firmware +# Don't build rescue initramfs +-dracut-config-rescue +%end + +# kdump needs to reserve 160MB + 2bits/4kB RAM, and automatic allocation only +# works on systems with at least 2GB RAM (which excludes most Vagrant boxes) +# CBS doesn't support %addon yet https://bugs.centos.org/view.php?id=12169 +%addon com_redhat_kdump --disable +%end + +%post --erroronfail +dnf update -y + +# configure swap to a file +fallocate -l 2G /swapfile +chmod 600 /swapfile +mkswap /swapfile +echo "/swapfile none swap defaults 0 0" >> /etc/fstab + +# sudo +echo "%vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant +chmod 0440 /etc/sudoers.d/vagrant + +# Fix for https://github.com/CentOS/sig-cloud-instance-build/issues/38 +cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF +DEVICE="eth0" +BOOTPROTO="dhcp" +ONBOOT="yes" +TYPE="Ethernet" +PERSISTENT_DHCLIENT="yes" +EOF + +# sshd: disable password authentication and DNS checks +ex -s /etc/ssh/sshd_config <>/etc/sysconfig/sshd <> /etc/ssh/sshd_config + +# Decrease connection time by preventing reverse DNS lookups +# (see https://lists.centos.org/pipermail/centos-devel/2016-July/014981.html +# and man sshd for more information) +OPTIONS="-u0" +EOF + +# Fix for issue #76, regular users can gain admin privileges via su +ex -s /etc/pam.d/su <<'EOF' +# allow vagrant to use su, but prevent others from becoming root or vagrant +/^account\s\+sufficient\s\+pam_succeed_if.so uid = 0 use_uid quiet$/ +:append +account [success=1 default=ignore] \\ + pam_succeed_if.so user = vagrant use_uid quiet +account required pam_succeed_if.so user notin root:vagrant +. +:update +:quit +EOF + +# systemd should generate a new machine id during the first boot, to +# avoid having multiple Vagrant instances with the same id in the local +# network. /etc/machine-id should be empty, but it must exist to prevent +# boot errors (e.g. systemd-journald failing to start). +:>/etc/machine-id + +echo 'vag' > /etc/yum/vars/infra + +# Blacklist the floppy module to avoid probing timeouts +echo blacklist floppy > /etc/modprobe.d/nofloppy.conf +chcon -u system_u -r object_r -t modules_conf_t /etc/modprobe.d/nofloppy.conf + +# Customize the initramfs +pushd /etc/dracut.conf.d +# Enable VMware PVSCSI support for VMware Fusion guests. +echo 'add_drivers+=" vmw_pvscsi "' > vmware-fusion-drivers.conf +echo 'add_drivers+=" hv_netvsc hv_storvsc hv_utils hv_vmbus hid-hyperv "' > hyperv-drivers.conf +# There's no floppy controller, but probing for it generates timeouts +echo 'omit_drivers+=" floppy "' > nofloppy.conf +popd +# Fix the SELinux context of the new files +restorecon -f - <&1 | tee /root/vbox_addon_install.log +umount /mnt +rm /home/vagrant/VBoxGuestAdditions.iso diff --git a/distros/almalinux/8/vmware.sh b/distros/almalinux/8/vmware.sh new file mode 100644 index 0000000..058afc2 --- /dev/null +++ b/distros/almalinux/8/vmware.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +dnf install -y open-vm-tools diff --git a/distros/almalinux/9/amd64.pkrvars.hcl b/distros/almalinux/9/amd64.pkrvars.hcl new file mode 100644 index 0000000..c1b4d1c --- /dev/null +++ b/distros/almalinux/9/amd64.pkrvars.hcl @@ -0,0 +1,13 @@ +distro = "almalinux" +version = "9" +iso = { + url = "https://mirrors.kernel.org/almalinux/9.3/isos/x86_64/AlmaLinux-9.3-x86_64-boot.iso" + checksum = "af5377a1d16bbe599ea91a8761ad645f2f54687075802bdc0c0703ee610182e9" +} +boot_command = [ + "e", + "", + " inst.text inst.ks=cdrom:/ks.cfg", + "x" +] +cd_files = [ "distros/almalinux/9/disc/*" ] diff --git a/distros/almalinux/9/disc/ks.cfg b/distros/almalinux/9/disc/ks.cfg new file mode 100644 index 0000000..043cd64 --- /dev/null +++ b/distros/almalinux/9/disc/ks.cfg @@ -0,0 +1,161 @@ +url --mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos +repo --name=AppStream --mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream +network --bootproto=dhcp --activate +reboot + +text +keyboard --vckeymap us +lang en_US +skipx +rootpw --plaintext vagrant +firewall --disabled +timezone --utc UTC +services --enabled=vmtoolsd +# The biosdevname and ifnames options ensure we get "eth0" as our interface +# even in environments like virtualbox that emulate a real NW card +bootloader --timeout=1 --append="no_timer_check console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 elevator=noop" +clearpart --all +autopart --type=plain +zerombr + +user --name=vagrant --plaintext --password=vagrant + +%packages --inst-langs=en +bash-completion +man-pages +bzip2 +rsync +nfs-utils +cifs-utils +chrony +yum-utils +hyperv-daemons +open-vm-tools +# Vagrant boxes aren't normally visible, no need for Plymouth +-plymouth +# Microcode updates cannot work in a VM +-microcode_ctl +# Firmware packages are not needed in a VM +-iwl100-firmware +-iwl1000-firmware +-iwl105-firmware +-iwl135-firmware +-iwl2000-firmware +-iwl2030-firmware +-iwl3160-firmware +-iwl3945-firmware +-iwl4965-firmware +-iwl5000-firmware +-iwl5150-firmware +-iwl6000-firmware +-iwl6000g2a-firmware +-iwl6050-firmware +-iwl7260-firmware +# Don't build rescue initramfs +-dracut-config-rescue +%end + +# kdump needs to reserve 160MB + 2bits/4kB RAM, and automatic allocation only +# works on systems with at least 2GB RAM (which excludes most Vagrant boxes) +# CBS doesn't support %addon yet https://bugs.centos.org/view.php?id=12169 +%addon com_redhat_kdump --disable +%end + +%post --erroronfail +dnf update -y + +# configure swap to a file +fallocate -l 2G /swapfile +chmod 600 /swapfile +mkswap /swapfile +echo "/swapfile none swap defaults 0 0" >> /etc/fstab + +# sudo +echo "%vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant +chmod 0440 /etc/sudoers.d/vagrant + +# Fix for https://github.com/CentOS/sig-cloud-instance-build/issues/38 +cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF +DEVICE="eth0" +BOOTPROTO="dhcp" +ONBOOT="yes" +TYPE="Ethernet" +PERSISTENT_DHCLIENT="yes" +EOF + +# sshd: disable password authentication and DNS checks +ex -s /etc/ssh/sshd_config <>/etc/sysconfig/sshd < /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf +PubkeyAcceptedKeyTypes +ssh-rsa +EOF + +# Decrease connection time by preventing reverse DNS lookups +# (see https://lists.centos.org/pipermail/centos-devel/2016-July/014981.html +# and man sshd for more information) +OPTIONS="-u0" +EOF + +# Fix for issue #76, regular users can gain admin privileges via su +ex -s /etc/pam.d/su <<'EOF' +# allow vagrant to use su, but prevent others from becoming root or vagrant +/^account\s\+sufficient\s\+pam_succeed_if.so uid = 0 use_uid quiet$/ +:append +account [success=1 default=ignore] \ + pam_succeed_if.so user = vagrant use_uid quiet +account required pam_succeed_if.so user notin root:vagrant +. +:update +:quit +EOF + +# systemd should generate a new machine id during the first boot, to +# avoid having multiple Vagrant instances with the same id in the local +# network. /etc/machine-id should be empty, but it must exist to prevent +# boot errors (e.g. systemd-journald failing to start). +:>/etc/machine-id + +echo 'vag' > /etc/yum/vars/infra + +# Blacklist the floppy module to avoid probing timeouts +echo blacklist floppy > /etc/modprobe.d/nofloppy.conf +chcon -u system_u -r object_r -t modules_conf_t /etc/modprobe.d/nofloppy.conf + +# Customize the initramfs +pushd /etc/dracut.conf.d +# Enable VMware PVSCSI support for VMware Fusion guests. +echo 'add_drivers+=" vmw_pvscsi "' > vmware-fusion-drivers.conf +echo 'add_drivers+=" hv_netvsc hv_storvsc hv_utils hv_vmbus hid-hyperv "' > hyperv-drivers.conf +# There's no floppy controller, but probing for it generates timeouts +echo 'omit_drivers+=" floppy "' > nofloppy.conf +popd +# Fix the SELinux context of the new files +restorecon -f - <&1 | tee /root/vbox_addon_install.log +umount /mnt +rm /home/vagrant/VBoxGuestAdditions.iso diff --git a/distros/almalinux/9/vmware.sh b/distros/almalinux/9/vmware.sh new file mode 100644 index 0000000..058afc2 --- /dev/null +++ b/distros/almalinux/9/vmware.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +dnf install -y open-vm-tools diff --git a/distros/almalinux/supports.yml b/distros/almalinux/supports.yml new file mode 100644 index 0000000..533b6df --- /dev/null +++ b/distros/almalinux/supports.yml @@ -0,0 +1,10 @@ +8: &supp + - arch: amd64 + provider: qemu + - arch: amd64 + provider: virtualbox-iso + - arch: amd64 + provider: vmware-iso + - arch: amd64 + provider: hyperv-iso +9: *supp From 4c92faa254aef8be32950586aa6d4bc411fba659 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Jan 2024 18:00:58 -0600 Subject: [PATCH 08/29] Fix shell lint --- distros/alpine/3.19.0/http/in-chroot.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/distros/alpine/3.19.0/http/in-chroot.sh b/distros/alpine/3.19.0/http/in-chroot.sh index e860a7e..650bbba 100644 --- a/distros/alpine/3.19.0/http/in-chroot.sh +++ b/distros/alpine/3.19.0/http/in-chroot.sh @@ -1,5 +1,5 @@ #!/usr/bin/env sh -set -ex -o pipefail +set -ex # Enables packages like "sudo" sed -i 's/#\(.*\/community\)/\1/' /etc/apk/repositories @@ -35,15 +35,15 @@ virt="$(virt-what)" # "microsoft" == Hyper-V # "oracle" == VirtualBox # "KVM" == KVM/Qemu -if [ "${virt}" == "microsoft" ]; then +if [ "${virt}" = "microsoft" ]; then apk add hvtools rc-update add hv_fcopy_daemon rc-update add hv_kvp_daemon rc-update add hv_vss_daemon -elif [ "${virt}" == "kvm" -o "${virt}" == "qemu" ]; then +elif [ "${virt}" = "kvm" ] || [ "${virt}" = "qemu" ]; then apk add qemu-guest-agent rc-update add qemu-guest-agent -elif [ "${virt}" == "virtualbox" ]; then +elif [ "${virt}" = "virtualbox" ]; then apk add virtualbox-guest-additions rc-update add virtualbox-guest-additions boot fi From 6d76375d54d2dedf146102f587f1f58569ef0e04 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Jan 2024 18:03:54 -0600 Subject: [PATCH 09/29] More shellcheck shenanigans --- distros/alpine/3.19.0/http/answers.cfg.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/distros/alpine/3.19.0/http/answers.cfg.sh b/distros/alpine/3.19.0/http/answers.cfg.sh index f989671..a430023 100644 --- a/distros/alpine/3.19.0/http/answers.cfg.sh +++ b/distros/alpine/3.19.0/http/answers.cfg.sh @@ -1,4 +1,5 @@ #!/bin/ash +# shellcheck shell=dash set -ex -o pipefail From a61c4cb08ca7213ba69a21c00e2df8d944f68b2d Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Jan 2024 21:50:29 -0600 Subject: [PATCH 10/29] Fix Alpine on VirtualBox --- distros/alpine/3.19.0/amd64.pkrvars.hcl | 2 +- distros/alpine/3.19.0/http/in-chroot.sh | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/distros/alpine/3.19.0/amd64.pkrvars.hcl b/distros/alpine/3.19.0/amd64.pkrvars.hcl index 5bd7124..47936c3 100644 --- a/distros/alpine/3.19.0/amd64.pkrvars.hcl +++ b/distros/alpine/3.19.0/amd64.pkrvars.hcl @@ -6,7 +6,7 @@ iso = { } boot_command = [ "root", - "echo 'iface eth0 inet dhcp' > /etc/network/interfaces", + "echo 'iface eth0 inet dhcp' > /etc/network/interfaces", "ifup eth0", "wget -O answers.cfg.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/answers.cfg.sh", "", diff --git a/distros/alpine/3.19.0/http/in-chroot.sh b/distros/alpine/3.19.0/http/in-chroot.sh index 650bbba..0f66e9c 100644 --- a/distros/alpine/3.19.0/http/in-chroot.sh +++ b/distros/alpine/3.19.0/http/in-chroot.sh @@ -6,7 +6,6 @@ sed -i 's/#\(.*\/community\)/\1/' /etc/apk/repositories # Install bare minimal packages apk add curl efibootmgr openssh sudo virt-what -efibootmgr --bootnext "$(efibootmgr | grep 'Misc' | awk '{print $1}' | sed -E 's/[^0-9]//g')" rc-update add sshd default @@ -35,15 +34,24 @@ virt="$(virt-what)" # "microsoft" == Hyper-V # "oracle" == VirtualBox # "KVM" == KVM/Qemu -if [ "${virt}" = "microsoft" ]; then +case "${virt}" in +microsoft) apk add hvtools rc-update add hv_fcopy_daemon rc-update add hv_kvp_daemon rc-update add hv_vss_daemon -elif [ "${virt}" = "kvm" ] || [ "${virt}" = "qemu" ]; then + target="0002" # Placeholder for now + ;; +kvm | qemu) apk add qemu-guest-agent rc-update add qemu-guest-agent -elif [ "${virt}" = "virtualbox" ]; then + target="$(efibootmgr | grep 'Misc' | awk '{print $1}' | sed -E 's/[^0-9]//g')" + ;; +virtualbox*) apk add virtualbox-guest-additions rc-update add virtualbox-guest-additions boot -fi + target="$(efibootmgr | grep 'VBOX HARD' | awk '{print $1}' | sed -E 's/[^0-9]//g')" + ;; +esac + +efibootmgr --bootnext "${target}" \ No newline at end of file From 3aef715e851cccecdca18914616a2569f61445f1 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Jan 2024 22:18:34 -0600 Subject: [PATCH 11/29] Fix opensuse on virtualbox --- distros/opensuse/15.5/amd64.pkrvars.hcl | 2 ++ sources/inputs.pkr.hcl | 5 +++++ sources/virtualbox-iso.pkr.hcl | 6 ++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/distros/opensuse/15.5/amd64.pkrvars.hcl b/distros/opensuse/15.5/amd64.pkrvars.hcl index 0ee1fab..8b80ad3 100644 --- a/distros/opensuse/15.5/amd64.pkrvars.hcl +++ b/distros/opensuse/15.5/amd64.pkrvars.hcl @@ -7,7 +7,9 @@ iso = { boot_command = [ "e", "", + "", " autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinst.xml textmode=1", "x" ] http_directory = "distros/opensuse/15.5/http/" +vbox_os_type = "OpenSUSE_Leap_64" diff --git a/sources/inputs.pkr.hcl b/sources/inputs.pkr.hcl index 68300c4..711ff8e 100644 --- a/sources/inputs.pkr.hcl +++ b/sources/inputs.pkr.hcl @@ -104,6 +104,11 @@ variable "efi_dir" { default = env("EFI_DIR") } +variable "vbox_os_type" { + type = string + default = "Linux_64" +} + locals { name = "${var.distro}-${var.version}" description = templatefile("../README.box.md", { diff --git a/sources/virtualbox-iso.pkr.hcl b/sources/virtualbox-iso.pkr.hcl index eefa28c..efee8c1 100644 --- a/sources/virtualbox-iso.pkr.hcl +++ b/sources/virtualbox-iso.pkr.hcl @@ -19,13 +19,15 @@ source "virtualbox-iso" "amd64" { memory = local.memory headless = var.headless firmware = "efi" - guest_os_type = "Linux_64" + guest_os_type = var.vbox_os_type guest_additions_url = "http://download.virtualbox.org/virtualbox/7.0.10/VBoxGuestAdditions_7.0.10.iso" guest_additions_sha256 = "bbabd89b8fff38a257bab039a278f0c4dc4426eff6e4238c1db01edb7284186a" + nic_type = "virtio" + gfx_vram_size = 128 vboxmanage = [ ["modifyvm", "{{ .Name }}", "--uart1", "0x3F8", "4"], #["modifyvm", "{{ .Name }}", "--uartmode1", "file", "output/vritualbox/serial-${var.arch}-${var.distro}-${var.version}"], - ["modifyvm", "{{ .Name }}", "--nat-localhostreachable1", "on"], + ["modifyvm", "{{ .Name }}", "--nat-localhostreachable1", "on"] ] http_content = var.http_files From 22dfbae9089560cb5c8b8da15601409530f838f6 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Jan 2024 22:31:00 -0600 Subject: [PATCH 12/29] Add VBox Type where available --- distros/almalinux/8/amd64.pkrvars.hcl | 1 + distros/almalinux/9/amd64.pkrvars.hcl | 1 + distros/archlinux/rolling/amd64.pkrvars.hcl | 1 + distros/centos-stream/8/amd64.pkrvars.hcl.sh | 1 + distros/centos-stream/9/amd64.pkrvars.hcl.sh | 1 + distros/centos/7/amd64.pkrvars.hcl | 1 + distros/debian/10/amd64.pkrvars.hcl | 1 + distros/debian/11/amd64.pkrvars.hcl | 1 + distros/debian/12/amd64.pkrvars.hcl | 1 + distros/fedora/37/amd64.pkrvars.hcl | 1 + distros/fedora/38/amd64.pkrvars.hcl | 1 + distros/fedora/39/amd64.pkrvars.hcl | 1 + distros/fedora/rawhide/amd64.pkrvars.hcl.sh | 1 + distros/opensuse/tumbleweed/amd64.pkrvars.hcl.sh | 1 + distros/rockylinux/8/amd64.pkrvars.hcl | 7 ++++--- distros/rockylinux/9/amd64.pkrvars.hcl | 1 + distros/ubuntu/20.04/amd64.pkrvars.hcl | 1 + distros/ubuntu/22.04/amd64.pkrvars.hcl | 1 + distros/ubuntu/23.10/amd64.pkrvars.hcl | 1 + 19 files changed, 22 insertions(+), 3 deletions(-) diff --git a/distros/almalinux/8/amd64.pkrvars.hcl b/distros/almalinux/8/amd64.pkrvars.hcl index 379b8d1..cca8a7f 100644 --- a/distros/almalinux/8/amd64.pkrvars.hcl +++ b/distros/almalinux/8/amd64.pkrvars.hcl @@ -11,3 +11,4 @@ boot_command = [ "x" ] cd_files = [ "distros/almalinux/8/disc/*" ] +vbox_os_type = "RedHat8_64" diff --git a/distros/almalinux/9/amd64.pkrvars.hcl b/distros/almalinux/9/amd64.pkrvars.hcl index c1b4d1c..0aaffa1 100644 --- a/distros/almalinux/9/amd64.pkrvars.hcl +++ b/distros/almalinux/9/amd64.pkrvars.hcl @@ -11,3 +11,4 @@ boot_command = [ "x" ] cd_files = [ "distros/almalinux/9/disc/*" ] +vbox_os_type = "RedHat9_64" diff --git a/distros/archlinux/rolling/amd64.pkrvars.hcl b/distros/archlinux/rolling/amd64.pkrvars.hcl index 25e8188..985084e 100644 --- a/distros/archlinux/rolling/amd64.pkrvars.hcl +++ b/distros/archlinux/rolling/amd64.pkrvars.hcl @@ -13,3 +13,4 @@ boot_command = [ ] http_directory = "distros/archlinux/rolling/http/" boot_wait = "10s" +vbox_os_type = "ArchLinux_64" diff --git a/distros/centos-stream/8/amd64.pkrvars.hcl.sh b/distros/centos-stream/8/amd64.pkrvars.hcl.sh index 28dadf3..5b617f1 100755 --- a/distros/centos-stream/8/amd64.pkrvars.hcl.sh +++ b/distros/centos-stream/8/amd64.pkrvars.hcl.sh @@ -25,4 +25,5 @@ boot_command = [ "x" ] cd_files = [ "distros/centos-stream/8/disc/*" ] +vbox_os_type = "RedHat8_64" HERPDERP diff --git a/distros/centos-stream/9/amd64.pkrvars.hcl.sh b/distros/centos-stream/9/amd64.pkrvars.hcl.sh index 63cdc08..565a37e 100755 --- a/distros/centos-stream/9/amd64.pkrvars.hcl.sh +++ b/distros/centos-stream/9/amd64.pkrvars.hcl.sh @@ -27,4 +27,5 @@ boot_command = [ "x" ] cd_files = [ "distros/centos-stream/9/disc/*" ] +vbox_os_type = "RedHat9_64" HERPDERP \ No newline at end of file diff --git a/distros/centos/7/amd64.pkrvars.hcl b/distros/centos/7/amd64.pkrvars.hcl index f35f2fd..b553bb1 100644 --- a/distros/centos/7/amd64.pkrvars.hcl +++ b/distros/centos/7/amd64.pkrvars.hcl @@ -11,3 +11,4 @@ boot_command = [ "x" ] cd_files = ["distros/centos/7/disc/*"] +vbox_os_type = "RedHat7_64" diff --git a/distros/debian/10/amd64.pkrvars.hcl b/distros/debian/10/amd64.pkrvars.hcl index 8117cce..7a1aeb1 100644 --- a/distros/debian/10/amd64.pkrvars.hcl +++ b/distros/debian/10/amd64.pkrvars.hcl @@ -19,3 +19,4 @@ boot_command = [ "" ] http_directory = "distros/debian/10/http/" +vbox_os_type = "Debian10_64" diff --git a/distros/debian/11/amd64.pkrvars.hcl b/distros/debian/11/amd64.pkrvars.hcl index ecac4dd..6a63922 100644 --- a/distros/debian/11/amd64.pkrvars.hcl +++ b/distros/debian/11/amd64.pkrvars.hcl @@ -19,3 +19,4 @@ boot_command = [ "" ] http_directory = "distros/debian/11/http/" +vbox_os_type = "Debian11_64" diff --git a/distros/debian/12/amd64.pkrvars.hcl b/distros/debian/12/amd64.pkrvars.hcl index 8cf1a0e..20fdd16 100644 --- a/distros/debian/12/amd64.pkrvars.hcl +++ b/distros/debian/12/amd64.pkrvars.hcl @@ -19,3 +19,4 @@ boot_command = [ "" ] http_directory = "distros/debian/12/http/" +vbox_os_type = "Debian12_64" diff --git a/distros/fedora/37/amd64.pkrvars.hcl b/distros/fedora/37/amd64.pkrvars.hcl index 2be02d2..c220338 100644 --- a/distros/fedora/37/amd64.pkrvars.hcl +++ b/distros/fedora/37/amd64.pkrvars.hcl @@ -11,3 +11,4 @@ boot_command = [ cd_files = [ "distros/fedora/37/*.cfg" ] +vbox_os_type = "Fedora_64" diff --git a/distros/fedora/38/amd64.pkrvars.hcl b/distros/fedora/38/amd64.pkrvars.hcl index 78b1318..8d83d4a 100644 --- a/distros/fedora/38/amd64.pkrvars.hcl +++ b/distros/fedora/38/amd64.pkrvars.hcl @@ -11,3 +11,4 @@ boot_command = [ cd_files = [ "distros/fedora/38/*.cfg" ] +vbox_os_type = "Fedora_64" diff --git a/distros/fedora/39/amd64.pkrvars.hcl b/distros/fedora/39/amd64.pkrvars.hcl index 75d2dfe..2a25ab1 100644 --- a/distros/fedora/39/amd64.pkrvars.hcl +++ b/distros/fedora/39/amd64.pkrvars.hcl @@ -11,3 +11,4 @@ boot_command = [ cd_files = [ "distros/fedora/39/*.cfg" ] +vbox_os_type = "Fedora_64" diff --git a/distros/fedora/rawhide/amd64.pkrvars.hcl.sh b/distros/fedora/rawhide/amd64.pkrvars.hcl.sh index ffb98f5..874b969 100755 --- a/distros/fedora/rawhide/amd64.pkrvars.hcl.sh +++ b/distros/fedora/rawhide/amd64.pkrvars.hcl.sh @@ -40,6 +40,7 @@ boot_command = [ cd_files = [ "distros/fedora/rawhide/*.cfg" ] +vbox_os_type = "Fedora_64" EOF rm -r "${tmp}" diff --git a/distros/opensuse/tumbleweed/amd64.pkrvars.hcl.sh b/distros/opensuse/tumbleweed/amd64.pkrvars.hcl.sh index 3d8110e..a9b1640 100755 --- a/distros/opensuse/tumbleweed/amd64.pkrvars.hcl.sh +++ b/distros/opensuse/tumbleweed/amd64.pkrvars.hcl.sh @@ -29,6 +29,7 @@ boot_command = [ "x" ] http_directory = "distros/opensuse/tumbleweed/http/" +vbox_os_type = "OpenSUSE_Tumbleweed_64" EOF rm -r "${tmp}" \ No newline at end of file diff --git a/distros/rockylinux/8/amd64.pkrvars.hcl b/distros/rockylinux/8/amd64.pkrvars.hcl index 9845b21..12688a4 100644 --- a/distros/rockylinux/8/amd64.pkrvars.hcl +++ b/distros/rockylinux/8/amd64.pkrvars.hcl @@ -1,8 +1,8 @@ distro = "rockylinux" version = "8" iso = { - url = "http://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.3-x86_64-boot.iso" - checksum = "eb096f0518e310f722d5ebd4c69f0322df4fc152c6189f93c5c797dc25f3d2e1" + url = "https://download.rockylinux.org/pub/rocky/8/isos/x86_64/Rocky-8.9-x86_64-boot.iso" + checksum = "88baefca6f0e78b53613773954e0d7c2d8d28ad863f40623db75c40f505b5105" } boot_command = [ "e", @@ -10,4 +10,5 @@ boot_command = [ " inst.text inst.ks=cdrom:/ks.cfg", "x" ] -cd_files = [ "distros/rockylinux/9/disc/*" ] +cd_files = [ "distros/rockylinux/8/disc/*" ] +vbox_os_type = "RedHat8_64" diff --git a/distros/rockylinux/9/amd64.pkrvars.hcl b/distros/rockylinux/9/amd64.pkrvars.hcl index 0a9ccea..fd49627 100644 --- a/distros/rockylinux/9/amd64.pkrvars.hcl +++ b/distros/rockylinux/9/amd64.pkrvars.hcl @@ -11,3 +11,4 @@ boot_command = [ "x" ] cd_files = [ "distros/rockylinux/9/disc/*" ] +vbox_os_type = "RedHat9_64" diff --git a/distros/ubuntu/20.04/amd64.pkrvars.hcl b/distros/ubuntu/20.04/amd64.pkrvars.hcl index 0472927..5c49cad 100644 --- a/distros/ubuntu/20.04/amd64.pkrvars.hcl +++ b/distros/ubuntu/20.04/amd64.pkrvars.hcl @@ -17,3 +17,4 @@ boot_command = [ cd_files = [ "distros/ubuntu/20.04/disc/*" ] +vbox_os_type = "Ubuntu20_LTS_64" diff --git a/distros/ubuntu/22.04/amd64.pkrvars.hcl b/distros/ubuntu/22.04/amd64.pkrvars.hcl index a15717d..688b97f 100644 --- a/distros/ubuntu/22.04/amd64.pkrvars.hcl +++ b/distros/ubuntu/22.04/amd64.pkrvars.hcl @@ -17,3 +17,4 @@ boot_command = [ cd_files = [ "distros/ubuntu/22.04/disc/*" ] +vbox_os_type = "Ubuntu22_LTS_64" diff --git a/distros/ubuntu/23.10/amd64.pkrvars.hcl b/distros/ubuntu/23.10/amd64.pkrvars.hcl index 04f1b55..3c8832a 100644 --- a/distros/ubuntu/23.10/amd64.pkrvars.hcl +++ b/distros/ubuntu/23.10/amd64.pkrvars.hcl @@ -17,3 +17,4 @@ boot_command = [ cd_files = [ "distros/ubuntu/23.10/disc/*" ] +vbox_os_type = "Ubuntu23_64" From c5188ca53a9fa93a143091348a10fe590335e9c1 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 Jan 2024 10:18:03 -0600 Subject: [PATCH 13/29] Set boot option for HyperV in Alpine --- distros/alpine/3.19.0/http/in-chroot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distros/alpine/3.19.0/http/in-chroot.sh b/distros/alpine/3.19.0/http/in-chroot.sh index 0f66e9c..4300f7d 100644 --- a/distros/alpine/3.19.0/http/in-chroot.sh +++ b/distros/alpine/3.19.0/http/in-chroot.sh @@ -35,12 +35,12 @@ virt="$(virt-what)" # "oracle" == VirtualBox # "KVM" == KVM/Qemu case "${virt}" in -microsoft) +microsoft | hyperv) apk add hvtools rc-update add hv_fcopy_daemon rc-update add hv_kvp_daemon rc-update add hv_vss_daemon - target="0002" # Placeholder for now + target="0001" # Placeholder for now ;; kvm | qemu) apk add qemu-guest-agent From e1dcfbb4e42789af22d3e2aa40d78571a8fecf89 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 Jan 2024 10:26:07 -0600 Subject: [PATCH 14/29] Try bash on HyperV --- .gitlab-ci-build.yml.in | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index c652e2f..b1e1590 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -79,14 +79,10 @@ hyperv-iso.amd64: tag: hyperv parallel: matrix: [] - script: - - echo $env:COMMAND > build.ps1 - - echo 'if (-not $?) { throw "Error in build"}' >> build.ps1 - - pwsh .\build.ps1 after_script: |- - if ( "$CI_JOB_STATUS" -eq "success" ) { + if [ "$CI_JOB_STATUS" == "success" ]; then xonsh test.xsh - } + fi "Create release": stage: release From fc43e06f6e286f733de0a6a4043c7aa95a46cce5 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 Jan 2024 10:40:44 -0600 Subject: [PATCH 15/29] Try some more pwsh.exe --- .gitlab-ci-build.yml.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index b1e1590..354e05a 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -79,10 +79,14 @@ hyperv-iso.amd64: tag: hyperv parallel: matrix: [] + script: + - echo $env:COMMAND > build.ps1 + - echo 'if (-not $?) { throw "Error in build"}' >> build.ps1 + - pwsh.exe .\build.ps1 after_script: |- - if [ "$CI_JOB_STATUS" == "success" ]; then + if ( "$CI_JOB_STATUS" -eq "success" ) { xonsh test.xsh - fi + } "Create release": stage: release From c1be93a1d51dbdcaccf8b42ab996efc6a06db674 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 Jan 2024 10:43:23 -0600 Subject: [PATCH 16/29] Back to Bash in HyperV --- .gitlab-ci-build.yml.in | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index 354e05a..ccfd898 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -80,13 +80,12 @@ hyperv-iso.amd64: parallel: matrix: [] script: - - echo $env:COMMAND > build.ps1 - - echo 'if (-not $?) { throw "Error in build"}' >> build.ps1 - - pwsh.exe .\build.ps1 + - echo $COMMAND > build.sh + - bash build.sh || exit 1 after_script: |- - if ( "$CI_JOB_STATUS" -eq "success" ) { + if [ "$CI_JOB_STATUS" == "success" ]; then xonsh test.xsh - } + fi "Create release": stage: release From 442c74dd44f04146bd423ca4a21b2e0c67272d97 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 Jan 2024 11:04:23 -0600 Subject: [PATCH 17/29] This *might* fix Hyper-V test issues? --- test.xsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.xsh b/test.xsh index 64c2e5f..7259672 100755 --- a/test.xsh +++ b/test.xsh @@ -72,8 +72,8 @@ def main(): with open("Vagrantfile", "w") as fw: fw.write(content) if not dry_run: - vagrant box add @(box) --name @(p.name) --force if str(p.parent.name) in ["virtualbox", "libvirt", "vmware", "hyperv"]: + vagrant --provider @(p.parent.name) box add @(box) --name @(p.name) --force vagrant up --provider @(p.parent.name) else: print(f"Now whatcha wanna go and do that for? {box}") From cd84ee8d0db0b20cbe14daebb333ecc2f9e8a247 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 Jan 2024 11:37:34 -0600 Subject: [PATCH 18/29] Debugging output --- .gitlab-ci-build.yml.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index ccfd898..6335968 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -80,7 +80,8 @@ hyperv-iso.amd64: parallel: matrix: [] script: - - echo $COMMAND > build.sh + - echo "which packer" > build.sh + - echo $COMMAND >> build.sh - bash build.sh || exit 1 after_script: |- if [ "$CI_JOB_STATUS" == "success" ]; then From 77019f874f3f83ce6d6a65844a04eb8c505645e7 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 Jan 2024 12:11:04 -0600 Subject: [PATCH 19/29] Run command directly? --- .gitlab-ci-build.yml.in | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index 6335968..c69c523 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -46,8 +46,7 @@ stages: - echo $COMMAND script: - export EFI_DIR="$(dirname "$(find /nix/store -name OVMF_VARS.fd | head -1)")/" - - echo $COMMAND > build.sh - - bash build.sh || exit 1 + - $COMMAND || exit 1 qemu.amd64: extends: .build @@ -80,9 +79,7 @@ hyperv-iso.amd64: parallel: matrix: [] script: - - echo "which packer" > build.sh - - echo $COMMAND >> build.sh - - bash build.sh || exit 1 + - $COMMAND || exit 1 after_script: |- if [ "$CI_JOB_STATUS" == "success" ]; then xonsh test.xsh From a1e61cfd71e82ff05ab3907724bd01bfc2dc42d6 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 Jan 2024 12:27:36 -0600 Subject: [PATCH 20/29] Try without quotes, I guess? --- .gitlab-ci-build.yml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index c69c523..4b98190 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -35,7 +35,7 @@ stages: PACKER_LOG: 0 COMMAND: > packer build ${only} - -var-file="${distro}" + -var-file=${distro} -var build=${BUILD} -var cpus=2 -var memory=4096 From 9a38d88ba8098680a91b51c84ea934c8c98bd653 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 Jan 2024 12:29:55 -0600 Subject: [PATCH 21/29] Fix up syntax som more. --- .gitlab-ci-build.yml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index 4b98190..4a4548f 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -74,7 +74,7 @@ hyperv-iso.amd64: extends: .build variables: <<: *variables - only: '-only="hyperv-iso.amd64"' + only: '-only=hyperv-iso.amd64' tag: hyperv parallel: matrix: [] From 6845032db6e2cd3e76992178d7fda7c137af9a70 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 17 Jan 2024 14:49:15 -0600 Subject: [PATCH 22/29] Roll back pwsh changes --- .gitlab-ci-build.yml.in | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index 4a4548f..0db281c 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -35,7 +35,7 @@ stages: PACKER_LOG: 0 COMMAND: > packer build ${only} - -var-file=${distro} + -var-file="${distro}" -var build=${BUILD} -var cpus=2 -var memory=4096 @@ -45,8 +45,9 @@ stages: - packer init sources - echo $COMMAND script: - - export EFI_DIR="$(dirname "$(find /nix/store -name OVMF_VARS.fd | head -1)")/" - - $COMMAND || exit 1 + - export EFI_DIR="$(dirname "$(find / -name OVMF_VARS.fd | head -1)")/" + - echo $COMMAND > build.sh + - bash build.sh || exit 1 qemu.amd64: extends: .build @@ -74,16 +75,18 @@ hyperv-iso.amd64: extends: .build variables: <<: *variables - only: '-only=hyperv-iso.amd64' + only: '-only="hyperv-iso.amd64"' tag: hyperv parallel: matrix: [] script: - - $COMMAND || exit 1 + - echo $env:COMMAND > build.ps1 + - echo 'if (-not $?) { throw "Error in build"}' >> build.ps1 + - pwsh .\build.ps1 after_script: |- - if [ "$CI_JOB_STATUS" == "success" ]; then + if ( "$CI_JOB_STATUS" -eq "success" ) { xonsh test.xsh - fi + } "Create release": stage: release From 8e10b7fc660346e45b8af7f7de656bd4301be505 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 17 Jan 2024 15:02:34 -0600 Subject: [PATCH 23/29] More debugging --- .gitlab-ci-build.yml.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index 0db281c..3495756 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -32,7 +32,7 @@ stages: variables: &variables PACKER_CONFIG_DIR: ./packer_config/ PACKER_CACHE_DIR: ./packer_cache/ - PACKER_LOG: 0 + PACKER_LOG: 1 COMMAND: > packer build ${only} -var-file="${distro}" @@ -45,7 +45,6 @@ stages: - packer init sources - echo $COMMAND script: - - export EFI_DIR="$(dirname "$(find / -name OVMF_VARS.fd | head -1)")/" - echo $COMMAND > build.sh - bash build.sh || exit 1 From 49ef1adc5b1bf923c7d21bbe5f02496197c8a9d2 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 17 Jan 2024 15:09:11 -0600 Subject: [PATCH 24/29] Pin and prune plugins --- sources/build.pkr.hcl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sources/build.pkr.hcl b/sources/build.pkr.hcl index 78d6dbf..653f54f 100644 --- a/sources/build.pkr.hcl +++ b/sources/build.pkr.hcl @@ -2,18 +2,14 @@ packer { required_plugins { qemu = { source = "github.com/hashicorp/qemu" - version = "~> 1" - } - ansible = { - source = "github.com/hashicorp/ansible" - version = "~> 1" + version = "= 1.0.10" } vagrant = { source = "github.com/hashicorp/vagrant" version = "= 1.1.1" } vmware = { - version = ">= 1.0" + version = "= 1.0.11" source = "github.com/hashicorp/vmware" } hyperv = { @@ -22,7 +18,7 @@ packer { } virtualbox = { source = "github.com/hashicorp/virtualbox" - version = "~> 1" + version = "= 1.0.5" } } } From dbfc1ac4d0eb63f61d532ede5d001a25d8636f30 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 2 Apr 2024 23:45:39 -0500 Subject: [PATCH 25/29] Update archlinux version --- distros/archlinux/rolling/amd64.pkrvars.hcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distros/archlinux/rolling/amd64.pkrvars.hcl b/distros/archlinux/rolling/amd64.pkrvars.hcl index 985084e..f9eafd3 100644 --- a/distros/archlinux/rolling/amd64.pkrvars.hcl +++ b/distros/archlinux/rolling/amd64.pkrvars.hcl @@ -1,8 +1,8 @@ distro = "archlinux" version = "rolling" iso = { - url = "http://mirror.rackspace.com/archlinux/iso/2024.01.01/archlinux-2024.01.01-x86_64.iso" - checksum = "12addd7d4154df1caf5f258b80ad72e7a724d33e75e6c2e6adc1475298d47155" + url = "http://mirror.rackspace.com/archlinux/iso/2024.01.01/archlinux-2024.04.01-x86_64.iso" + checksum = "52aea58f88c9a80afe64f0536da868251ef4878de5a5e0227fcada9f132bd7ab" } boot_command = [ "e net.ifnames=0 biosdevnames=0", From 77ed28e7a1c74bf45f6681fcabc8ec4dd970805a Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 3 Apr 2024 00:09:14 -0500 Subject: [PATCH 26/29] Fix path... again --- distros/archlinux/rolling/amd64.pkrvars.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/archlinux/rolling/amd64.pkrvars.hcl b/distros/archlinux/rolling/amd64.pkrvars.hcl index f9eafd3..6c0708c 100644 --- a/distros/archlinux/rolling/amd64.pkrvars.hcl +++ b/distros/archlinux/rolling/amd64.pkrvars.hcl @@ -1,7 +1,7 @@ distro = "archlinux" version = "rolling" iso = { - url = "http://mirror.rackspace.com/archlinux/iso/2024.01.01/archlinux-2024.04.01-x86_64.iso" + url = "http://mirror.rackspace.com/archlinux/iso/2024.04.01/archlinux-2024.04.01-x86_64.iso" checksum = "52aea58f88c9a80afe64f0536da868251ef4878de5a5e0227fcada9f132bd7ab" } boot_command = [ From 8f63f523638561301ae61ff1353a865532dcb7bf Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Thu, 4 Apr 2024 13:32:56 -0500 Subject: [PATCH 27/29] Update u2204 and deb12 URLs --- distros/debian/12/amd64.pkrvars.hcl | 4 ++-- distros/ubuntu/22.04/amd64.pkrvars.hcl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/distros/debian/12/amd64.pkrvars.hcl b/distros/debian/12/amd64.pkrvars.hcl index 20fdd16..d65e049 100644 --- a/distros/debian/12/amd64.pkrvars.hcl +++ b/distros/debian/12/amd64.pkrvars.hcl @@ -1,8 +1,8 @@ distro = "debian" version = "12" iso = { - url = "http://cdimage.debian.org/cdimage/release/12.4.0/amd64/iso-cd/debian-12.4.0-amd64-netinst.iso" - checksum = "64d727dd5785ae5fcfd3ae8ffbede5f40cca96f1580aaa2820e8b99dae989d94" + url = "http://cdimage.debian.org/cdimage/release/12.5.0/amd64/iso-cd/debian-12.5.0-amd64-netinst.iso" + checksum = "013f5b44670d81280b5b1bc02455842b250df2f0c6763398feb69af1a805a14f" } boot_command = [ "e", diff --git a/distros/ubuntu/22.04/amd64.pkrvars.hcl b/distros/ubuntu/22.04/amd64.pkrvars.hcl index 688b97f..96f325b 100644 --- a/distros/ubuntu/22.04/amd64.pkrvars.hcl +++ b/distros/ubuntu/22.04/amd64.pkrvars.hcl @@ -1,8 +1,8 @@ distro = "ubuntu" version = "22.04" iso = { - url = "https://releases.ubuntu.com/22.04/ubuntu-22.04.3-live-server-amd64.iso" - checksum = "a4acfda10b18da50e2ec50ccaf860d7f20b389df8765611142305c0e911d16fd" + url = "https://releases.ubuntu.com/22.04/ubuntu-22.04.4-live-server-amd64.iso" + checksum = "45f873de9f8cb637345d6e66a583762730bbea30277ef7b32c9c3bd6700a32b2" } boot_command = [ "e", From 1f7c092b9444d9037522bf2d98f0c874cb70a7ea Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Thu, 4 Apr 2024 13:33:17 -0500 Subject: [PATCH 28/29] Add openSuSE LEAP 15.6 --- distros/opensuse/15.6/amd64.pkrvars.hcl | 15 +++ distros/opensuse/15.6/finalize.sh | 4 + distros/opensuse/15.6/http/autoinst.xml | 125 ++++++++++++++++++++++++ distros/opensuse/15.6/qemu.sh | 6 ++ distros/opensuse/15.6/virtualbox.sh | 2 + distros/opensuse/15.6/vmware.sh | 2 + distros/opensuse/supports.yml | 5 +- 7 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 distros/opensuse/15.6/amd64.pkrvars.hcl create mode 100644 distros/opensuse/15.6/finalize.sh create mode 100644 distros/opensuse/15.6/http/autoinst.xml create mode 100644 distros/opensuse/15.6/qemu.sh create mode 100644 distros/opensuse/15.6/virtualbox.sh create mode 100644 distros/opensuse/15.6/vmware.sh diff --git a/distros/opensuse/15.6/amd64.pkrvars.hcl b/distros/opensuse/15.6/amd64.pkrvars.hcl new file mode 100644 index 0000000..64a74be --- /dev/null +++ b/distros/opensuse/15.6/amd64.pkrvars.hcl @@ -0,0 +1,15 @@ +distro = "opensuse" +version = "15.6" +iso = { + url = "https://download.opensuse.org/distribution/leap/15.6/iso/openSUSE-Leap-15.6-NET-x86_64-Media.iso" + checksum = "4631636c43297951f1a0a3a2a804e30f4bf1790f892d0f0ac46f62ec82ac2075" +} +boot_command = [ + "e", + "", + "", + " autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinst.xml textmode=1", + "x" +] +http_directory = "distros/opensuse/15.6/http/" +vbox_os_type = "OpenSUSE_Leap_64" diff --git a/distros/opensuse/15.6/finalize.sh b/distros/opensuse/15.6/finalize.sh new file mode 100644 index 0000000..b29f91f --- /dev/null +++ b/distros/opensuse/15.6/finalize.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +zypper clean -a \ No newline at end of file diff --git a/distros/opensuse/15.6/http/autoinst.xml b/distros/opensuse/15.6/http/autoinst.xml new file mode 100644 index 0000000..65753c6 --- /dev/null +++ b/distros/opensuse/15.6/http/autoinst.xml @@ -0,0 +1,125 @@ + + + + + + + false + true + + + + + wheel + vagrant + + + vagrant + vagrant + + + + true + external + + + public + + eth0 + + + ssh + + + + + + + all + + + /boot + 512MiB + + + / + max + + + + + + en_US + + + network_manager + + + + + sshd + + + + + + openssh + sudo + + true + false + + + UTC + UTC + + + + root + vagrant + false + + + vagrant + vagrant + false + + + + + + + + + + /etc/sudoers.d/vagrant + + + + 440 + root + + + /home/vagrant/.ssh/authorized_keys + 600 + vagrant + https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub + + + \ No newline at end of file diff --git a/distros/opensuse/15.6/qemu.sh b/distros/opensuse/15.6/qemu.sh new file mode 100644 index 0000000..8bc20c1 --- /dev/null +++ b/distros/opensuse/15.6/qemu.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -ex + +zypper install -y qemu-guest-agent +systemctl start qemu-guest-agent +systemctl enable qemu-guest-agent diff --git a/distros/opensuse/15.6/virtualbox.sh b/distros/opensuse/15.6/virtualbox.sh new file mode 100644 index 0000000..087d718 --- /dev/null +++ b/distros/opensuse/15.6/virtualbox.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -ex \ No newline at end of file diff --git a/distros/opensuse/15.6/vmware.sh b/distros/opensuse/15.6/vmware.sh new file mode 100644 index 0000000..4cfad53 --- /dev/null +++ b/distros/opensuse/15.6/vmware.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -ex diff --git a/distros/opensuse/supports.yml b/distros/opensuse/supports.yml index db4b95f..a709f30 100644 --- a/distros/opensuse/supports.yml +++ b/distros/opensuse/supports.yml @@ -1,4 +1,4 @@ -15.5: &supp +15.6: &supp - arch: amd64 provider: qemu - arch: amd64 @@ -7,4 +7,5 @@ provider: vmware-iso - arch: amd64 provider: hyperv-iso -tumbleweed: *supp \ No newline at end of file +15.5: *supp +tumbleweed: *supp From f095e26e826d2a05e641e69a4b13d45151bef305 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Thu, 4 Apr 2024 13:33:31 -0500 Subject: [PATCH 29/29] Fix indent --- build.xsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build.xsh b/build.xsh index 152d80a..81919ee 100755 --- a/build.xsh +++ b/build.xsh @@ -47,13 +47,13 @@ def process_distro(distro): process_builds(distro.builds) def process_builds(builds): - for build in builds: - if args.build: - name, arch = args.build.split(".") - if build.provider.name == name and build.provider.arch == arch: - do_build(build) - else: + for build in builds: + if args.build: + name, arch = args.build.split(".") + if build.provider.name == name and build.provider.arch == arch: do_build(build) + else: + do_build(build) def do_build(build): if args.headless: