Last active
October 22, 2024 18:18
-
-
Save sirredbeard/48aa932c1e4e33339467402503dc7a91 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Rough AlmaLinux 10 kickstart file for base WSL image based on outdated AlmaLinux 8 kickstart file @ https://github.com/AlmaLinux/wsl-images/blob/master/rootfs/kickstart/almalinux-8-wsl-deprecated.ks | |
| # install | |
| url --url https://kitten.repo.almalinux.org/10-kitten/BaseOS/$basearch/os/ | |
| lang en_US.UTF-8 | |
| keyboard us | |
| timezone --nontp --utc UTC | |
| network --activate --bootproto=dhcp --device=link --onboot=on | |
| firewall --disabled | |
| selinux --disabled | |
| bootloader --disable | |
| zerombr | |
| clearpart --all --initlabel | |
| part / --fstype="ext4" --size=1700 | |
| rootpw --lock | |
| shutdown | |
| %packages --ignoremissing --excludedocs --instLangs=en --nocore | |
| @^minimal-environment | |
| dmidecode | |
| findutils | |
| file | |
| gdb-gdbserver | |
| iputils | |
| libmetalink | |
| nano | |
| passwd | |
| pciutils | |
| procps-ng | |
| rootfiles | |
| sudo | |
| tar | |
| tmux | |
| ncurses | |
| usermode | |
| vim-minimal | |
| virt-what | |
| which | |
| yum | |
| yum-utils | |
| xz | |
| -audit | |
| -dnf-plugin-subscription-manager | |
| -dosfstools | |
| -e2fsprogs | |
| -firewalld | |
| -fuse-libs | |
| -gnupg2-smime | |
| -grub\* | |
| -iptables | |
| -kernel | |
| -libss | |
| -openssh-server | |
| -open-vm-tools | |
| -os-prober | |
| -pinentry | |
| -qemu-guest-agent | |
| -shared-mime-info | |
| -subscription-manager | |
| -trousers | |
| -xfsprogs | |
| -xkeyboard-config | |
| %end | |
| %post --erroronfail --log=/root/anaconda-post.log | |
| # generate build time file for compatibility with CentOS | |
| /bin/date +%Y%m%d_%H%M > /etc/BUILDTIME | |
| # set DNF infra variable to container for compatibility with CentOS | |
| echo 'container' > /etc/dnf/vars/infra | |
| # import AlmaLinux PGP key | |
| rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux | |
| # install only en_US.UTF-8 locale files, see | |
| # https://fedoraproject.org/wiki/Changes/Glibc_locale_subpackaging for details | |
| LANG="en_US" | |
| echo '%_install_langs en_US.UTF-8' > /etc/rpm/macros.image-language-conf | |
| # https://bugzilla.redhat.com/show_bug.cgi?id=1727489 | |
| echo 'LANG="C.UTF-8"' > /etc/locale.conf | |
| # force each container to have a unique machine-id | |
| > /etc/machine-id | |
| # create tmp directories because there is no tmpfs support in Docker | |
| umount /run | |
| systemd-tmpfiles --create --boot | |
| # disable login prompt and mounts | |
| systemctl mask console-getty.service \ | |
| dev-hugepages.mount \ | |
| getty.target \ | |
| systemd-logind.service \ | |
| sys-fs-fuse-connections.mount \ | |
| systemd-remount-fs.service | |
| # remove unnecessary files | |
| rm -f /var/lib/dnf/history.* \ | |
| /run/nologin | |
| rm -fr /var/log/* \ | |
| /tmp/* /tmp/.* \ | |
| /boot || true | |
| %end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # based on https://github.com/AlmaLinux/wsl-images/blob/master/rootfs/build.sh | |
| # dependencies: sudo dnf -y install lorax anaconda | |
| # I highly recommend building on a recent Fedora release to get latest version of Lorax (which contains livemedia-creator) | |
| set -euo pipefail | |
| RELEASE_VER='10' | |
| ARCH=$(uname -m) | |
| IMAGE_NAME="almalinux-${RELEASE_VER}-${ARCH}-wsl.tar.gz" | |
| KS_PATH="almalinux10.ks" | |
| OUTPUT_DIR="./result/${ARCH}" | |
| if [[ -d "${OUTPUT_DIR}" ]]; then | |
| echo "Output directory ${OUTPUT_DIR} already exists, please remove it" | |
| exit 1 | |
| fi | |
| livemedia-creator --no-virt --make-tar --ks "${KS_PATH}" \ | |
| --image-name="${IMAGE_NAME}" \ | |
| --project "AlmaLinux OS ${RELEASE_VER} WSL" \ | |
| --releasever "${RELEASE_VER}" \ | |
| --resultdir "${OUTPUT_DIR}" \ | |
| --compression gzip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment