|
| 1 | +#version=RHEL8 |
| 2 | +# Reboot after installation |
| 3 | +reboot |
| 4 | +# Use text mode install |
| 5 | +text |
| 6 | + |
| 7 | +repo --name="koji-override-0" --baseurl=http://download.devel.redhat.com/released/rhel-8/RHEL-8/8.10.0/BaseOS/x86_64/os/ --noverifyssl |
| 8 | +repo --name="koji-override-1" --baseurl=https://rhsm-pulp.corp.redhat.com/content/dist/rhel8/8/x86_64/appstream/os --noverifyssl |
| 9 | +repo --name="koji-override-2" --baseurl=https://rhsm-pulp.corp.redhat.com/content/dist/rhel8/8/x86_64/baseos/os --noverifyssl |
| 10 | +repo --name="koji-override-3" --baseurl=http://download.devel.redhat.com/released/rhel-8/RHEL-8/8.10.0/AppStream/x86_64/os/ --noverifyssl |
| 11 | + |
| 12 | +%post --logfile=/root/anaconda-post.log --erroronfail |
| 13 | +set -eux |
| 14 | + |
| 15 | +# Support for subscription-manager secrets |
| 16 | +ln -s /run/secrets/etc-pki-entitlement /etc/pki/entitlement-host |
| 17 | +ln -s /run/secrets/rhsm /etc/rhsm-host |
| 18 | + |
| 19 | +#https://bugzilla.redhat.com/show_bug.cgi?id=1201663 |
| 20 | +rm -f /etc/systemd/system/multi-user.target.wants/rhsmcertd.service |
| 21 | + |
| 22 | +#fips mode |
| 23 | +# secrets patch creates /run/secrets/system-fips if /etc/system-fips exists on the host |
| 24 | +#in turn, openssl in the container checks /etc/system-fips but dangling symlink counts as nonexistent |
| 25 | +ln -s /run/secrets/system-fips /etc/system-fips |
| 26 | + |
| 27 | +# Set install langs macro so that new rpms that get installed will |
| 28 | +# only install langs that we limit it to. |
| 29 | +LANG="C.utf8" |
| 30 | +echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf |
| 31 | +echo "LANG=C.utf8" > /etc/locale.conf |
| 32 | + |
| 33 | +# https://bugzilla.redhat.com/show_bug.cgi?id=1400682 |
| 34 | +# https://bugzilla.redhat.com/show_bug.cgi?id=1672230 |
| 35 | +echo "Import RPM GPG key" |
| 36 | +rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 37 | + |
| 38 | +#echo "# fstab intentionally empty for containers" > /etc/fstab |
| 39 | +#this is not possible, guestmount needs fstab => brew build crashes without it |
| 40 | +#fstab is removed in TDL when tar-ing files |
| 41 | + |
| 42 | +# Remove network configuration files leftover from anaconda installation |
| 43 | +# https://bugzilla.redhat.com/show_bug.cgi?id=1713089 |
| 44 | +rm -f /etc/sysconfig/network-scripts/ifcfg-* |
| 45 | + |
| 46 | +# Remove machine-id on pre generated images |
| 47 | +rm -f /etc/machine-id |
| 48 | +touch /etc/machine-id |
| 49 | +# Keep permissions the same as the systemd RPM so rpm --verify works |
| 50 | +chmod 0444 /etc/machine-id |
| 51 | + |
| 52 | +%end |
| 53 | + |
| 54 | +%post --logfile=/root/anaconda-post.log --erroronfail |
| 55 | +# remove some random help txt files |
| 56 | +rm -fv usr/share/gnupg/help*.txt |
| 57 | + |
| 58 | +# Pruning random things |
| 59 | +rm usr/lib/rpm/rpm.daily |
| 60 | +rm -rfv usr/lib64/nss/unsupported-tools/ # unsupported |
| 61 | + |
| 62 | +# Statically linked crap |
| 63 | +rm -fv usr/sbin/{glibc_post_upgrade.x86_64,sln} |
| 64 | +ln usr/bin/ln usr/sbin/sln |
| 65 | + |
| 66 | +# Remove some dnf info |
| 67 | +rm -rfv /var/lib/dnf |
| 68 | + |
| 69 | +# don't need icons |
| 70 | +rm -rfv /usr/share/icons/* |
| 71 | + |
| 72 | +#some random not-that-useful binaries |
| 73 | +rm -fv /usr/bin/pinky |
| 74 | + |
| 75 | +# we lose presets by removing /usr/lib/systemd but we do not care |
| 76 | +rm -rfv /usr/lib/systemd |
| 77 | + |
| 78 | +# if you want to change the timezone, bind-mount it from the host or reinstall tzdata |
| 79 | +rm -fv /etc/localtime |
| 80 | +mv /usr/share/zoneinfo/UTC /etc/localtime |
| 81 | +rm -rfv /usr/share/zoneinfo |
| 82 | + |
| 83 | +# Final pruning |
| 84 | +rm -rfv /var/cache/* /var/log/* /tmp/* |
| 85 | + |
| 86 | +# remove the original RHEL8 EULA |
| 87 | +# TODO: This affects the integrity of the installed rpm. Find a better way. |
| 88 | +rm -f /usr/share/redhat-release/EULA |
| 89 | + |
| 90 | +# install the repofile |
| 91 | +cat > /etc/yum.repos.d/ubi.repo <<EOF |
| 92 | +[ubi-8-baseos-rpms] |
| 93 | +name = Red Hat Universal Base Image 8 (RPMs) - BaseOS |
| 94 | +baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/baseos/os |
| 95 | +enabled = 1 |
| 96 | +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 97 | +gpgcheck = 1 |
| 98 | + |
| 99 | +[ubi-8-baseos-debug-rpms] |
| 100 | +name = Red Hat Universal Base Image 8 (Debug RPMs) - BaseOS |
| 101 | +baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/baseos/debug |
| 102 | +enabled = 0 |
| 103 | +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 104 | +gpgcheck = 1 |
| 105 | + |
| 106 | +[ubi-8-baseos-source] |
| 107 | +name = Red Hat Universal Base Image 8 (Source RPMs) - BaseOS |
| 108 | +baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/baseos/source/SRPMS |
| 109 | +enabled = 0 |
| 110 | +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 111 | +gpgcheck = 1 |
| 112 | + |
| 113 | +[ubi-8-appstream-rpms] |
| 114 | +name = Red Hat Universal Base Image 8 (RPMs) - AppStream |
| 115 | +baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/appstream/os |
| 116 | +enabled = 1 |
| 117 | +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 118 | +gpgcheck = 1 |
| 119 | + |
| 120 | +[ubi-8-appstream-debug-rpms] |
| 121 | +name = Red Hat Universal Base Image 8 (Debug RPMs) - AppStream |
| 122 | +baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/appstream/debug |
| 123 | +enabled = 0 |
| 124 | +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 125 | +gpgcheck = 1 |
| 126 | + |
| 127 | +[ubi-8-appstream-source] |
| 128 | +name = Red Hat Universal Base Image 8 (Source RPMs) - AppStream |
| 129 | +baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/appstream/source/SRPMS |
| 130 | +enabled = 0 |
| 131 | +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 132 | +gpgcheck = 1 |
| 133 | + |
| 134 | +[ubi-8-codeready-builder-rpms] |
| 135 | +name = Red Hat Universal Base Image 8 (RPMs) - CodeReady Builder |
| 136 | +baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/codeready-builder/os |
| 137 | +enabled = 1 |
| 138 | +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 139 | +gpgcheck = 1 |
| 140 | + |
| 141 | +[ubi-8-codeready-builder] |
| 142 | +name = Red Hat Universal Base Image 8 (RPMs) - CodeReady Builder |
| 143 | +baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/codeready-builder/os |
| 144 | +enabled = 0 |
| 145 | +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 146 | +gpgcheck = 1 |
| 147 | + |
| 148 | + |
| 149 | +[ubi-8-codeready-builder-debug-rpms] |
| 150 | +name = Red Hat Universal Base Image 8 (Debug RPMs) - CodeReady Builder |
| 151 | +baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/codeready-builder/debug |
| 152 | +enabled = 0 |
| 153 | +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 154 | +gpgcheck = 1 |
| 155 | + |
| 156 | +[ubi-8-codeready-builder-source] |
| 157 | +name = Red Hat Universal Base Image 8 (Source RPMs) - CodeReady Builder |
| 158 | +baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/codeready-builder/source/SRPMS |
| 159 | +enabled = 0 |
| 160 | +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 161 | +gpgcheck = 1 |
| 162 | +EOF |
| 163 | + |
| 164 | +%end |
| 165 | + |
| 166 | +%post --nochroot --logfile=/mnt/sysimage/root/anaconda-post-nochroot.log --erroronfail |
| 167 | +set -eux |
| 168 | + |
| 169 | +# https://bugzilla.redhat.com/show_bug.cgi?id=1343138 |
| 170 | +# Fix /run/lock breakage since it's not tmpfs in docker |
| 171 | +# This unmounts /run (tmpfs) and then recreates the files |
| 172 | +# in the /run directory on the root filesystem of the container |
| 173 | +# NOTE: run this in nochroot because "umount" does not exist in chroot |
| 174 | +umount /mnt/sysimage/run |
| 175 | +# The file that specifies the /run/lock tmpfile is |
| 176 | +# /usr/lib/tmpfiles.d/legacy.conf, which is part of the systemd |
| 177 | +# rpm that isn't included in this image. We'll create the /run/lock |
| 178 | +# file here manually with the settings from legacy.conf |
| 179 | +# NOTE: chroot to run "install" because it is not in anaconda env |
| 180 | +chroot /mnt/sysimage install -d /run/lock -m 0755 -o root -g root |
| 181 | + |
| 182 | + |
| 183 | +# See: https://bugzilla.redhat.com/show_bug.cgi?id=1051816 |
| 184 | +# NOTE: run this in nochroot because "find" does not exist in chroot |
| 185 | +KEEPLANG=en_US |
| 186 | +for dir in locale i18n; do |
| 187 | + find /mnt/sysimage/usr/share/${dir} -mindepth 1 -maxdepth 1 -type d -not \( -name "${KEEPLANG}" -o -name POSIX \) -exec rm -rfv {} + |
| 188 | +done |
| 189 | + |
| 190 | +%end |
| 191 | + |
| 192 | +%packages --excludedocs --nocore --instLangs=en --excludeWeakdeps |
| 193 | +bash |
| 194 | +coreutils-single |
| 195 | +glibc-minimal-langpack |
| 196 | +libusbx |
| 197 | +microdnf |
| 198 | +redhat-release |
| 199 | +rootfiles |
| 200 | +-crypto-policies-scripts |
| 201 | +-dosfstools |
| 202 | +-e2fsprogs |
| 203 | +-fuse-libs |
| 204 | +-gnupg2-smime |
| 205 | +-kernel |
| 206 | +-libss |
| 207 | +-pinentry |
| 208 | +-qemu-guest-agent |
| 209 | +-shared-mime-info |
| 210 | +-trousers |
| 211 | +-xfsprogs |
| 212 | +-xkeyboard-config |
| 213 | + |
| 214 | +%end |
| 215 | + |
| 216 | +# Keyboard layouts |
| 217 | +keyboard --vckeymap=us --xlayouts='us' |
| 218 | +# System language |
| 219 | +lang en_US.UTF-8 |
| 220 | + |
| 221 | +# Network information |
| 222 | +network --bootproto=dhcp --device=link --activate |
| 223 | +network --hostname=localhost.localdomain |
| 224 | + |
| 225 | +# Use network installation |
| 226 | +url --url="http://download.devel.redhat.com/released/rhel-8/RHEL-8/8.10.0/BaseOS/x86_64/os/" --noverifyssl |
| 227 | + |
| 228 | +# Do not configure the X Window System |
| 229 | +skipx |
| 230 | + |
| 231 | +ignoredisk --only-use=vda |
| 232 | +# System bootloader configuration |
| 233 | +bootloader --disabled |
| 234 | +autopart --type=plain --fstype=ext4 --nohome --noboot --noswap |
| 235 | +# Clear the Master Boot Record |
| 236 | +zerombr |
| 237 | +# Partition clearing information |
| 238 | +clearpart --all |
| 239 | + |
| 240 | +# System timezone |
| 241 | +timezone Etc/UTC --isUtc --nontp |
| 242 | + |
| 243 | +# Root password |
| 244 | +rootpw --iscrypted --lock locked |
| 245 | + |
| 246 | +%addon com_redhat_kdump --disable --reserve-mb='auto' |
| 247 | + |
| 248 | +%end |
0 commit comments