2017-01-19 19:11:49 +00:00
|
|
|
# This is a minimal Fedora install designed to serve as a Docker base image.
|
|
|
|
#
|
|
|
|
# To keep this image minimal it only installs English language. You need to change
|
|
|
|
# yum configuration in order to enable other languages.
|
|
|
|
#
|
|
|
|
### Hacking on this image ###
|
|
|
|
# This kickstart is processed using Anaconda-in-ImageFactory (via Koji typically),
|
|
|
|
# but you can run imagefactory locally too.
|
|
|
|
#
|
|
|
|
# To do so, testing local changes, first you'll need a TDL file. I store one here:
|
|
|
|
# https://git.fedorahosted.org/cgit/fedora-atomic.git/tree/fedora-atomic-rawhide.tdl
|
|
|
|
#
|
|
|
|
# Then, once you have imagefactory and imagefactory-plugins installed, run:
|
|
|
|
#
|
|
|
|
# imagefactory --debug target_image --template /path/to/fedora-atomic-rawhide.tdl --parameter offline_icicle true --file-parameter install_script $(pwd)/fedora-docker-base.ks docker
|
|
|
|
#
|
|
|
|
|
|
|
|
text # don't use cmdline -- https://github.com/rhinstaller/anaconda/issues/931
|
|
|
|
bootloader --disabled
|
|
|
|
timezone --isUtc --nontp Etc/UTC
|
|
|
|
rootpw --lock --iscrypted locked
|
|
|
|
|
|
|
|
keyboard us
|
|
|
|
zerombr
|
|
|
|
clearpart --all
|
|
|
|
part / --fstype ext4 --grow
|
|
|
|
network --bootproto=dhcp --device=link --activate --onboot=on
|
|
|
|
reboot
|
|
|
|
|
2017-01-20 03:06:33 +00:00
|
|
|
%packages --excludedocs --instLangs=en --nocore --excludeWeakdeps
|
2017-01-19 19:11:49 +00:00
|
|
|
bash
|
|
|
|
fedora-release
|
2017-01-20 03:06:33 +00:00
|
|
|
microdnf
|
2017-01-19 19:11:49 +00:00
|
|
|
-kernel
|
|
|
|
|
|
|
|
|
|
|
|
%end
|
|
|
|
|
|
|
|
%post --erroronfail --log=/root/anaconda-post.log
|
|
|
|
set -eux
|
|
|
|
|
|
|
|
# Set install langs macro so that new rpms that get installed will
|
|
|
|
# only install langs that we limit it to.
|
|
|
|
LANG="en_US"
|
|
|
|
echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf
|
|
|
|
|
|
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1400682
|
|
|
|
echo "Import RPM GPG key"
|
|
|
|
releasever=$(rpm -q --qf '%{version}\n' fedora-release)
|
|
|
|
basearch=$(uname -i)
|
|
|
|
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
|
|
|
|
|
|
|
|
echo "# fstab intentionally empty for containers" > /etc/fstab
|
|
|
|
|
|
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1343138
|
|
|
|
# Fix /run/lock breakage since it's not tmpfs in docker
|
|
|
|
# This unmounts /run (tmpfs) and then recreates the files
|
|
|
|
# in the /run directory on the root filesystem of the container
|
|
|
|
umount /run
|
2017-01-20 03:24:41 +00:00
|
|
|
# The file that specifies the /run/lock tmpfile is
|
|
|
|
# /usr/lib/tmpfiles.d/legacy.conf, which is part of the systemd
|
|
|
|
# rpm that isn't included in this image. We'll create the /run/lock
|
|
|
|
# file here manually with the settings from legacy.conf
|
|
|
|
install -d /run/lock -m 0755 -o root -g root
|
2017-01-19 19:11:49 +00:00
|
|
|
|
|
|
|
# Remove machine-id on pre generated images
|
|
|
|
rm -f /etc/machine-id
|
|
|
|
touch /etc/machine-id
|
|
|
|
|
2017-01-20 03:32:12 +00:00
|
|
|
# remove some random help txt files
|
2017-01-20 02:32:36 +00:00
|
|
|
rm usr/share/gnupg/help*.txt -f
|
|
|
|
|
|
|
|
|
|
|
|
# Pruning random things
|
2017-01-20 03:32:12 +00:00
|
|
|
rm usr/lib/rpm/rpm.daily
|
2017-01-20 02:32:36 +00:00
|
|
|
rm usr/lib64/nss/unsupported-tools/ -rf # unsupported
|
|
|
|
|
|
|
|
# Statically linked crap
|
|
|
|
rm usr/sbin/{glibc_post_upgrade.x86_64,sln}
|
|
|
|
ln usr/bin/ln usr/sbin/sln
|
|
|
|
|
|
|
|
# Final pruning
|
2017-01-20 03:30:39 +00:00
|
|
|
rm -rf var/cache/* var/log/* tmp/*
|
2017-01-20 02:32:36 +00:00
|
|
|
|
2017-01-19 19:11:49 +00:00
|
|
|
%end
|
2017-01-20 03:36:54 +00:00
|
|
|
|
|
|
|
%post --nochroot --erroronfail --log=/mnt/sysimage/root/anaconda-post-nochroot.log
|
|
|
|
set -eux
|
|
|
|
|
|
|
|
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1051816
|
|
|
|
# NOTE: run this in nochroot because "find" does not exist in chroot
|
|
|
|
KEEPLANG=en_US
|
|
|
|
for dir in locale i18n; do
|
|
|
|
find /mnt/sysimage/usr/share/${dir} -mindepth 1 -maxdepth 1 -type d -not \( -name "${KEEPLANG}" -o -name POSIX \) -exec rm -rf {} +
|
|
|
|
done
|
|
|
|
|
|
|
|
%end
|