Lots of improvements everywhere

This commit is contained in:
Greg Hellings
2023-08-03 14:44:02 -05:00
parent 0a3832d2c4
commit bb63ff7534
44 changed files with 388 additions and 249 deletions
+10 -11
View File
@@ -1,19 +1,18 @@
%include /tmp/packer_ks/centos-stream/CentOS-8-Stream-x86_64-Vagrant.ks
url --mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=BaseOS&infra=stock
repo --name=AppStream --mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=AppStream&infra=stock
%include /tmp/packer_ks/centos-upstream/CentOS-8-Stream-x86_64-Vagrant.ks
network --bootproto=dhcp --activate
reboot
%pre --interpreter /bin/bash --log /tmp/greg
# This gets us the upstream kickstarter files
cmdline=$(cat /proc/cmdline)
ks=$(printf "${cmdline}" | sed -E -e 's/.*inst\.ks=([^ ]*).*/\1/')
mkdir -p /tmp/packer_ks
cd /tmp/packer_ks
# 3 levels up!
wget -m -nH "$(dirname "$(dirname "$(dirname "${ks}")")")"
set -ex
# This allows us to support virtualbox
mkdir /tmp/sr1
mount /dev/sr1 /tmp/sr1
cp -r /tmp/sr1/http /tmp/packer_ks
if [ ! -e /dev/vda ]; then
sed -i -e 's/drives=vda/drives=sda/' -e 's/ondisk=vda/ondisk=sda/' -e 's/shutdown/reboot/' /tmp/packer_ks/centos-upstream/*
sed -i -e 's/drives=vda/drives=sda/' -e 's/ondisk=vda/ondisk=sda/' /tmp/packer_ks/centos-stream/*
fi
%end
+10 -12
View File
@@ -1,19 +1,17 @@
url --mirrorlist=http://mirrorlist.centos.org/?release=9-stream&arch=x86_64&repo=BaseOS&infra=stock
repo --name=AppStream --mirrorlist=http://mirrorlist.centos.org/?release=9-stream&arch=x86_64&repo=AppStream&infra=stock
%include /tmp/packer_ks/centos-stream/CentOS-9-Stream-x86_64-Vagrant.ks
%pre --interpreter /bin/bash --log /tmp/greg
# This gets us the upstream kickstarter files
cmdline=$(cat /proc/cmdline)
ks=$(printf "${cmdline}" | sed -E -e 's/.*inst\.ks=([^ ]*).*/\1/')
mkdir -p /tmp/packer_ks
cd /tmp/packer_ks
# 3 levels up!
wget -m -nH "$(dirname "$(dirname "${ks}")")"
url --metalink=https://mirrors.centos.org/metalink?arch=x86_64&repo=centos-baseos-9-stream
repo --name=AppStream --metalink=https://mirrors.centos.org/metalink?arch=x86_64&repo=centos-appstream-9-stream
reboot
%pre --interpreter /bin/bash --log /tmp/greg
set -ex
# This allows us to support virtualbox
mkdir /tmp/sr1
mount /dev/sr1 /tmp/sr1
cp -r /tmp/sr1/http /tmp/packer_ks
if [ ! -e /dev/vda ]; then
sed -i -e 's/drives=vda/drives=sda/' -e 's/ondisk=vda/ondisk=sda/' -e 's/shutdown/reboot/' /tmp/packer_ks/centos-stream/*
sed -i -e 's/drives=vda/drives=sda/' -e 's/ondisk=vda/ondisk=sda/' /tmp/packer_ks/centos-stream/*
fi
%end
+58
View File
@@ -0,0 +1,58 @@
d-i debian-installer/locale string en_US
d-i keyboard-configuration/xkb-keymap select us
d-i passwd/root-password-again password vagrant
d-i passwd/root-password password vagrant
d-i passwd/user-fullname string vagrant
d-i passwd/username string vagrant
d-i passwd/user-password password vagrant
d-i passwd/user-password-again password vagrant
d-i time/zone string UTC
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string \
scheme :: \
200 0 200 ext4 \
$primary{ } \
$bootable{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /boot } . \
200% 0 200% linux-swap \
$primary{ } \
method{ swap } \
format{ } . \
1 0 -1 ext4 \
$primary{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } .
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
tasksel tasksel/first multiselect
d-i pkgsel/include string curl openssh-server sudo python3
d-i grub-installer/bootdev string default
d-i finish-install/reboot_in_progress note
d-i preseed/early_command string \
sed -i \
-e "/in-target/i echo 'd() { /sbin/discover \"\$@\" | grep -v virtualbox; }' > /target/etc/discover-pkginstall.conf" \
-e "/in-target/i echo 'discover=d' >> /target/etc/discover-pkginstall.conf" \
/usr/lib/pre-pkgsel.d/20install-hwpackages
d-i preseed/late_command string \
echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant; \
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/vagrant; \
chmod 440 /target/etc/sudoers.d/vagrant
+23
View File
@@ -0,0 +1,23 @@
%include /tmp/packer_ks/fedora/f37/fedora-cloud-base-vagrant.ks
text
%packages
# There is weirdness with the /etc/resolv.conf in the target system
# that causes some of the imported systems to fail. Hopefully this
# prevents that.
-systemd-resolved
NetworkManager
%end
%pre --interpreter /bin/bash --log /tmp/greg
set -ex
# This allows us to support virtualbox
mkdir /tmp/sr1
mount /dev/sr1 /tmp/sr1
cp -r /tmp/sr1/http /tmp/packer_ks
if [ ! -e /dev/vda ]; then
ln -s /dev/sda /dev/vda
fi
%end
+23
View File
@@ -0,0 +1,23 @@
%include /tmp/packer_ks/fedora/f38/fedora-cloud-base-vagrant.ks
text
%packages
# There is weirdness with the /etc/resolv.conf in the target system
# that causes some of the imported systems to fail. Hopefully this
# prevents that.
-systemd-resolved
NetworkManager
%end
%pre --interpreter /bin/bash --log /tmp/greg
set -ex
# This allows us to support virtualbox
mkdir /tmp/sr1
mount /dev/sr1 /tmp/sr1
cp -r /tmp/sr1/http /tmp/packer_ks
if [ ! -e /dev/vda ]; then
ln -s /dev/sda /dev/vda
fi
%end
+1
Submodule http/fedora/f37 added at dc9e3b2cea
+1
Submodule http/fedora/f38 added at 69c726f753
+11 -75
View File
@@ -2,82 +2,19 @@
# vim: set ft=yaml:
autoinstall:
version: 1
apt:
preserve_sources_list: false
primary:
- arches: [i386, amd64]
uri: http://archive.ubuntu.com/ubuntu
- arches: [default]
uri: http://ports.ubuntu.com/ubuntu-ports
geoip: false
network: # Should disable networking, workaround for unattended-updates failing in install
version: 2
ethernets:
eth0:
dhcp4: yes
dhcp6: no
refresh-installer:
update: no
keyboard:
layout: us
variant: ""
toggle: null
storage:
config:
- id: drive
type: disk
ptable: gpt
name: hard-drive
preserve: false
grub_device: true
wipe: superblock
- id: bios-grub
type: partition
device: drive
size: 1M
flag: bios_grub
- id: boot-partition
type: partition
device: drive
size: 1G
name: boot
- id: swap-partition
type: partition
device: drive
size: 10%
name: swap
flag: swap
- id: root-partition
type: partition
device: drive
name: root
size: -1
- id: boot-format
type: format
fstype: ext4
volume: boot-partition
label: boot
preserve: false
- id: swap-format
type: format
fstype: swap
volume: swap-partition
label: swap
preserve: false
- id: root-format
type: format
fstype: ext4
volume: root-partition
label: root
preserve: false
- type: mount
id: root-mount
device: root-format
path: /
- type: mount
id: boot-mount
device: boot-format
path: /boot
- type: mount
id: swap-mount
device: swap-format
path: none
variant: ''
locale: en_US.UTF-8
identity:
hostname: vagrant
username: vagrant
@@ -89,18 +26,17 @@ autoinstall:
allow-pw: yes
user-data:
disable_root: false
package_update: false # These will be done by Ansible after install
package_upgrade: false
late-commands:
- echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant
- echo 'vagrant ALL=(ALL) NOPASSWD:ALL' >> /target/etc/sudoers.d/vagrant
- chmod 440 /target/etc/sudoers.d/vagrant
# Restore network after bypassing unattended updates
- "echo -n 'network:\n version: 2\n ethernets:\n eth0:\n dhcp4: true\n dhcp-identifier: mac' > /target/etc/netplan/00-installer-config.yaml"
- netplan apply
- sed -i -E -e 's/GRUB_CMDLINE_LINUX="(.*)"/GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevnames=0\1"/' /target/etc/default/grub
- mount -o bind /dev /target/dev
- mount -o bind /sys /target/sys
- mount -o bind /proc /target/proc
- chroot /target /usr/sbin/update-grub
- curtin in-target --target=/target -- update-grub
- curtin in-target --target=/target -- logger "finished late-commands"
packages:
- ca-certificates
- curl
- sudo
+12 -66
View File
@@ -4,70 +4,17 @@ autoinstall:
version: 1
network: # Should disable networking, workaround for unattended-updates failing in install
version: 2
ethernets:
eth0:
dhcp4: yes
dhcp6: no
refresh-installer:
update: no
keyboard:
layout: us
storage:
config:
- id: drive
type: disk
ptable: gpt
name: hard-drive
preserve: false
grub_device: true
wipe: superblock
- id: bios-grub
type: partition
device: drive
size: 1M
flag: bios_grub
- id: boot-partition
type: partition
device: drive
size: 1G
name: boot
- id: swap-partition
type: partition
device: drive
size: 10%
name: swap
flag: swap
- id: root-partition
type: partition
device: drive
name: root
size: -1
- id: boot-format
type: format
fstype: ext4
volume: boot-partition
label: boot
preserve: false
- id: swap-format
type: format
fstype: swap
volume: swap-partition
label: swap
preserve: false
- id: root-format
type: format
fstype: ext4
volume: root-partition
label: root
preserve: false
- type: mount
id: root-mount
device: root-format
path: /
- type: mount
id: boot-mount
device: boot-format
path: /boot
- type: mount
id: swap-mount
device: swap-format
path: none
toggle: null
variant: ''
locale: en_US.UTF-8
identity:
hostname: vagrant
username: vagrant
@@ -79,18 +26,17 @@ autoinstall:
allow-pw: yes
user-data:
disable_root: false
package_update: false
package_upgrade: false
late-commands:
- echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant
- echo 'vagrant ALL=(ALL) NOPASSWD:ALL' >> /target/etc/sudoers.d/vagrant
- chmod 440 /target/etc/sudoers.d/vagrant
# Restore network after bypassing unattended updates
- "echo -n 'network:\n version: 2\n ethernets:\n eth0:\n dhcp4: true\n dhcp-identifier: mac' > /target/etc/netplan/00-installer-config.yaml"
- netplan apply
- sed -i -E -e 's/GRUB_CMDLINE_LINUX="(.*)"/GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevnames=0\1"/' /target/etc/default/grub
- mount -o bind /dev /target/dev
- mount -o bind /sys /target/sys
- mount -o bind /proc /target/proc
- chroot /target /usr/sbin/update-grub
- curtin in-target --target=/target -- update-grub
- curtin in-target --target=/target -- logger "finished late-commands"
packages:
- ca-certificates
- curl
- sudo