File config.sh of Package SLES15-SP4-SAP-Azure-LI-BYOS

#!/bin/bash
#================
# FILE          : config.sh
#----------------
# PROJECT       : SUSE Public Cloud recipes
# COPYRIGHT     : (c) 2022 SUSE LLC. All rights reserved
#               : 
# CONTACT       : Public Cloud Team public-cloud-dev@susecloud.net
#               :
# BELONGS TO    : Operating System images
#               :
# DESCRIPTION   : OS configuration script
#               :
#               :
# STATUS        : Production
# GENERATED BY  : keg 1.2.0 on 2022-02-08 15:32:46
#----------------
#======================================
# Functions...
#--------------------------------------
test -f /.kconfig && . /.kconfig
test -f /.profile && . /.profile

#======================================
# Fail build on error
#--------------------------------------
set -e

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

#======================================
# Setup the build keys
#--------------------------------------
suseImportBuildKey

# keg: included from common-sysconfig
baseUpdateSysConfig /etc/sysconfig/keyboard COMPOSETABLE "clear latin1.add"
baseUpdateSysConfig /etc/sysconfig/language INSTALLED_LANGUAGES ""
baseUpdateSysConfig /etc/sysconfig/language RC_LANG "C.UTF-8"
baseUpdateSysConfig /etc/sysconfig/security POLKIT_DEFAULT_PRIVS "restrictive"
baseUpdateSysConfig /etc/sysconfig/windowmanager DEFAULT_WM ""
baseUpdateSysConfig /etc/sysconfig/windowmanager INSTALL_DESKTOP_EXTENSIONS "no"

# keg: included from common-sysconfig
cat >> "/etc/profile" <<EOF
# yast in Public Cloud images fix
NCURSES_NO_UTF8_ACS=1
export NCURSES_NO_UTF8_ACS
EOF
cat >> "/etc/sysconfig/console" <<EOF
CONSOLE_ENCODING="UTF-8"
CONSOLE_FONT="lat9w-16.psfu"
CONSOLE_SCREENMAP="trivial"
EOF

# keg: included from sles4sap-variant
cat >> "/etc/os-release" <<EOF
VARIANT_ID="sles-sap"
EOF

# keg: included from common-config
# Start generate /etc/motd
#
source /etc/os-release

OS_PRETTY_NAME="$PRETTY_NAME"
OS_VERSION_MAJOR="${VERSION_ID%.*}"
ARCH="`uname -m`"

for suma_prod in /etc/products.d/SUSE-Manager-Server.prod /etc/products.d/SUSE-Manager-Proxy.prod
do
  if [[ -f $suma_prod ]]; then
     SUMA_VERSION=`sed -n -r -e '/<version>/s/( *<version>)([^<]*)(.*)/\2/p' $suma_prod`
     break
  fi
done

test -f etc/products.d/SLES_SAP.prod && OS_PRETTY_NAME="$OS_PRETTY_NAME for SAP Applications"

get_motd_includes()
{
    if [ -d /etc/motd.d ]; then
        for inc in `ls /etc/motd.d` ; do
            echo "r /etc/motd.d/${inc}"
        done
    fi
}

test -f /etc/motd-caption && cap_replace="r /etc/motd-caption"

motd_func="\
s/{OS_PRETTY_NAME}/$OS_PRETTY_NAME/g
s/{OS_VERSION_MAJOR}/$OS_VERSION_MAJOR/g
s/{ARCH}/$ARCH/g
s/{SUMA_VERSION}/$SUMA_VERSION/g
/{CAPTION}/{
$cap_replace
d
}
/{INCLUDES}/{
`get_motd_includes`
d
}"

for motd in /etc/motd* ; do
    test -f $motd || continue
    sed -i -e "$motd_func" $motd
done

test -d /etc/motd.d && rm -r /etc/motd.d
test -f /etc/motd-caption && rm /etc/motd-caption
#
# End generate /etc/motd

[ -x /sbin/set_polkit_default_privs ] && /sbin/set_polkit_default_privs

sed -i -e 's/^root:[^:]*:/root:*:/' /etc/shadow

prodfiles=(`grep -l '<codestream>' /etc/products.d/*prod`)
for p in $prodfiles ; do
  grep -q '<flavor>extension</flavor>' $p || prodfile="$prodfile $p"
done
if [[ ${#prodfile[*]} -ne 1 ]]; then
    echo "No base product package installed or base product ambiguous." >&2
    false
else
    ln -sf `basename "${prodfile[0]}"` /etc/products.d/baseproduct
fi

sed -i -e 's/# download.use_deltarpm = true/download.use_deltarpm = false/' \
    /etc/zypp/zypp.conf

# keg: included from common-services
baseInsertService boot.device-mapper
baseInsertService haveged
baseInsertService sshd
baseRemoveService acpid
baseRemoveService boot.efivars
baseRemoveService boot.lvm
baseRemoveService boot.md
baseRemoveService boot.multipath
baseRemoveService display-manager
baseRemoveService kbd

if [[ $kiwi_profiles = Devel || $kiwi_profiles = Production ]]; then
    # keg: included from azure-baremetal
    baseUpdateSysConfig /etc/sysconfig/network/dhcp DHCLIENT_SET_HOSTNAME "yes"

    # keg: included from azure-baremetal
    cat > "/etc/modprobe.d/sunrpc.conf" <<EOF
# Module for sunrpc

options sunrpc tcp_max_slot_table_entries=128
EOF
    cat >> "/etc/security/limits.conf" <<EOF
* soft nofile 32768
* hard nofile 65536
EOF

    # keg: included from azure-baremetal
    touch /.azure-li-config-lookup.trigger
    touch /.azure-li-network.trigger
    touch /.azure-li-user.trigger
    touch /.azure-li-install.trigger
    touch /.azure-li-call.trigger
    touch /.azure-li-storage.trigger
    touch /.azure-li-machine-constraints.trigger
    touch /.azure-li-system-setup.trigger
    touch /.azure-li-report.trigger
    touch /.azure-li-cleanup.trigger


    sed -i 's/Verbosity = 0/Verbosity = 3/' /etc/idmapd.conf

    sed -i -e 's/#ClientAliveInterval 0/ClientAliveInterval 180/' \
        /etc/ssh/sshd_config

    sed -i -e '/^Defaults targetpw/ s/^/#/' \
           -e '/^ALL *ALL=(ALL) *ALL/ s/^/#/' /etc/sudoers

    baseSetRunlevel multi-user.target

    # keg: included from azure-baremetal
    baseInsertService azure-li-call
    baseInsertService azure-li-cleanup
    baseInsertService azure-li-config-lookup
    baseInsertService azure-li-install
    baseInsertService azure-li-machine-constraints
    baseInsertService azure-li-network
    baseInsertService azure-li-storage
    baseInsertService azure-li-system-setup
    baseInsertService azure-li-report
    baseInsertService azure-li-user
    baseRemoveService nscd
    baseInsertService kdump
    baseInsertService multipathd
fi
openSUSE Build Service is sponsored by