File config.sh of Package minimal-vm

#!/bin/bash
#================
# FILE          : config.sh
#----------------
# PROJECT       : openSuSE KIWI Image System
# COPYRIGHT     : (c) 2006 SUSE LINUX Products GmbH. All rights reserved
#               : (c) 2019-2023 openSUSE Contributors
#               :
# AUTHOR        : Marcus Schaefer <ms@suse.de>
# MAINTAINER    : openSUSE Heroes <admin@opensuse.org>
#               :
# BELONGS TO    : Operating System images
#               :
# DESCRIPTION   : configuration script for openSUSE virtual machine images
#----------------
#======================================
# Variables...
#--------------------------------------
DISTURL='http://download.infra.opensuse.org'

#======================================
# Functions...
#--------------------------------------
test -f /.kconfig && . /.kconfig
test -f /.profile && . /.profile

set -euxo pipefail

#======================================
# Greeting...
#--------------------------------------
echo "Configure image: [$kiwi_iname]-[$kiwi_profiles]..."

#======================================
# Remove identifiers
#--------------------------------------
rm  \
   /var/lib/zypp/AnonymousUniqueId

#======================================
# Setup baseproduct link
#--------------------------------------
suseSetupProduct

#======================================
# Specify default systemd target
#--------------------------------------
baseSetRunlevel multi-user.target

#======================================
# Remove all locales beside:
#--------------------------------------
baseStripLocales en

#======================================
# Remove all translations beside:
#--------------------------------------
baseStripTranslations en

#======================================
# Import RPM keys
#--------------------------------------
# default keys
suseImportBuildKey

#======================================
# Configure repositories
#--------------------------------------
rm -r /etc/zypp/repos.d
zypper ar        --no-check           "${DISTURL}/distribution/leap/\$releasever/repo/oss/" repo-oss
zypper ar        --no-check --refresh "${DISTURL}/update/leap/\$releasever/backports/" repo-backports-update
zypper ar        --no-check --refresh "${DISTURL}/update/leap/\$releasever/oss/" repo-update-oss
zypper ar        --no-check --refresh "${DISTURL}/update/leap/\$releasever/sle/" repo-sle-update

#=====================================
# Configure snapper
#-------------------------------------
if [ "${kiwi_btrfs_root_is_snapshot:-false}" = 'true' ]; then
        cp /usr/share/snapper/config-templates/default /etc/snapper/configs/root
        baseUpdateSysConfig /etc/sysconfig/snapper SNAPPER_CONFIGS root
        sed -i -e '/^TIMELINE_CREATE=/s/yes/no/' \
               -e '/^NUMBER_LIMIT=/s/50/10/'     \
               /etc/snapper/configs/root
fi

#=====================================
# Configure Dracut
#-------------------------------------
echo "nowaitforswap=yes" >> /etc/dracut.conf.d/10-disable_swap.conf

#=====================================
# Configure securetty
#-------------------------------------
# allow root login via serial console for debugging
tee /etc/securetty <<EOF
ttyS0
ttyS1
ttyS2
hvc0
console
EOF

#=====================================
# Configure security
#-------------------------------------
baseUpdateSysConfig /etc/sysconfig/security PERMISSION_SECURITY 'secure local'
chkstat --system --set

exit 0
openSUSE Build Service is sponsored by