From eeebd0189caec4ce2ecb72be23561d2fadf1c3e2 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Fri, 15 Nov 2024 11:10:32 -0700 Subject: [PATCH] init for r10 --- README.md | 149 ++++ cloud-build.sh | 99 +++ cloud/cloud.xml | 256 +++++++ components/boot.xml | 25 + components/live/cinnamon.xml | 85 +++ components/live/common.xml | 66 ++ components/live/kde.xml | 46 ++ components/live/mate.xml | 144 ++++ components/live/workstation-lite.xml | 22 + components/live/workstation.xml | 26 + components/live/xfce.xml | 77 ++ components/users.xml | 12 + config.sh | 887 ++++++++++++++++++++++++ config.xml | 1 + configs/rocky-live-cinnamon.xml | 28 + configs/rocky-live-kde.ks | 28 + configs/rocky-live-mate.xml | 28 + configs/rocky-live-workstation-lite.xml | 27 + configs/rocky-live-workstation.xml | 27 + configs/rocky-live-xfce.xml | 28 + configs/rocky-sbc-genericarm.xml | 27 + configs/rocky-sbc-raspberrypi.xml | 26 + configs/rocky.xml | 48 ++ container-build.sh | 99 +++ container/container.xml | 313 +++++++++ grub.tmpl | 46 ++ live-build.sh | 104 +++ live/cinnamon.xml | 12 + live/kde.xml | 12 + live/mate.xml | 12 + live/workstation-lite.xml | 11 + live/workstation.xml | 11 + live/xfce.xml | 12 + repositories/altarch-common-default.xml | 13 + repositories/altarch-common.xml | 1 + repositories/cloud-common-default.xml | 6 + repositories/cloud-common.xml | 1 + repositories/core-default.xml | 22 + repositories/core-outside.xml | 22 + repositories/core-peridot.xml | 22 + repositories/core.xml | 1 + repositories/epel-default.xml | 7 + repositories/epel-outside.xml | 7 + repositories/epel.xml | 1 + repositories/gnulab-tmp.xml | 9 + repositories/kernel-common-default.xml | 12 + repositories/kernel-common.xml | 1 + repositories/oracle.xml | 6 + repositories/sig-core-default.xml | 9 + repositories/sig-core.xml | 1 + root/etc/fstab.script | 3 + root/etc/sysconfig/kernel | 6 + sbc-build.sh | 98 +++ sbc/editbootinstall_genericarm.sh | 36 + sbc/editbootinstall_rpi.sh | 36 + sbc/pi.xml | 86 +++ vagrant/vagrant.xml | 131 ++++ wsl/default.xml | 12 + 58 files changed, 3343 insertions(+) create mode 100644 README.md create mode 100755 cloud-build.sh create mode 100644 cloud/cloud.xml create mode 100644 components/boot.xml create mode 100644 components/live/cinnamon.xml create mode 100644 components/live/common.xml create mode 100644 components/live/kde.xml create mode 100644 components/live/mate.xml create mode 100644 components/live/workstation-lite.xml create mode 100644 components/live/workstation.xml create mode 100644 components/live/xfce.xml create mode 100644 components/users.xml create mode 100644 config.sh create mode 120000 config.xml create mode 100644 configs/rocky-live-cinnamon.xml create mode 100644 configs/rocky-live-kde.ks create mode 100644 configs/rocky-live-mate.xml create mode 100644 configs/rocky-live-workstation-lite.xml create mode 100644 configs/rocky-live-workstation.xml create mode 100644 configs/rocky-live-xfce.xml create mode 100644 configs/rocky-sbc-genericarm.xml create mode 100644 configs/rocky-sbc-raspberrypi.xml create mode 100644 configs/rocky.xml create mode 100755 container-build.sh create mode 100644 container/container.xml create mode 100644 grub.tmpl create mode 100755 live-build.sh create mode 100644 live/cinnamon.xml create mode 100644 live/kde.xml create mode 100644 live/mate.xml create mode 100644 live/workstation-lite.xml create mode 100644 live/workstation.xml create mode 100644 live/xfce.xml create mode 100644 repositories/altarch-common-default.xml create mode 120000 repositories/altarch-common.xml create mode 100644 repositories/cloud-common-default.xml create mode 120000 repositories/cloud-common.xml create mode 100644 repositories/core-default.xml create mode 100644 repositories/core-outside.xml create mode 100644 repositories/core-peridot.xml create mode 120000 repositories/core.xml create mode 100644 repositories/epel-default.xml create mode 100644 repositories/epel-outside.xml create mode 120000 repositories/epel.xml create mode 100644 repositories/gnulab-tmp.xml create mode 100644 repositories/kernel-common-default.xml create mode 120000 repositories/kernel-common.xml create mode 100644 repositories/oracle.xml create mode 100644 repositories/sig-core-default.xml create mode 120000 repositories/sig-core.xml create mode 100644 root/etc/fstab.script create mode 100644 root/etc/sysconfig/kernel create mode 100755 sbc-build.sh create mode 100644 sbc/editbootinstall_genericarm.sh create mode 100644 sbc/editbootinstall_rpi.sh create mode 100644 sbc/pi.xml create mode 100644 vagrant/vagrant.xml create mode 100644 wsl/default.xml diff --git a/README.md b/README.md new file mode 100644 index 0000000..64a97e0 --- /dev/null +++ b/README.md @@ -0,0 +1,149 @@ +## rocky-kiwi-descriptions + +Kiwi descriptions for Rocky Linux 9. + +`config.xml` is a symlink to `rocky.xml`. this way the symlink can just be +changed to deal with live images (as kiwi doesn't seem to support using the +--kiwi-file option for iso). + +### What can I build? + +At the time of this writing, you can create cloud images, live images, and +containers. You can run any of the scripts to do so: + +* cloud-build.sh +* container-build.sh +* live-build.sh + +### Can't you use the same config.xml? Why are you symlinking? + +Yes and the reason why we're symlinking is that "name" and "displayname" are +not flexible. They are only set/read at the very top level `` (at least +from testing at the time of this writing). As our images and volume names (at +least for live images) have a very specific format, and we want it to be easy +to rename them, we did it this way. + +Cloud, container, vagrant images can all use the first config, likely just fine. +The live images were the problematic ones, thus, symlinks with a default to the +`rocky.xml` config. + +### I found an issue... + +Please fork and make a PR! We're still learning how this tool works ourselves. + +### How to try it out + +You can run this on a running system, in a mock root, or a podman container. In +fact, most builds may fail in mock due to loop devices being unusable. + +**Note**: SELinux must be set to permissive. + +**Note**: There may be cases where a build will fail in mock. If this is the +case, you may need to use `--isolation=simple` or forego the use of mock. + +**Note**: If you receive an error about loop devices while running in mock, run +this on the host instead. + +#### Live Image Example on Rocky Linux 9 without using mock + +``` +# Use SIG/Core +% dnf install rocky-release-core +% dnf install kiwi-cli git \ + dracut-kiwi-live \ + kiwi-systemdeps-{bootloaders,containers,core,disk-images,filesystems,image-validation,iso-media} + +% sudo setenforce 0 +% git clone https://git.resf.org/sig_core/rocky-kiwi-descriptions -b r9 +% cd rocky-kiwi-descriptions +% ln -sf configs/rocky-live-xfce.xml config.xml +% kiwi-ng --debug --type="iso" \ + --profile="XFCE-Live" \ + --color-output system \ + build \ + --description="./" \ + --target-dir /builddir/lmc +``` + +If you wish to use EPEL instead... + +``` +% dnf install epel-release -y +% crb enable +% dnf install kiwi-cli git \ + dracut-kiwi-live \ + kiwi-systemdeps-{bootloaders,containers,core,disk-images,filesystems,image-validation,iso-media} \ + distribution-gpg-keys + +% sudo setenforce 0 +% git clone https://git.resf.org/sig_core/rocky-kiwi-descriptions -b r9 +% cd rocky-kiwi-descriptions +% ln -sf configs/rocky-live-xfce.xml config.xml +% kiwi-ng --debug --type="iso" \ + --profile="XFCE-Live" \ + --color-output system \ + build \ + --description="./" \ + --target-dir /builddir/lmc +``` + +#### Live Image Example (EPEL) using mock + +The below makes an XFCE live image using SIG/Core packages. + +``` +# Use SIG/Core +% git clone https://git.resf.org/sig_core/mock-rocky-configs +% bash deploy.sh +% mock -r rl-9-x86_64-core-infra --init +% mock -r rl-9-x86_64-core-infra --install kiwi-cli git \ + dracut-kiwi-live \ + kiwi-systemdeps-{bootloaders,containers,core,disk-images,filesystems,image-validation,iso-media} \ + epel-release \ + rocky-release-core + +% sudo setenforce 0 +% mock -r rl-9-x86_64-core-infra --shell --enable-network +% git clone https://git.resf.org/sig_core/rocky-kiwi-descriptions -b r9 +% cd rocky-kiwi-descriptions +% ln -sf configs/rocky-live-xfce.xml config.xml +% kiwi-ng --debug --type="iso" \ + --profile="XFCE-Live" \ + --color-output system \ + build \ + --description="./" \ + --target-dir /builddir/lmc +``` + +The below uses EPEL instead if you do not wish to use SIG/Core. + +``` +# Use EPEL +% mock -r rocky+epel-9-x86_64 --init +% mock -r rocky+epel-9-x86_64 --install kiwi-cli git \ + dracut-kiwi-live \ + kiwi-systemdeps-{bootloaders,containers,core,disk-images,filesystems,image-validation,iso-media} \ + distribution-gpg-keys \ + epel-release + +% sudo setenforce 0 +% mock -r rocky+epel-9-x86_64 --shell --enable-network +% git clone https://git.resf.org/sig_core/rocky-kiwi-descriptions -b r9 +% cd rocky-kiwi-descriptions +% ln -sf configs/rocky-live-xfce.xml config.xml +% kiwi-ng --debug --type="iso" \ + --profile="XFCE-Live" \ + --color-output system \ + build \ + --description="./" \ + --target-dir /builddir/lmc +``` + +On the other hand, you can run the live-build.sh script after setting up your +mock environment. + +``` +% bash live-build.sh --live-image XFCE --output-dir /builddir/xfce +``` + + diff --git a/cloud-build.sh b/cloud-build.sh new file mode 100755 index 0000000..401f061 --- /dev/null +++ b/cloud-build.sh @@ -0,0 +1,99 @@ +#!/bin/bash +# helps build a quick cloud image. that way a user doesn't have to use emapandas +# nor some other method. mock is probably not necessary, but it's up to you. +# label@resf.org + +set -o errexit +set -o pipefail + +SCRNAME="$(basename "$0")" +SCRDIR="$(dirname "${BASH_SOURCE[0]}")" + +export __usage +__usage=" +usage: $SCRNAME [OPTIONS] + +Options: + -o, --output-dir DIR + -c, --cloud-image NAME + -p, --peridot ID # optional. will use peridot repos. + -d, --debug # optional + +" + +OPTS=$(getopt -a -n cloud-build -o c:,o:,p:,d,h \ + -l cloud-image:,output-dir:,peridot:,debug,help -- "$@") + +function is_in_path() { + builtin type -P "${1}" +} + +function usage() { + echo "$__usage" +} + +eval set -- "$OPTS" +while :; do + case "$1" in + -c | --cloud-image) CLOUD="$2" ; shift 2 ;; + -o | --output-dir) OUTPUTDIR="$2" ; shift 2 ;; + -p | --peridot) PERIDOTID="$2" ; shift 2 ;; + -d | --debug) DEBUG="--debug" ; shift ;; + -h | --help) usage ;; + --) shift ; break ;; + esac +done + +if [ -z "$CLOUD" ] || [ -z "$OUTPUTDIR" ]; then + echo "Options are not set properly." + usage + exit 12 +fi + +if [ -e "/sys/fs/selinux/enforce" ]; then + enforce_check="$(cat /sys/fs/selinux/enforce)" + if [ "$enforce_check" -eq "1" ]; then + echo "Running with selinux enforcing is not recommended." + exit 22 + fi +fi + +is_in_path kiwi-ng &> /dev/null +ret_val=$? + +if [ "$ret_val" -ne "0" ]; then + echo "kiwi-ng not found. kiwi packages are likely not installed on this system." + exit 32 +fi + +function switch_repo_to_peridot() { + ID="$1" + # https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/ + pushd repositories || { echo "not found"; exit 1; } + sed -i "s;ZZ_INTERNAL_BaseOS_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/BaseOS/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_AppStream_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/AppStream/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_CRB_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/CRB/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_extras_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/extras/\$basearch;g" core-peridot.xml + rm core.xml + ln -sf core-peridot.xml core.xml + popd +} + +function main() { + #/bin/rm config.xml + #if [ ! -f "configs/rocky-live-${LIVE,,}.xml" ]; then + # echo "${LIVE} was not found. Is it supported?" + # exit 42 + #fi + #ln -sf "configs/rocky-live-${LIVE,,}.xml" config.xml + ln -sf "configs/rocky.xml" config.xml + + if [ -n "$PERIDOTID" ]; then + switch_repo_to_peridot "${PERIDOTID}" + fi + + # shellcheck disable=SC2086 + kiwi-ng $DEBUG --type="oem" --profile="Cloud-$CLOUD" --color-output system build --description="$SCRDIR" --target-dir "$OUTPUTDIR" +} + +main diff --git a/cloud/cloud.xml b/cloud/cloud.xml new file mode 100644 index 0000000..aacc1ca --- /dev/null +++ b/cloud/cloud.xml @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + 10 + + + + + + false + + + 10 + + + + + + + + + + false + + + 10 + + + + + + false + + + 10 + + + + + + + + + + false + + + 10 + + + + + + false + + + 10 + + + + + + + + + + + false + + + 10 + + + + + + false + + + 10 + + + + + + + + + + + false + + + 10 + + + + + + false + + + 10 + + + + + + + + + + + false + + + 10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/boot.xml b/components/boot.xml new file mode 100644 index 0000000..9dc4ae1 --- /dev/null +++ b/components/boot.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/live/cinnamon.xml b/components/live/cinnamon.xml new file mode 100644 index 0000000..6dd9ccb --- /dev/null +++ b/components/live/cinnamon.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/live/common.xml b/components/live/common.xml new file mode 100644 index 0000000..9bd4d72 --- /dev/null +++ b/components/live/common.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/live/kde.xml b/components/live/kde.xml new file mode 100644 index 0000000..c45a6d8 --- /dev/null +++ b/components/live/kde.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/live/mate.xml b/components/live/mate.xml new file mode 100644 index 0000000..eb8bbf4 --- /dev/null +++ b/components/live/mate.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/live/workstation-lite.xml b/components/live/workstation-lite.xml new file mode 100644 index 0000000..e848f23 --- /dev/null +++ b/components/live/workstation-lite.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/live/workstation.xml b/components/live/workstation.xml new file mode 100644 index 0000000..585958f --- /dev/null +++ b/components/live/workstation.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/live/xfce.xml b/components/live/xfce.xml new file mode 100644 index 0000000..6b10348 --- /dev/null +++ b/components/live/xfce.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/users.xml b/components/users.xml new file mode 100644 index 0000000..f5f9970 --- /dev/null +++ b/components/users.xml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/config.sh b/config.sh new file mode 100644 index 0000000..a473a07 --- /dev/null +++ b/config.sh @@ -0,0 +1,887 @@ +#!/bin/bash + +set -euxo pipefail + +#====================================== +# Functions... +#-------------------------------------- +test -f /.kconfig && . /.kconfig +test -f /.profile && . /.profile + +#====================================== +# Greeting... +#-------------------------------------- +echo "Configure image: [$kiwi_iname]-[$kiwi_profiles]..." + +################################################################################ +# ALL OF OUR FUNCTIONS +function common_live_steps() { + # this isn't needed in our testing, but we'll put it here just in case + systemctl set-default graphical.target + systemctl enable livesys.service livesys-late.service + systemctl enable tmp.mount + cat >> /etc/fstab << EOF +vartmp /var/tmp tmpfs defaults 0 0 +EOF + rm -f /var/lib/rpm/__db* + majorver=$(rpm --eval '%{rhel}') + rpm --import "/etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-${majorver}" + rm -f /var/lib/rpm/__db* + /usr/bin/mandb + rm -f /core* + rm -f /boot/*-rescue* +} + +function live_gnome_steps() { + sed -i 's/^livesys_session=.*/livesys_session="gnome"/' /etc/sysconfig/livesys +} + +function live_kde_steps() { + sed -i 's/^livesys_session=.*/livesys_session="kde"/' /etc/sysconfig/livesys + cat > /root/.gtkrc-2.0 << EOF +include "/usr/share/themes/Adwaita/gtk-2.0/gtkrc" +include "/etc/gtk-2.0/gtkrc" +gtk-theme-name="Adwaita" +EOF + mkdir -p /root/.config/gtk-3.0 +cat > /root/.config/gtk-3.0/settings.ini << EOF +[Settings] +gtk-theme-name = Adwaita +EOF + + rm -f /usr/share/wallpapers/Fedora + ln -s rocky-abstract-2 /usr/share/wallpapers/Fedora + + systemctl enable --force sddm.service + + cat > /etc/sddm.conf.d/theme.conf < /etc/sysconfig/desktop < /etc/sysconfig/desktop < /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml < + + + + + + + + + + + + + + +XFCEEOF +} + +function epel_de_steps() { + dnf config-manager --set-enabled crb +} + +# live fixes if we need them +function live_fixes() { + sed -i "s/org.fedoraproject.AnacondaInstaller/anaconda/" /usr/share/applications/liveinst.desktop +} + +function common_cloud_steps() { + # This can be done via systemctl set-default, but sometimes it doesn't work. + # systemctl set-default multi-user.target + rm -f /etc/systemd/system/default.target + ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target + + # chrony should already be enabled, let's make sure + systemctl enable chronyd + # make a persistent journal + mkdir -p /var/log/journal + + dnf -C -y remove linux-firmware avahi\* + dnf -C -y remove firewalld --setopt="clean_requirements_on_remove=1" + dnf -C -y remove langpacks-* + sed -i '/^#NAutoVTs=.*/ a\ +NAutoVTs=0' /etc/systemd/logind.conf + truncate -s 0 /etc/resolv.conf + if [ -f /etc/tuned/active_profile ]; then + echo "virtual-guest" > /etc/tuned/active_profile + fi + rm -f /etc/udev/rules.d/70* + ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules + cat > /etc/sysconfig/network << EOF +NETWORKING=yes +NOZEROCONF=yes +EOF + cat > /etc/hosts << EOF +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 + +EOF + + echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot + + echo -e 'rocky\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers + sed -i '1i # Modified for cloud image' /etc/cloud/cloud.cfg + sed -i 's/name: cloud-user/name: rocky/g' /etc/cloud/cloud.cfg +} + +################################################################################ +# Azure +function azure_cloud_steps() { + echo 'azure' > /etc/dnf/vars/infra + cat << EOF | tee -a /etc/NetworkManager/conf.d/dhcp-timeout.conf +# Configure dhcp timeout to 300s by default +[connection] +ipv4.dhcp-timeout=300 +EOF + systemctl enable waagent + sed -i 's/Provisioning.UseCloudInit=n/Provisioning.UseCloudInit=y/g' /etc/waagent.conf + sed -i 's/Provisioning.Enabled=y/Provisioning.Enabled=n/g' /etc/waagent.conf + cat << EOF | tee -a /etc/udev/rules.d/68-azure-sriov-nm-unmanaged.rules +# Accelerated Networking on Azure exposes a new SRIOV interface to the VM. +# This interface is transparently bonded to the synthetic interface, +# so NetworkManager should just ignore any SRIOV interfaces. +SUBSYSTEM=="net", DRIVERS=="hv_pci", ACTION=="add", ENV{NM_UNMANAGED}="1" +EOF + + cat << EOF | tee -a /etc/udev/rules.d/98-hyperv-ptp.rules +## See: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/time-sync#check-for-ptp-clock-source +SUBSYSTEM=="ptp", ATTR{clock_name}=="hyperv", SYMLINK += "ptp_hyperv" +EOF + + cat << EOF | tee -a /etc/chrony.conf +# Setup hyperv PTP device as refclock +refclock PHC /dev/ptp_hyperv poll 3 dpoll -2 offset 0 stratum 2 +EOF + + cat << EOF | tee -a /etc/modprobe.d/azure-blacklist.conf +blacklist amdgpu +blacklist nouveau +blacklist radeon +EOF + + cat << EOF | tee /etc/cloud/cloud.cfg.d/10-azure-kvp.cfg +# Enable logging to the Hyper-V kvp in Azure +reporting: + logging: + type: log + telemetry: + type: hyperv +EOF + + cat << EOF | tee -a /etc/dracut.conf.d/80-azure.conf +add_drivers+=" hv_vmbus hv_netvsc hv_storvsc " +EOF + + #dracut -f -v +} + +################################################################################ +# EC2 +function ec2_cloud_steps() { + echo 'ec2' > /etc/dnf/vars/infra + cat >> /etc/dhcp/dhclient.conf << EOF +timeout 300; +retry 60; +EOF + + if [ -f /boot/grub2/grub.conf ]; then + sed -i -e 's/ rhgb quiet//' /boot/grub2/grub.conf + fi + sed -i -e 's/ rhgb quiet//' /etc/default/grub + cat > /etc/modprobe.d/blacklist-nouveau.conf << EOL +blacklist nouveau +EOL + + cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF +DEVICE="eth0" +ONBOOT="yes" +BOOTPROTO="dhcp" +TYPE="Ethernet" +USERCTL="no" +PEERDNS="yes" +IPV6INIT="no" +PERSISTENT_DHCLIENT="1" +EOF + + echo 'install_items+=" sgdisk "' > /etc/dracut.conf.d/sgdisk.conf + echo 'add_drivers+=" xen-netfront xen-blkfront "' > /etc/dracut.conf.d/xen.conf + #KERNEL_VERSION=$(rpm -q kernel --qf '%{V}-%{R}.%{arch}\n') + #dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION + + cat >> /etc/chrony.conf << EOF +# Amazon Time Sync Service +server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4 +EOF +} + +################################################################################ +# Generic Cloud (genclo) +function genclo_cloud_steps() { + echo 'genclo' > /etc/dnf/vars/infra + cat >> /etc/dhcp/dhclient.conf << EOF +timeout 300; +retry 60; +EOF + + cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF +DEVICE="eth0" +ONBOOT="yes" +BOOTPROTO="dhcp" +BOOTPROTOV6="dhcp" +TYPE="Ethernet" +USERCTL="no" +PEERDNS="yes" +IPV6INIT="yes" +PERSISTENT_DHCLIENT="1" +EOF +} + +################################################################################ +# OCP +function ocp_cloud_steps() { + cat >> /etc/dhcp/dhclient.conf << EOF +timeout 300; +retry 60; +EOF + + cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF +DEVICE="eth0" +ONBOOT="yes" +BOOTPROTO="dhcp" +TYPE="Ethernet" +USERCTL="no" +PEERDNS="yes" +IPV6INIT="no" +PERSISTENT_DHCLIENT="1" +EOF + + # OCI - Import repo GPG key + cat < /tmp/key +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGHncu8BEAC2dhocMZkdapnP9o/MvAnKOczaSpF4Cj9yqt49bxLPJCY57jz9 +2ZkJ5iGk6kpBt4rPTh18aAl30T+nPP8VMQjMhvHJKfZmBtaJJ5RpvvpK5mj1UgRJ +4DQX7gqAbT0s/uZZcouZsJzXo3c7GNMrim1C+ScfG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+w5wu1TmM5KgZtZvuWOTDnqDLf0cKoIbW8FeeCOn24elcj32bnQDuF9DPey1mqcvT +/yEo/Ushyz6CVYxN8DGgcy2M9JOsnmjDx02h6qgWGWDuKgb9jZrvRedpAQCeemEd +fhEs6ihqVxRFl16HxC4EVijybhAL76SsM2nbtIqW1apBQJQpXWtQwwdvgTVpdEtE +r4ArVJYX5LrswnWEQMOelugUG6S3ZjMfcyOa/O0364iY73vyVgaYK+2XtT2usMux +VL469Kj5m13T6w== +=Mjs/ +-----END PGP PUBLIC KEY BLOCK----- +EOF + + rpm --import /tmp/key + # remove these for debugging + if [ -f /boot/grub2/grub.conf ]; then + sed -i -e 's/ rhgb quiet//' /boot/grub2/grub.conf + fi + sed -i -e 's/ rhgb quiet//' /etc/default/grub + + # enable resizing on copied AMIs + echo 'install_items+=" sgdisk "' > /etc/dracut.conf.d/sgdisk.conf + + # OCI - Need iscsi as a dracut module + echo 'add_dracutmodules+=" iscsi "' > /etc/dracut.conf.d/iscsi.conf + + # OCI - Virtio drivers + echo 'add_drivers+=" virtio virtio_blk virtio_net virtio_pci virtio_ring virtio_scsi virtio_console "' > /etc/dracut.conf.d/virtio.conf + + # OCI - YOLO + mkdir -p /usr/lib/dracut/modules.d/95oci + OCIDRACUT="H4sIAGtFHmMAA+2WWW/bOBCA/Vr+illZzQXoluPUhgMURYrmpS02fevuGpJIWYQVUiWpJoHr/15S +crLZZBs3QA8U5QfYosQ5NUNSrRRBTfMAi6xoVXDOcVsT6ePg2YgXNBh8C0LNeDTqrpq7124cpfF4 +nIzT8fhwEEaj+HA8gNE38b6FVqpMAAwE5+ohuW3zvyjtw/UnLMtr4lFZSOrlV00mpS+rR/rYUv84 +StJBlIx10ZNREscD/SRNkwGE3yXjO/zm9R/+EeSUBbJCQ/AOPNANQCYgK1LXniwEbdQUKMOEKU9l +ufT6eUbrqRby8kzSwuNlKYmaQDo1JrQhcjkBJWdHIC9mKUg9TIEoKGlN1FVDZtobGr7NVFFB11nm +3YLikNU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GNoZWYKIC0gc2FsdC1taW5pb24KIC0gbWNv +bGxlY3RpdmUKIC0gZGlzYWJsZS1lYzItbWV0YWRhdGEKIC0gcnVuY21kCgpjbG91ZF9maW5hbF9t +b2R1bGVzOgogLSByaWdodHNjYWxlX3VzZXJkYXRhCiAtIHNjcmlwdHMtcGVyLW9uY2UKIC0gc2Ny +aXB0cy1wZXItYm9vdAogLSBzY3JpcHRzLXBlci1pbnN0YW5jZQogLSBzY3JpcHRzLXVzZXIKIC0g +c3NoLWF1dGhrZXktZmluZ2VycHJpbnRzCiAtIGtleXMtdG8tY29uc29sZQogLSBwaG9uZS1ob21l +CiAtIGZpbmFsLW1lc3NhZ2UKIyBPQ0k6IHBvd2VyLXN0YXRlLWNoYW5nZSBpcyBkaXNhYmxlZAoj +LSBwb3dlci1zdGF0ZS1jaGFuZ2UKCg==" + + base64 -d <<<"$OCICLOUDCFG" >> /etc/cloud/cloud.cfg.d/99_oci.cfg + + # Remove system.devices because Oracle does things. + rm -fv /etc/lvm/devices/system.devices + +} + +function cloud_cleanup_steps() { + truncate -c -s 0 /var/log/dnf.log + rm -rf /var/log/yum.log + rm -rf /var/lib/yum/* + rm -rf /root/install.log + rm -rf /root/install.log.syslog + rm -rf /root/anaconda-ks.cfg + rm -rf /var/log/anaconda* + + rm -f /var/lib/systemd/random-seed + + touch /var/log/cron + touch /var/log/boot.log + mkdir -p /var/cache/yum + + # Azure Only + if [[ "$kiwi_profiles" == *"Azure"* ]]; then + rm -f /var/log/waagent.log + cloud-init clean + waagent -force -deprovision+user + fi + + # Attempt to fix file permissions + for x in $(rpm -qa); do rpm --setperms "${x}" ; done + + # Attempt to fix labeling + /usr/sbin/fixfiles -R -a restore +} + +function azure_cleanup_steps() { + rm -f /var/log/waagent.log + cloud-init clean + waagent -force -deprovision+user +} + +function common_container_steps() { + /bin/date +%Y-%m-%d_%H:%M:%S > /etc/BUILDTIME + echo 'container' > /etc/dnf/vars/infra + LANG="en_US" + echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf + echo 'LANG="C.UTF-8"' > /etc/locale.conf + releasever=$(rpm --eval '%{?rocky}') + rpm --import "/etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-${releasever}" + :> /etc/machine-id + echo "# placeholder" > /etc/resolv.conf + chmod 644 /etc/resolv.conf + rm -rf /tmp/* + printf "tsflags=nodocs\n" >>/etc/dnf/dnf.conf +} + +function minimal_container_steps() { + microdnf -y remove langpacks-en || true + rm -fv /usr/share/gnupg/help*.txt + rm /usr/lib/rpm/rpm.daily + rm -rfv /usr/lib64/nss/unsupported-tools/ + rm -fv /usr/sbin/{glibc_post_upgrade.x86_64,sln} + ln /usr/bin/ln usr/sbin/sln + rm -rfv /var/lib/dnf + rm -rfv /usr/share/icons/* + rm -fv /usr/bin/pinky + rm -rfv /usr/lib/systemd +} + +function toolbox_container_steps() { + rm -f /etc/rpm/macros.image-language-conf + sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf +} + +################################################################################ +# Vagrant +function common_vagrant_steps() { + fallocate -l 2G /swapfile + chmod 600 /swapfile + mkswap /swapfile + echo "/swapfile none swap defaults 0 0" >> /etc/fstab + + cat > /etc/sudoers.d/vagrant << EOF +Defaults:vagrant !requiretty +%vagrant ALL=(ALL) NOPASSWD: ALL +EOF + chmod 0440 /etc/sudoers.d/vagrant + # This may have to be changed for 10 + sed -i 's/^\(PasswordAuthentication\) yes$/\1 no/' /etc/ssh/sshd_config + sed -i 's/^#\(UseDNS\) yes$/\r\1 no/' /etc/ssh/sshd_config + + cat >>/etc/sysconfig/sshd <> /home/vagrant/.ssh/authorized_keys + chmod 600 /home/vagrant/.ssh/authorized_keys + chown -R vagrant:vagrant /home/vagrant/.ssh + + echo 'vag' > /etc/yum/vars/infra + echo blacklist floppy > /etc/modprobe.d/nofloppy.conf + 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 + #echo "Regenerating kernel" + #KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n') + #dracut -f -v + rm -rf /etc/ssh/ssh_host_* + + # Might not be needed for 10 + ex -s /etc/pam.d/su <<'EOF' +/^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 +} + +function vbox_vagrant_steps() { + # legacy stuff, we won't have this for 10 + cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF +DEVICE="eth0" +BOOTPROTO="dhcp" +ONBOOT="yes" +TYPE="Ethernet" +PERSISTENT_DHCLIENT="yes" +EOF + + # Install VBoxGuestAdditions for installed kernel. + # https://git.resf.org/sig_kernel/meta/issues/13 + #kver=$(rpm -q --queryformat="%{VERSION}-%{RELEASE}.%{ARCH}" kernel) + #echo "stg/rocky" > /etc/dnf/vars/contentdir + #sed -i 's/^#baseurl/baseurl/g;s/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/rocky*repo + #dnf -y install kernel-headers-$kver kernel-devel gcc make perl elfutils-libelf-devel + #sed -i 's/^baseurl/#baseurl/g;s/^#mirrorlist/mirrorlist/g' /etc/yum.repos.d/rocky*repo + #echo "pub/rocky" > /etc/dnf/vars/contentdir + #curl -L -o /tmp/vboxadditions.iso https://download.virtualbox.org/virtualbox/7.0.16/VBoxGuestAdditions_7.0.16.iso + #mkdir -p /media/VBoxGuestAdditions + #mount -o loop,ro /tmp/vboxadditions.iso /media/VBoxGuestAdditions + #mkdir -p /tmp/VBoxGuestAdditions + #sh /media/VBoxGuestAdditions/VBoxLinuxAdditions.run --nox11 --noexec --keep --target /tmp/VBoxGuestAdditions + #pushd /tmp/VBoxGuestAdditions + #./install.sh + #/sbin/rcvboxadd quicksetup all + #popd + #ls "/lib/modules/${kver}/misc/" + #modinfo "/lib/modules/${kver}/misc/vboxsf.ko" + #rm -rf /tmp/VBoxGuestAdditions + #umount /media/VBoxGuestAdditions + #rm -f /tmp/vboxadditions.iso + #rmdir /media/VBoxGuestAdditions + #dnf -y remove kernel-devel gcc make perl elfutils-libelf-devel +} + +function libvirt_vagrant_steps() { + # legacy stuff, we won't have this for 10 + cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF +DEVICE="eth0" +BOOTPROTO="dhcp" +ONBOOT="yes" +TYPE="Ethernet" +PERSISTENT_DHCLIENT="yes" +EOF +} + +################################################################################ +# SBC +function common_sbc_steps() { + :> /etc/machine-id + rm -f /etc/sysconfig/network-scripts/ifcfg-link + rm -f /etc/ssh/*_key* + dnf clean all + chown -R sssd:sssd /var/lib/sss/{db,pipes,mc,pubconf,gpo_cache} + cat > /etc/sysconfig/cpupower << EOF +CPUPOWER_START_OPTS="frequency-set -g ondemand" +CPUPOWER_STOP_OPTS="frequency-set -g ondemand" +EOF +} + +function raspberrypi_sbc_steps() { + cd /lib/firmware/brcm + xz -d -k brcmfmac43430-sdio.raspberrypi,3-model-b.txt.xz + cat > /boot/cmdline.txt << EOF +console=ttyAMA0,115200 console=tty1 root=LABEL=RPIROOT rootfstype=ext4 elevator=deadline rootwait +EOF +} + +function genericarm_sbc_steps() { + mkdir -p /boot/efi/EFI/BOOT + if [ -d /boot/efi/EFI/rocky/ ] && [ -f /boot/efi/EFI/rocky/grubaa64.efi ];then + for j in grub.cfg grubenv;do + if [ -f "/boot/grub2/${j}" ]; then + mv -f /boot/grub2/${j} /boot/efi/EFI/rocky/ + ln -s ../efi/EFI/rocky/${j} /boot/grub2/${j} + fi + done + cp -f /boot/efi/EFI/rocky/grubaa64.efi /boot/efi/EFI/BOOT/BOOTAA64.EFI + fi + + if [ -f /usr/share/uboot/rpi_3/u-boot.bin ]; then + cp -f /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin + fi + if [ -f /usr/share/uboot/rpi_4/u-boot.bin ]; then + cp -f /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin + fi + if [ -f /usr/share/uboot/rpi_arm64/u-boot.bin ]; then + cp -f /usr/share/uboot/rpi_arm64/u-boot.bin /boot/efi/rpi-u-boot.bin + fi + + rpm -e dracut-config-generic + if [ -x /lib/kernel/install.d/10-devicetree.install ]; then + /lib/kernel/install.d/10-devicetree.install remove + fi + + cat << EOF > /etc/sysconfig/kernel +# Written by image installer +# UPDATEDEFAULT specifies if new-kernel-pkg should make new kernels the default +UPDATEDEFAULT=yes + +# DEFAULTKERNEL specifies the default kernel package type +DEFAULTKERNEL=kernel-core +EOF +chmod 644 /etc/sysconfig/kernel + +### Write grub defaults, turn off OS probing as it is always wrong for image creation +cat << EOF > /etc/default/grub +GRUB_TIMEOUT=5 +GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" +GRUB_DEFAULT=saved +GRUB_DISABLE_SUBMENU=true +GRUB_TERMINAL_OUTPUT="console" +GRUB_CMDLINE_LINUX="" +GRUB_DISABLE_RECOVERY="true" +GRUB_DISABLE_OS_PROBER="true" +GRUB_ENABLE_BLSCFG="false" +EOF + chmod 644 /etc/default/grub + rm -f /boot/dtb + + cat >/usr/local/bin/rootfs-expand << EOF +#!/bin/bash +clear +part=\$(mount |grep '^/dev.* / ' |awk '{print \$1}') +if [ -z "\$part" ];then + echo "Error detecting rootfs" + exit -1 +fi +dev=\$(echo \$part|sed 's/[0-9]*\$//g') +devlen=\${#dev} +num=\${part:\$devlen} +if [[ "\$dev" =~ ^/dev/mmcblk[0-9]*p\$ ]];then + dev=\${dev:0:-1} +fi +if [ ! -x /usr/bin/growpart ];then + echo "Please install cloud-utils-growpart (sudo yum install cloud-utils-growpart)" + exit -2 +fi +if [ ! -x /usr/sbin/resize2fs ];then + echo "Please install e2fsprogs (sudo yum install e2fsprogs)" + exit -3 +fi +echo \$part \$dev \$num + +echo "Extending partition \$num to max size ...." +growpart \$dev \$num +echo "Resizing ext4 filesystem ..." +resize2fs \$part +echo "Done." +df -h |grep \$part +EOF + chmod +x /usr/local/bin/rootfs-expand +} + +# +################################################################################ + +cat /dev/null > /etc/machine-id + +# Gets around grub-bls issue +echo "GRUB_DEFAULT=saved" >> /etc/default/grub + +# All cloud and live +if [[ "$kiwi_profiles" == *"Cloud"* ]] || [[ "$kiwi_profiles" == *"Live"* ]]; then + passwd -d root + passwd -l root +fi + +################################################################################ +# Just about all the cloud images should do these things. +if [[ "$kiwi_profiles" == *"Cloud"* ]]; then + common_cloud_steps +fi + +################################################################################ +# Azure specific settings +if [[ "$kiwi_profiles" == *"Azure"* ]]; then + azure_cloud_steps +fi + +################################################################################ +# EC2 specific settings +if [[ "$kiwi_profiles" == *"EC2"* ]]; then + ec2_cloud_steps +fi + +################################################################################ +# GenClo specific settings +if [[ "$kiwi_profiles" == *"GenericCloud"* ]]; then + genclo_cloud_steps +fi + +################################################################################ +# OCP specific settings +if [[ "$kiwi_profiles" == *"OCP"* ]]; then + ocp_cloud_steps +fi + +# cloud clean up +if [[ "$kiwi_profiles" == *"Cloud"* ]]; then + echo "cleanup time" + cloud_cleanup_steps + + # Azure Only + if [[ "$kiwi_profiles" == *"Azure"* ]]; then + azure_cleanup_steps + fi + + rm -f ~/.bash_history + export HISTSIZE=0 +fi + +# Live Images Only +if [[ "$kiwi_profiles" == *"Live"* ]]; then + common_live_steps + if [[ "$kiwi_profiles" == *"Workstation"* ]]; then + live_gnome_steps + fi + if [[ "$kiwi_profiles" == *"KDE"* ]]; then + live_kde_steps + epel_de_steps + fi + if [[ "$kiwi_profiles" == *"Cinnamon"* ]]; then + live_cinnamon_steps + epel_de_steps + fi + if [[ "$kiwi_profiles" == *"MATE"* ]]; then + live_mate_steps + epel_de_steps + fi + if [[ "$kiwi_profiles" == *"XFCE"* ]]; then + live_xfce_steps + epel_de_steps + fi +fi + +# Containers only +if [[ "$kiwi_profiles" == *"Container"* ]]; then + common_container_steps + if [[ "$kiwi_profiles" == *"Container-Minimal"* ]]; then + minimal_container_steps + fi + if [[ "$kiwi_profiles" == *"Container-Toolbox"* ]]; then + toolbox_container_steps + fi +fi + +# Vagrant only +if [[ "$kiwi_profiles" == *"Vagrant"* ]]; then + common_vagrant_steps + if [[ "$kiwi_profiles" == *"Vagrant-Libvirt"* ]]; then + libvirt_vagrant_steps + fi + if [[ "$kiwi_profiles" == *"Vagrant-Vbox"* ]]; then + vbox_vagrant_steps + fi +fi + +# SBC Only +if [[ "$kiwi_profiles" == *"SBC"* ]]; then + common_sbc_steps + if [[ "$kiwi_profiles" == *"SBC-RaspberryPi"* ]]; then + raspberrypi_sbc_steps + fi + if [[ "$kiwi_profiles" == *"SBC-GenericArm"* ]]; then + genericarm_sbc_steps + fi +fi diff --git a/config.xml b/config.xml new file mode 120000 index 0000000..8bd2f1d --- /dev/null +++ b/config.xml @@ -0,0 +1 @@ +configs/rocky.xml \ No newline at end of file diff --git a/configs/rocky-live-cinnamon.xml b/configs/rocky-live-cinnamon.xml new file mode 100644 index 0000000..eb4f88f --- /dev/null +++ b/configs/rocky-live-cinnamon.xml @@ -0,0 +1,28 @@ + + + + + Release Engineering (SIG/Core) + releng@rockylinux.org + Rocky Linux + + + 9 + dnf + en_US + us + UTC + 9 + + + + + + + + + + + + + diff --git a/configs/rocky-live-kde.ks b/configs/rocky-live-kde.ks new file mode 100644 index 0000000..9ac1acc --- /dev/null +++ b/configs/rocky-live-kde.ks @@ -0,0 +1,28 @@ + + + + + Release Engineering (SIG/Core) + releng@rockylinux.org + Rocky Linux + + + 9 + dnf + en_US + us + UTC + 9 + + + + + + + + + + + + + diff --git a/configs/rocky-live-mate.xml b/configs/rocky-live-mate.xml new file mode 100644 index 0000000..c07da93 --- /dev/null +++ b/configs/rocky-live-mate.xml @@ -0,0 +1,28 @@ + + + + + Release Engineering (SIG/Core) + releng@rockylinux.org + Rocky Linux + + + 9 + dnf + en_US + us + UTC + 9 + + + + + + + + + + + + + diff --git a/configs/rocky-live-workstation-lite.xml b/configs/rocky-live-workstation-lite.xml new file mode 100644 index 0000000..9bd17c1 --- /dev/null +++ b/configs/rocky-live-workstation-lite.xml @@ -0,0 +1,27 @@ + + + + + Release Engineering (SIG/Core) + releng@rockylinux.org + Rocky Linux + + + 9 + dnf + en_US + us + UTC + 9 + + + + + + + + + + + + diff --git a/configs/rocky-live-workstation.xml b/configs/rocky-live-workstation.xml new file mode 100644 index 0000000..9ccf74f --- /dev/null +++ b/configs/rocky-live-workstation.xml @@ -0,0 +1,27 @@ + + + + + Release Engineering (SIG/Core) + releng@rockylinux.org + Rocky Linux + + + 9 + dnf + en_US + us + UTC + 9 + + + + + + + + + + + + diff --git a/configs/rocky-live-xfce.xml b/configs/rocky-live-xfce.xml new file mode 100644 index 0000000..c6327dc --- /dev/null +++ b/configs/rocky-live-xfce.xml @@ -0,0 +1,28 @@ + + + + + Release Engineering (SIG/Core) + releng@rockylinux.org + Rocky Linux + + + 9 + dnf + en_US + us + UTC + 9 + + + + + + + + + + + + + diff --git a/configs/rocky-sbc-genericarm.xml b/configs/rocky-sbc-genericarm.xml new file mode 100644 index 0000000..6348717 --- /dev/null +++ b/configs/rocky-sbc-genericarm.xml @@ -0,0 +1,27 @@ + + + + + Release Engineering (SIG/Core) + releng@rockylinux.org + Rocky Linux + + + 9 + dnf + en_US + us + UTC + 9 + + + + + + + + + + + + diff --git a/configs/rocky-sbc-raspberrypi.xml b/configs/rocky-sbc-raspberrypi.xml new file mode 100644 index 0000000..7bc17b5 --- /dev/null +++ b/configs/rocky-sbc-raspberrypi.xml @@ -0,0 +1,26 @@ + + + + + Release Engineering (SIG/Core) + releng@rockylinux.org + Rocky Linux + + + 9 + dnf + en_US + us + UTC + 9 + + + + + + + + + + + diff --git a/configs/rocky.xml b/configs/rocky.xml new file mode 100644 index 0000000..d8c1c12 --- /dev/null +++ b/configs/rocky.xml @@ -0,0 +1,48 @@ + + + + + Release Engineering (SIG/Core) + releng@rockylinux.org + Rocky Linux + + + 9 + dnf + en_US + us + UTC + 9 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/container-build.sh b/container-build.sh new file mode 100755 index 0000000..4730cea --- /dev/null +++ b/container-build.sh @@ -0,0 +1,99 @@ +#!/bin/bash +# helps build a quick container image. that way a user doesn't have to use emapandas +# nor some other method. mock is probably not necessary, but it's up to you. +# label@resf.org + +set -o errexit +set -o pipefail + +SCRNAME="$(basename "$0")" +SCRDIR="$(dirname "${BASH_SOURCE[0]}")" + +export __usage +__usage=" +usage: $SCRNAME [OPTIONS] + +Options: + -o, --output-dir DIR + -c, --container NAME + -p, --peridot ID # optional. will use peridot repos. + -d, --debug # optional + +" + +OPTS=$(getopt -a -n container-build -o c:,o:,p:,d,h \ + -l container:,output-dir:,peridot:,debug,help -- "$@") + +function is_in_path() { + builtin type -P "${1}" +} + +function usage() { + echo "$__usage" +} + +eval set -- "$OPTS" +while :; do + case "$1" in + -c | --container) CONTAINER="$2" ; shift 2 ;; + -o | --output-dir) OUTPUTDIR="$2" ; shift 2 ;; + -p | --peridot) PERIDOTID="$2" ; shift 2 ;; + -d | --debug) DEBUG="--debug" ; shift ;; + -h | --help) usage ;; + --) shift ; break ;; + esac +done + +if [ -z "$CONTAINER" ] || [ -z "$OUTPUTDIR" ]; then + echo "Options are not set properly." + usage + exit 12 +fi + +if [ -e "/sys/fs/selinux/enforce" ]; then + enforce_check="$(cat /sys/fs/selinux/enforce)" + if [ "$enforce_check" -eq "1" ]; then + echo "Running with selinux enforcing is not recommended." + exit 22 + fi +fi + +is_in_path kiwi-ng &> /dev/null +ret_val=$? + +if [ "$ret_val" -ne "0" ]; then + echo "kiwi-ng not found. kiwi packages are likely not installed on this system." + exit 32 +fi + +function switch_repo_to_peridot() { + ID="$1" + # https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/ + pushd repositories || { echo "not found"; exit 1; } + sed -i "s;ZZ_INTERNAL_BaseOS_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/BaseOS/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_AppStream_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/AppStream/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_CRB_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/CRB/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_extras_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/extras/\$basearch;g" core-peridot.xml + rm core.xml + ln -sf core-peridot.xml core.xml + popd +} + +function main() { + #/bin/rm config.xml + #if [ ! -f "configs/rocky-live-${LIVE,,}.xml" ]; then + # echo "${LIVE} was not found. Is it supported?" + # exit 42 + #fi + #ln -sf "configs/rocky-live-${LIVE,,}.xml" config.xml + ln -sf "configs/rocky.xml" config.xml + + if [ -n "$PERIDOTID" ]; then + switch_repo_to_peridot "${PERIDOTID}" + fi + + # shellcheck disable=SC2086 + kiwi-ng $DEBUG --type="oci" --profile="Container-$CONTAINER" --color-output system build --description="$SCRDIR" --target-dir "$OUTPUTDIR" +} + +main diff --git a/container/container.xml b/container/container.xml new file mode 100644 index 0000000..3dc14dc --- /dev/null +++ b/container/container.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Etc/UTC + en_US + true + true + + + + + + + + + + + Etc/UTC + en_US + true + true + microdnf + + + + + + + + + + + Etc/UTC + en_US + true + true + + + + + + + + + + + Etc/UTC + en_US + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/grub.tmpl b/grub.tmpl new file mode 100644 index 0000000..d5c21eb --- /dev/null +++ b/grub.tmpl @@ -0,0 +1,46 @@ +# copied from a live built image, and modified to deal with non-uefi + +set default="${default_boot}" + +if [ "$$grub_platform" == "efi" ]; then + function load_video { + insmod efi_gop + insmod efi_uga + insmod video_bochs + insmod video_cirrus + insmod all_video + } + set basicgfx="nomodeset" +else + function load_video { + insmod all_video + } + set basicgfx="nomodeset vga=791" +fi + +load_video +set gfxpayload=keep +insmod gzio +insmod part_gpt +insmod ext2 + +terminal_input console +terminal_output ${terminal_output} +set timeout=${boot_timeout} + +search ${search_params} + +menuentry 'Start ${title}' --class fedora --class gnu-linux --class gnu --class os { + linux ($$root)${bootpath}/${kernel_file} ${boot_options} + initrd ($$root)${bootpath}/${initrd_file} +} +menuentry 'Test this media & start ${title}' --class fedora --class gnu-linux --class gnu --class os { + linux ($$root)${bootpath}/${kernel_file} ${boot_options} rd.live.check + initrd ($$root)${bootpath}/${initrd_file} +} +submenu "Troubleshooting -->" { + menuentry "Start ${title} in basic graphics mode" --class fedora --class gnu-linux --class gnu --class os { + linux ($$root)${bootpath}/${kernel_file} ${boot_options} $${basicgfx} + initrd ($$root)${bootpath}/${initrd_file} + } +} diff --git a/live-build.sh b/live-build.sh new file mode 100755 index 0000000..13dc97a --- /dev/null +++ b/live-build.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# helps build a quick live image. that way a user doesn't have to use emapandas +# nor livemedia-creator. mock is probably not necessary, but it's up to you. +# label@resf.org + +set -o errexit +set -o pipefail + +SCRNAME="$(basename "$0")" +SCRDIR="$(dirname "${BASH_SOURCE[0]}")" + +export __usage +__usage=" +usage: $SCRNAME [OPTIONS] + +Options: + -o, --output-dir DIR + -l, --live-image NAME + -m, --minor NUM + -p, --peridot ID # optional. will use peridot repos. + -d, --debug # optional + +" + +OPTS=$(getopt -a -n live-build -o l:,o:,p:,m:,d,h \ + -l live-image:,output-dir:,peridot:,minor:,debug,help -- "$@") + +function is_in_path() { + builtin type -P "${1}" +} + +function usage() { + echo "$__usage" +} + +eval set -- "$OPTS" +while :; do + case "$1" in + -l | --live-image) LIVE="$2" ; shift 2 ;; + -o | --output-dir) OUTPUTDIR="$2" ; shift 2 ;; + -p | --peridot) PERIDOTID="$2" ; shift 2 ;; + -m | --minor) MINOR="$2" ; shift 2 ;; + -d | --debug) DEBUG="--debug" ; shift ;; + -h | --help) usage ;; + --) shift ; break ;; + esac +done + +if [ -z "$LIVE" ] || [ -z "$OUTPUTDIR" ]; then + echo "Options are not set properly." + usage + exit 12 +fi + +if [ -e "/sys/fs/selinux/enforce" ]; then + enforce_check="$(cat /sys/fs/selinux/enforce)" + if [ "$enforce_check" -eq "1" ]; then + echo "Running with selinux enforcing is not recommended." + exit 22 + fi +fi + +is_in_path kiwi-ng &> /dev/null +ret_val=$? + +if [ "$ret_val" -ne "0" ]; then + echo "kiwi-ng not found. kiwi packages are likely not installed on this system." + exit 32 +fi + +function switch_repo_to_peridot() { + ID="$1" + # https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/ + pushd repositories || { echo "not found"; exit 1; } + sed -i "s;ZZ_INTERNAL_BaseOS_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/BaseOS/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_AppStream_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/AppStream/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_CRB_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/CRB/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_extras_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/extras/\$basearch;g" core-peridot.xml + rm core.xml + ln -sf core-peridot.xml core.xml + popd +} + +function main() { + /bin/rm config.xml + if [ ! -f "configs/rocky-live-${LIVE,,}.xml" ]; then + echo "${LIVE} was not found. Is it supported?" + exit 42 + fi + ln -sf "configs/rocky-live-${LIVE,,}.xml" config.xml + + if [ -n "$PERIDOTID" ]; then + switch_repo_to_peridot "${PERIDOTID}" + fi + + if [ -n "$MINOR" ]; then + sed -i "s/Rocky-9-/Rocky-9-$MINOR-/g" components/live/*.xml + sed -i "s/Rocky-9-/Rocky-9.$MINOR-/g" configs/rocky-live-*.xml + fi + + kiwi-ng $DEBUG --type="iso" --profile="$LIVE-Live" --color-output system build --description="$SCRDIR" --target-dir "$OUTPUTDIR" +} + +main diff --git a/live/cinnamon.xml b/live/cinnamon.xml new file mode 100644 index 0000000..824c999 --- /dev/null +++ b/live/cinnamon.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/live/kde.xml b/live/kde.xml new file mode 100644 index 0000000..0b7d6f8 --- /dev/null +++ b/live/kde.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/live/mate.xml b/live/mate.xml new file mode 100644 index 0000000..7b354fe --- /dev/null +++ b/live/mate.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/live/workstation-lite.xml b/live/workstation-lite.xml new file mode 100644 index 0000000..d84b6ba --- /dev/null +++ b/live/workstation-lite.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/live/workstation.xml b/live/workstation.xml new file mode 100644 index 0000000..96d8cae --- /dev/null +++ b/live/workstation.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/live/xfce.xml b/live/xfce.xml new file mode 100644 index 0000000..c3a09c3 --- /dev/null +++ b/live/xfce.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/repositories/altarch-common-default.xml b/repositories/altarch-common-default.xml new file mode 100644 index 0000000..dc51ae2 --- /dev/null +++ b/repositories/altarch-common-default.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/repositories/altarch-common.xml b/repositories/altarch-common.xml new file mode 120000 index 0000000..a220d67 --- /dev/null +++ b/repositories/altarch-common.xml @@ -0,0 +1 @@ +altarch-common-default.xml \ No newline at end of file diff --git a/repositories/cloud-common-default.xml b/repositories/cloud-common-default.xml new file mode 100644 index 0000000..7f76a68 --- /dev/null +++ b/repositories/cloud-common-default.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/repositories/cloud-common.xml b/repositories/cloud-common.xml new file mode 120000 index 0000000..0e08b7a --- /dev/null +++ b/repositories/cloud-common.xml @@ -0,0 +1 @@ +cloud-common-default.xml \ No newline at end of file diff --git a/repositories/core-default.xml b/repositories/core-default.xml new file mode 100644 index 0000000..a252cdb --- /dev/null +++ b/repositories/core-default.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/repositories/core-outside.xml b/repositories/core-outside.xml new file mode 100644 index 0000000..ad3dfe8 --- /dev/null +++ b/repositories/core-outside.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/repositories/core-peridot.xml b/repositories/core-peridot.xml new file mode 100644 index 0000000..fb3c408 --- /dev/null +++ b/repositories/core-peridot.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/repositories/core.xml b/repositories/core.xml new file mode 120000 index 0000000..4cce68c --- /dev/null +++ b/repositories/core.xml @@ -0,0 +1 @@ +core-default.xml \ No newline at end of file diff --git a/repositories/epel-default.xml b/repositories/epel-default.xml new file mode 100644 index 0000000..bb1e1de --- /dev/null +++ b/repositories/epel-default.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/repositories/epel-outside.xml b/repositories/epel-outside.xml new file mode 100644 index 0000000..f53c9f4 --- /dev/null +++ b/repositories/epel-outside.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/repositories/epel.xml b/repositories/epel.xml new file mode 120000 index 0000000..f622a9f --- /dev/null +++ b/repositories/epel.xml @@ -0,0 +1 @@ +epel-default.xml \ No newline at end of file diff --git a/repositories/gnulab-tmp.xml b/repositories/gnulab-tmp.xml new file mode 100644 index 0000000..0546c79 --- /dev/null +++ b/repositories/gnulab-tmp.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/repositories/kernel-common-default.xml b/repositories/kernel-common-default.xml new file mode 100644 index 0000000..c5ba59e --- /dev/null +++ b/repositories/kernel-common-default.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/repositories/kernel-common.xml b/repositories/kernel-common.xml new file mode 120000 index 0000000..4eb6240 --- /dev/null +++ b/repositories/kernel-common.xml @@ -0,0 +1 @@ +kernel-common-default.xml \ No newline at end of file diff --git a/repositories/oracle.xml b/repositories/oracle.xml new file mode 100644 index 0000000..e540611 --- /dev/null +++ b/repositories/oracle.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/repositories/sig-core-default.xml b/repositories/sig-core-default.xml new file mode 100644 index 0000000..44c9e42 --- /dev/null +++ b/repositories/sig-core-default.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/repositories/sig-core.xml b/repositories/sig-core.xml new file mode 120000 index 0000000..5e62888 --- /dev/null +++ b/repositories/sig-core.xml @@ -0,0 +1 @@ +sig-core-default.xml \ No newline at end of file diff --git a/root/etc/fstab.script b/root/etc/fstab.script new file mode 100644 index 0000000..3014007 --- /dev/null +++ b/root/etc/fstab.script @@ -0,0 +1,3 @@ +#!/bin/sh +# anaconda does this technically. +gawk -i inplace '$2 == "/boot/efi" { $4 = $4",umask=0077,shortname=winnt" } { print $0 }' /etc/fstab diff --git a/root/etc/sysconfig/kernel b/root/etc/sysconfig/kernel new file mode 100644 index 0000000..8da1970 --- /dev/null +++ b/root/etc/sysconfig/kernel @@ -0,0 +1,6 @@ +# UPDATEDEFAULT specifies if kernel-install should make +# new kernels the default +UPDATEDEFAULT=yes + +# DEFAULTKERNEL specifies the default kernel package type +DEFAULTKERNEL=kernel-core diff --git a/sbc-build.sh b/sbc-build.sh new file mode 100755 index 0000000..5723447 --- /dev/null +++ b/sbc-build.sh @@ -0,0 +1,98 @@ +#!/bin/bash +# helps build a quick sbc image. that way a user doesn't have to use emapandas +# nor some other method. mock is probably not necessary, but it's up to you. +# label@resf.org + +set -o errexit +set -o pipefail + +SCRNAME="$(basename "$0")" +SCRDIR="$(dirname "${BASH_SOURCE[0]}")" + +export __usage +__usage=" +usage: $SCRNAME [OPTIONS] + +Options: + -o, --output-dir DIR + -c, --sbc-image NAME + -p, --peridot ID # optional. will use peridot repos. + -d, --debug # optional + +" + +OPTS=$(getopt -a -n sbc-build -o c:,o:,p:,d,h \ + -l sbc-image:,output-dir:,peridot:,debug,help -- "$@") + +function is_in_path() { + builtin type -P "${1}" +} + +function usage() { + echo "$__usage" +} + +eval set -- "$OPTS" +while :; do + case "$1" in + -c | --sbc-image) SBC="$2" ; shift 2 ;; + -o | --output-dir) OUTPUTDIR="$2" ; shift 2 ;; + -p | --peridot) PERIDOTID="$2" ; shift 2 ;; + -d | --debug) DEBUG="--debug" ; shift ;; + -h | --help) usage ;; + --) shift ; break ;; + esac +done + +if [ -z "$SBC" ] || [ -z "$OUTPUTDIR" ]; then + echo "Options are not set properly." + usage + exit 12 +fi + +if [ -e "/sys/fs/selinux/enforce" ]; then + enforce_check="$(cat /sys/fs/selinux/enforce)" + if [ "$enforce_check" -eq "1" ]; then + echo "Running with selinux enforcing is not recommended." + exit 22 + fi +fi + +is_in_path kiwi-ng &> /dev/null +ret_val=$? + +if [ "$ret_val" -ne "0" ]; then + echo "kiwi-ng not found. kiwi packages are likely not installed on this system." + exit 32 +fi + +function switch_repo_to_peridot() { + ID="$1" + # https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/ + pushd repositories || { echo "not found"; exit 1; } + sed -i "s;ZZ_INTERNAL_BaseOS_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/BaseOS/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_AppStream_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/AppStream/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_CRB_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/CRB/\$basearch;g" core-peridot.xml + sed -i "s;ZZ_INTERNAL_extras_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/extras/\$basearch;g" core-peridot.xml + rm core.xml + ln -sf core-peridot.xml core.xml + popd +} + +function main() { + /bin/rm config.xml + if [ ! -f "configs/rocky-sbc-${SBC,,}.xml" ]; then + echo "${LIVE} was not found. Is it supported?" + exit 42 + fi + ln -sf "configs/rocky-sbc-${SBC,,}.xml" config.xml + + if [ -n "$PERIDOTID" ]; then + switch_repo_to_peridot "${PERIDOTID}" + fi + + # shellcheck disable=SC2086 + kiwi-ng $DEBUG --type="oem" --profile="SBC-$SBC" --color-output system build --description="$SCRDIR" --target-dir "$OUTPUTDIR" +} + +main diff --git a/sbc/editbootinstall_genericarm.sh b/sbc/editbootinstall_genericarm.sh new file mode 100644 index 0000000..332676a --- /dev/null +++ b/sbc/editbootinstall_genericarm.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Modify this script to handle disk changes as needed. +# Some of this may be incorrect or not needed. You will need to verify this. + +set -ex + +#diskname="$1" +#devname="$2" +#loopname="${devname%*p2}" +#loopdev=/dev/${loopname#/dev/mapper/*} + +# shellcheck disable=SC2034 +image_fs="$1" +root_partnum="$2" +root_device="/dev/mapper/loop*p${root_partnum}" +loop_name="$(basename $root_device | cut -f 1-2 -d 'p')" +disk_device="/dev/${loop_name}" + +# pi's probably don't support GPT. + +cat > gdisk.tmp <<-'EOF' + x + r + g + t + 1 + c + w + y + EOF + + dd if="$disk_device" of=mbrid.bin bs=1 skip=440 count=4 + gdisk "$disk_device" < gdisk.tmp + dd of="$disk_device" if=mbrid.bin bs=1 seek=440 count=4 + rm -f mbrid.bin + rm -rf gdisk.tmp diff --git a/sbc/editbootinstall_rpi.sh b/sbc/editbootinstall_rpi.sh new file mode 100644 index 0000000..332676a --- /dev/null +++ b/sbc/editbootinstall_rpi.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Modify this script to handle disk changes as needed. +# Some of this may be incorrect or not needed. You will need to verify this. + +set -ex + +#diskname="$1" +#devname="$2" +#loopname="${devname%*p2}" +#loopdev=/dev/${loopname#/dev/mapper/*} + +# shellcheck disable=SC2034 +image_fs="$1" +root_partnum="$2" +root_device="/dev/mapper/loop*p${root_partnum}" +loop_name="$(basename $root_device | cut -f 1-2 -d 'p')" +disk_device="/dev/${loop_name}" + +# pi's probably don't support GPT. + +cat > gdisk.tmp <<-'EOF' + x + r + g + t + 1 + c + w + y + EOF + + dd if="$disk_device" of=mbrid.bin bs=1 skip=440 count=4 + gdisk "$disk_device" < gdisk.tmp + dd of="$disk_device" if=mbrid.bin bs=1 seek=440 count=4 + rm -f mbrid.bin + rm -rf gdisk.tmp diff --git a/sbc/pi.xml b/sbc/pi.xml new file mode 100644 index 0000000..bd0e32a --- /dev/null +++ b/sbc/pi.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + false + true + true + 512 + + + + + + + + false + true + true + 500 + + + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vagrant/vagrant.xml b/vagrant/vagrant.xml new file mode 100644 index 0000000..2826f4d --- /dev/null +++ b/vagrant/vagrant.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + 10 + + + + + + + + false + + + 10 + + + + + + + + + + false + + + 10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wsl/default.xml b/wsl/default.xml new file mode 100644 index 0000000..c3a09c3 --- /dev/null +++ b/wsl/default.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + +