Adds msvsphere-systemd Docker image configuration

master
Eugene Zamriy 1 year ago
parent 6f7e4a7f09
commit 6950f26f75
Signed by: ezamriy
GPG Key ID: 7EBF95C7DCFA496C

@ -14,7 +14,7 @@ show_usage() {
echo -e 'Usage: build-image.sh [OPTION]...\n'
echo ' -h, --help show this message and exit'
echo " -r, --release RELEASE target MSVSphere release, default is ${RELEASE}"
echo ' -t, --type TYPE image type, supported values are: default.'
echo ' -t, --type TYPE image type, supported values are: default, systemd.'
echo " Default value is '${IMAGE_TYPE}'"
echo " -o, --output DIR output directory path, default is ${BASE_DIR}"
echo ' -v, --version show program version and exit'
@ -43,6 +43,11 @@ gen_dockerfile() {
default)
echo 'CMD ["/bin/bash"]'
;;
systemd)
echo 'STOPSIGNAL SIGRTMIN+3'
echo ''
echo 'CMD ["/sbin/init"]'
;;
*)
log_error "unsupported image type ${IMAGE_TYPE}"
exit 1
@ -93,9 +98,18 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
show_usage
exit 0
;;
-r | --release)
if [[ -z "${2}" ]]; then
log_error 'release is required'
exit 2
fi
RELEASE="${2}"
shift
shift
;;
-t | --type)
case "${2}" in
default)
default | systemd)
IMAGE_TYPE="${2}"
;;
*)

@ -0,0 +1,114 @@
# MSVSphere 9 systemd Docker image kickstart file
# TODO: change to the kickstart repo URL when we have it
url --url https://rsync.inferitos.ru/msvsphere/9/BaseOS/$basearch/os/
repo --name=BaseOS --baseurl=https://rsync.inferitos.ru/msvsphere/9/BaseOS/$basearch/os/
repo --name=AppStream --baseurl=https://rsync.inferitos.ru/msvsphere/9/AppStream/$basearch/os/
lang C.UTF-8
keyboard us
timezone --nontp --utc UTC
network --activate --bootproto=dhcp --device=link --onboot=on
selinux --disabled
bootloader --disabled
zerombr
clearpart --all --initlabel
autopart --fstype=ext4 --type=plain --nohome --noboot --noswap
rootpw --lock --plaintext msvsphere
shutdown
%packages --excludedocs --nocore --instLangs=en --excludeWeakdeps
sphere-release
bash
coreutils-single
crypto-policies-scripts
curl-minimal
findutils
gdb-gdbserver
glibc-minimal-langpack
gzip
libcurl-minimal
libusbx
procps-ng
rootfiles
systemd
tar
usermode
vim-minimal
virt-what
yum
-dosfstools
-e2fsprogs
-gnupg2-smime
-hyperv*
-kernel
-langpacks-*
-langpacks-en
-libss
-open-vm-tools
-pinentry
-qemu-guest-agent
-subscription-manager
-trousers
-xfsprogs
-xkeyboard-config
%end
# NOTE: add --log=/root/anaconda-post.log for debugging
%post --erroronfail
# generate build time file for compatibility with CentOS
/bin/date +%Y%m%d_%H%M > /etc/BUILDTIME
# Change format of the RPM database from Berkeley DB to a new SQLite format
rpmdb --rebuilddb
# set DNF infra variable to container for compatibility with CentOS
echo 'container' > /etc/dnf/vars/infra
# import MSVSphere PGP key
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-MSVSphere-9
# install only C.UTF-8 locale files, see
# https://fedoraproject.org/wiki/Changes/Glibc_locale_subpackaging for details
LANG="C.utf8"
echo "%_install_langs $LANG" > /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, mounts and fix: https://bugzilla.redhat.com/show_bug.cgi?id=1472439
systemctl mask systemd-remount-fs.service \
dev-hugepages.mount \
sys-fs-fuse-connections.mount \
systemd-logind.service \
getty.target \
console-getty.service \
systemd-udev-trigger.service \
systemd-udevd.service \
systemd-random-seed.service \
systemd-machine-id-commit.service
KEEPLANG=en_US
for dir in locale i18n; do
find /usr/share/${dir} -mindepth 1 -maxdepth 1 -type d -not \( -name "${KEEPLANG}" -o -name POSIX \) -exec rm -rfv {} +
done
# remove unnecessary files
rm -f /var/lib/dnf \
/run/nologin
rm -fr /var/log/* \
/tmp/* /tmp/.* \
/boot || true
%end
Loading…
Cancel
Save