Hello World

File config.sh of Package OBS-WorkerOnly

#!/bin/bash
#======================================
# Functions...
#--------------------------------------
test -f /.kconfig && . /.kconfig
test -f /.profile && . /.profile
set -x
#======================================
# Greeting...
#--------------------------------------
echo "Configure image: [$kiwi_iname]..."
#======================================
# Activate services
#--------------------------------------
ifup lo
suseActivateDefaultServices
for i in sshd ntpd ipmi mcelog smartd puppet obsstoragesetup obsworker; do 
    echo "enabling service $i"
    suseInsertService $i
done
# do the ones failing above
for i in ipmi obsstoragesetup obsworker nrpe ; do 
    echo "enabling service $i"
    chkconfig $i on
done


#======================================
# SuSEconfig
#--------------------------------------
suseConfig

if test -f /boot/grub/menu.lst ; then
 # no gfx boot menu, no error message please
 sed -i /^gfxmenu/d /boot/grub/menu.lst
fi

# setup initrd
# similar to kernel-obs-build package

# a longer list to have them also available for qemu cross builds where x86_64 kernel runs in eg. arm env.
# this list of modules where available on build workers of build.opensuse.org, so we stay compatible.
export KERNEL_MODULES="loop dm-mod dm-snapshot binfmt-misc fuse kqemu squashfs ext2 ext3 ext4 reiserfs nf_conntrack_ipv6 binfmt_misc virtio_pci virtio_mmio virtio_blk virtio-rng fat vfat nls_cp437 nls_iso8859-1 ibmvscsi ibmvscsic"
echo "force_drivers+=\"$KERNEL_MODULES\"" > /etc/dracut.conf.d/03-my-obs.conf
echo "nowaitforswap=yes" >> /etc/dracut.conf.d/03-my-obs.conf
echo "options loop max_loop=64 lbs=0" > /etc/modprobe.d/50-obs.conf

# enforce setup of time
sed -i -e 's/^NTPD_FORCE_SYNC_ON_STARTUP=.*/NTPD_FORCE_SYNC_ON_STARTUP="yes"/' /etc/sysconfig/ntp

# configure network
cat >> /etc/sysconfig/network/config <<EOF

NETCONFIG_MODULES_ORDER="dns-resolver dns-bind ntp-runtime"
NETCONFIG_DNS_POLICY="auto"
NETCONFIG_DNS_FORWARDER="resolver"
NETCONFIG_NIS_SETDOMAINNAME="yes"
NETCONFIG_NTP_POLICY="auto"
EOF

# worker greeting string
echo 'Welcome to OBS Worker Appliance, based on openSUSE - Kernel \r (\l).' > /etc/issue
echo >> /etc/issue

# runlevel 3 as default
#sed -i 's/^id:5:initdefault:/id:3:initdefault:/' /etc/inittab

# enable autosetup
sed -i 's,OBS_API_AUTOSETUP=.*,OBS_API_AUTOSETUP="yes",' /etc/sysconfig/obs-server
sed -i 's,OBS_STORAGE_AUTOSETUP=.*,OBS_STORAGE_AUTOSETUP="yes",' /etc/sysconfig/obs-*
sed -i 's,OBS_SETUP_WORKER_PARTITIONS=.*,OBS_SETUP_WORKER_PARTITIONS="use_obs_vg",' /etc/sysconfig/obs-*

# set the security level for this worker appliance
sed -i 's,OBS_WORKER_SECURITY_LEVEL=.*,OBS_WORKER_SECURITY_LEVEL="4",' /etc/sysconfig/obs-*

# hardwired ntp server config, in case dhcp distribution of ntp config is not working
echo "" >> /etc/ntp.conf
echo "server ntp1" >> /etc/ntp.conf
#echo "multicastclient" >> /etc/ntp.conf # unknown since 12.1

# allow root login via serial console for debugging
echo "" >> /etc/securetty
echo "# for debugging purposes" >> /etc/securetty
echo ttyS0 >> /etc/securetty
echo "" >> /etc/inittab
echo "S0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt102" >> /etc/inittab
 
# bug ?
chown root.root /var/lib/empty

#======================================
# Add Default Repositories
#--------------------------------------
zypper ar http://download.opensuse.org/distribution/leap/15.0/repo/oss/                  openSUSE:Leap:15.0
zypper ar http://download.opensuse.org/update/leap/15.0/oss/                             openSUSE:Leap:15.0:Update
zypper ar http://download.opensuse.org/repositories/OBS:/Server:/Unstable/openSUSE_15.0/ OBS:Server:Unstable

#======================================
# Umount kernel filesystems
#--------------------------------------
#baseCleanMount

exit 0