Add CentOS (#12)

* Add CentOS 7

* Fix rawhide boot

* Test locale versions
This commit is contained in:
Greg Hellings
2022-06-22 10:00:04 -05:00
committed by GitHub
parent 291ebbf82c
commit 0a3832d2c4
34 changed files with 255 additions and 24 deletions
-2
View File
@@ -2,8 +2,6 @@ name: Test the components of it
"on":
push:
branches:
- main
paths-ignore:
- .github/workflow/build.yml
- http/**
+3
View File
@@ -8,3 +8,6 @@ isolinux.cfg
# Generated distros
distros/fedora-rawhide-*.hcl
distros/centos-8stream-*.hcl
distros/centos-9stream-*.hcl
cellar/centos-9stream-*.hcl
+8
View File
@@ -14,3 +14,11 @@
path = http/fedora/rawhide
url = https://pagure.io/fedora-kickstarts.git
branch = main
[submodule "http/centos-upstream"]
path = http/centos-upstream
url = https://git.centos.org/centos/kickstarts.git
branch = master
[submodule "http/centos-stream"]
path = http/centos-stream
url = https://github.com/greg-hellings/centos-stream-kickstarts-mirror.git
branch = main
+7 -1
View File
@@ -7,23 +7,29 @@
name: "*"
state: latest
when: ansible_facts.pkg_mgr not in ['atomic_container']
register: _update_all
retries: 3
until: _update_all is success
- name: Update atomic things
become: true
ansible.builtin.command: rpm-ostree upgrade
when: ansible_facts.pkg_mgr in ['atomic_container']
changed_when: false
register: _update_atomic
retries: 3
until: _update_atomic is success
- name: Restart the machine
become: true
ansible.builtin.reboot:
roles:
- role: devroles.system.epel
- role: virtualbox
when: packer_builder_type == 'virtualbox-iso'
- role: vmware
when: packer_builder_type == 'vmware-iso'
- role: init
- role: devroles.system.epel
- role: locale
- role: vagrant
- role: cleanup
@@ -0,0 +1,5 @@
driver:
name: containers
platforms:
- name: test-centos7-locale
image: centos:7
@@ -0,0 +1,5 @@
driver:
name: containers
platforms:
- name: test-centos8-locale
image: quay.io/centos/centos:stream8
@@ -0,0 +1,9 @@
- hosts: all
pre_tasks:
- name: Install necessary packge
become: true
package:
name: glibc-common
state: present
roles:
- locale
+1 -1
View File
@@ -2,7 +2,7 @@
become: true
ansible.builtin.shell: |-
set -e
yum --enablerepo=epel clean all
yum clean all
yum history new
truncate -c -s 0 /var/log/yum.log
changed_when: false
-8
View File
@@ -1,8 +0,0 @@
- name: remove unnecessesary packages
become: true
ansible.builtin.package:
name:
- perl
- gcc
- kernel-devel
state: absent
+2 -1
View File
@@ -6,6 +6,7 @@
- perl
- gcc
- kernel-devel
- net-tools
- kernel-headers
- bzip2
- epel-release
state: absent
@@ -0,0 +1,5 @@
driver:
name: containers
platforms:
- name: test-centos7-locale
image: centos:7
@@ -0,0 +1,5 @@
driver:
name: containers
platforms:
- name: test-centos8-locale
image: quay.io/centos/centos:stream8
@@ -0,0 +1,5 @@
driver:
name: containers
platforms:
- name: test-centos9-locale
image: quay.io/centos/centos:stream9
@@ -0,0 +1,9 @@
- hosts: all
pre_tasks:
- name: Install necessary packge
become: true
package:
name: glibc-common
state: present
roles:
- locale
+5 -3
View File
@@ -1,9 +1,11 @@
- name: update locale info
become: true
ansible.builtin.shell: |
set -eo pipefail
localedef --list-archive | grep -a -v en_US.utf8 | xargs sudo localedef --delete-from-archive
set -exo pipefail
localedef --list-archive | ( grep -a -v en_US.utf8 || printf '' ) | xargs -r sudo localedef --delete-from-archive
cp /usr/lib/locale/locale-archive{,.tmpl}
build-locale-archive
when: >
ansible_facts['distribution'] in ['CentOS']
( ansible_facts['distribution'] in ['CentOS'] ) and
( ansible_facts['distribution_major_version'] is version('8', '<') )
changed_when: false
+2
View File
@@ -2,8 +2,10 @@ virtualbox_packages:
- bzip2
- dkms
- kernel-devel
- kernel-headers
- make
- perl
- gcc
virtualbox_services:
- dkms
virtualbox_from_iso: true
-1
View File
@@ -2,4 +2,3 @@ virtualbox_packages:
- linux-image-amd64
virtualbox_services: []
virtualbox_from_iso: false
virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso"
@@ -5,4 +5,3 @@ virtualbox_packages:
- make
virtualbox_services: []
virtualbox_from_iso: true
virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso"
@@ -5,4 +5,3 @@ virtualbox_packages:
- make
virtualbox_services: []
virtualbox_from_iso: true
virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso"
-1
View File
@@ -11,6 +11,5 @@ virtualbox_packages:
- dkms
virtualbox_services:
- dkms
virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso"
virtualbox_from_iso: true
virtualbox_pre_commands: []
+1
View File
@@ -0,0 +1 @@
virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso"
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Name of the file to write out
name="${0%.sh}"
checksums="$(mktemp)"
until curl -f -L -o "${checksums}" "http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-boot.iso.SHA256SUM"; do
sleep 1
done
sha="$(cat "${checksums}" | grep SHA256 | cut -d' ' -f 4)"
cat << EOF > "${name}"
distro = "centos"
version = "9stream"
iso = {
url = "http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-boot.iso"
checksum = "${sha}"
}
boot_command = [
"<esc><wait>",
"linux net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/centos/9stream-x86_64.ks console=ttyS0",
"<enter>"
]
EOF
+11
View File
@@ -0,0 +1,11 @@
distro = "centos"
version = "7"
iso = {
url = "http://mirror.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-2009.iso"
checksum = "b79079ad71cc3c5ceb3561fff348a1b67ee37f71f4cddfec09480d4589c191d6"
}
boot_command = [
"<esc><wait>",
"linux net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/centos/7-x86_64.ks console=ttyS0",
"<enter>"
]
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Name of the file to write out
name="${0%.sh}"
checksums="$(mktemp)"
until curl -f -L -o "${checksums}" "http://mirror.centos.org/centos/8-stream/isos/x86_64/CHECKSUM"; do
sleep 1
done
sha="$(cat "${checksums}" | grep latest-boot | grep SHA256 | cut -d' ' -f 4)"
cat << EOF > "${name}"
distro = "centos"
version = "8stream"
iso = {
url = "http://mirror.centos.org/centos/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-latest-boot.iso"
checksum = "${sha}"
}
boot_command = [
"<esc><wait>",
"linux net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/centos/8stream/x86_64.ks console=ttyS0",
"<enter>"
]
EOF
+2 -2
View File
@@ -34,8 +34,8 @@ iso = {
checksum = "${sha}"
}
boot_command = [
"<up><tab><bs><bs><bs><bs><bs>",
"edd=off net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/rawhide-x86_64.ks console=ttyS0 <enter><wait>"
"<up>e<down><down><end><bs><bs><bs><bs><bs>",
"edd=off net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/rawhide-x86_64.ks console=ttyS0<f10>"
]
EOF
Submodule http/centos-stream added at 9dd286be86
+52
View File
@@ -0,0 +1,52 @@
install
text
reboot
url --url=http://mirror.centos.org/centos/7/os/x86_64/
repo --name=updates --baseurl=http://mirror.centos.org/centos/7/updates/x86_64/
lang en_US.UTF-8
keyboard us
timezone --utc Etc/UTC
rootpw --plaintext vagrant
user --name=vagrant --groups=vagrant --password=vagrant --plaintext
zerombr
clearpart --all --initlabel
autopart --type=plain
bootloader --timeout=1
%packages
@core
which
libselinux-python
# mandatory packages in the @core group
-btrfs-progs
-iprutils
-kexec-tools
-plymouth
# default packages in the @core group
-*-firmware
-dracut-config-rescue
-kernel-tools
-libsysfs
-microcode_ctl
-NetworkManager*
-postfix
-rdma
%end
%post --erroronfail
yum -y update
cat <<EOF > /etc/sudoers.d/vagrant
Defaults:vagrant !requiretty
vagrant ALL=(ALL) NOPASSWD: ALL
EOF
chmod 440 /etc/sudoers.d/vagrant
ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
TYPE="Ethernet"
EOF
%end
+19
View File
@@ -0,0 +1,19 @@
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
%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}")")")"
# This allows us to support virtualbox
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/*
fi
%end
+19
View File
@@ -0,0 +1,19 @@
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}")")"
# This allows us to support virtualbox
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/*
fi
%end
+1 -1
View File
@@ -65,6 +65,6 @@ locals {
username = "vagrant"
password = "vagrant"
handshake_attempts = 1000
timeout = "5h50m"
timeout = "5h45m"
}
}
+1
View File
@@ -11,6 +11,7 @@ source "virtualbox-iso" "x86_64" {
ssh_username = local.ssh.username
ssh_password = local.ssh.password
ssh_handshake_attempts = local.ssh.handshake_attempts
ssh_private_key_file = "vagrant/insecure_key"
vm_name = "packer-${local.name}"
disk_size = "${local.disk_size}000"
+27
View File
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI
w+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP
kcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2
hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO
Td0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW
yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQIBIwKCAQEA4iqWPJXtzZA68mKd
ELs4jJsdyky+ewdZeNds5tjcnHU5zUYE25K+ffJED9qUWICcLZDc81TGWjHyAqD1
Bw7XpgUwFgeUJwUlzQurAv+/ySnxiwuaGJfhFM1CaQHzfXphgVml+fZUvnJUTvzf
TK2Lg6EdbUE9TarUlBf/xPfuEhMSlIE5keb/Zz3/LUlRg8yDqz5w+QWVJ4utnKnK
iqwZN0mwpwU7YSyJhlT4YV1F3n4YjLswM5wJs2oqm0jssQu/BT0tyEXNDYBLEF4A
sClaWuSJ2kjq7KhrrYXzagqhnSei9ODYFShJu8UWVec3Ihb5ZXlzO6vdNQ1J9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