LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File config.sh of Package OBS-Appliance-vmdk (Project home:doiggl)

#!/bin/bash
#======================================
# Functions...
#--------------------------------------
test -f /.kconfig && . /.kconfig
test -f /.profile && . /.profile

#======================================
# Greeting...
#--------------------------------------
echo "Configure image: [$kiwi_iname]..."
#======================================
# Activate services
#--------------------------------------
ifup lo
suseActivateDefaultServices
suseInsertService boot.device-mapper
suseInsertService boot.lvm
suseInsertService slpd
suseInsertService haveged
/sbin/chkconfig haveged on #has already systemd file ...
# OBS api
suseInsertService memcached
suseInsertService apache2
/sbin/chkconfig apache2 on #has already systemd file ...
suseInsertService mysql
suseInsertService obsapidelayed
# OBS backend
suseInsertService obssrcserver
suseInsertService obsrepserver
suseInsertService obsdispatcher
suseInsertService obspublisher
suseInsertService obsscheduler
suseInsertService obsservice
suseInsertService obssignd
suseInsertService obssigner
suseInsertService obswarden
# OBS worker
suseInsertService obsworker
# For OBS Appliance only:
suseInsertService obsapisetup
suseInsertService obsstoragesetup

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

# no gfx boot menu, no error message please
#sed -i /^gfxmenu/d /boot/grub/menu.lst

# setup initrd for XEN workers
sed -i -e 's/^DOMU_INITRD_MODULES="/DOMU_INITRD_MODULES="loop dm-mod dm-snapshot binfmt_misc fuse squashfs ext3 ext4 reiserfs btrfs virtio_pci virtio_blk fat vfat nls_cp437 nf_conntrack_ipv6 fat vfat /' /etc/sysconfig/kernel
sed -i -e 's/^NO_KMS_IN_INITRD=.*/NO_KMS_IN_INITRD="yes"/' /etc/sysconfig/kernel

# For save booting, there is some race between blogd and console setup in 11.4 atm
sed -i -e 's/^RUN_PARALLEL=.*/RUN_PARALLEL="no"/' /etc/sysconfig/boot

# 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

# 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-*
# build.opensuse.org has dedicated workers for arm, avoid that linked packages get not dispatched
sed -i 's,OBS_WORKER_HOSTLABELS=.*,OBS_WORKER_HOSTLABELS="QEMU_ARM",' /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
 
# bug ?
chown root.root /var/lib/empty

# disable predictable udev device names and use unpredictable ones to have them predictable again
# so our network gets actually setup. This file is usually written by YaST otherwise.
echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{type}=="1", KERNEL=="e*", NAME="eth0"' > /etc/udev/rules.d/70-persistent-net.rules


# Only for OBS-Appliance*, not WorkerOnly
if true; then

# apache configuration
for i in passenger rewrite proxy proxy_http xforward headers ssl socache_shmcb; do
  /usr/sbin/a2enmod $i
done
sed -i 's,APACHE_SERVER_FLAGS=.*,APACHE_SERVER_FLAGS="SSL",'                  /etc/sysconfig/apache2

# Enable xforward
sed -i 's,^#use_xforward:.*,use_xforward: true,' /srv/www/obs/api/config/options.yml

#======================
# Configure OBS backend
#----------------------
sed -i 's,.*our $serviceserve.*,our $serviceserver = "http://$hostname:5152";,' /usr/lib/obs/server/BSConfig.pm
sed -i 's,^our $repodownload.*,our $repodownload = "http://$hostname:82/";,' /usr/lib/obs/server/BSConfig.pm
sed -i 's,^OBS_RUN_DIR=.*,OBS_RUN_DIR="/srv/obs/run",' /etc/sysconfig/obs-server
sed -i 's,^OBS_LOG_DIR=.*,OBS_LOG_DIR="/srv/obs/log",' /etc/sysconfig/obs-server
sed -i 's,^datadir.=.*,datadir = /srv/obs/MySQL,' /etc/my.cnf
sed -i '/^\[mysqld_multi\]/adatadir = /srv/obs/MySQL' /etc/my.cnf # config of openSUSE 11.4 does not come with a default dir for its default mode
# signing setup
sed -i 's,.*our $gpg_standard_key.*,our $gpg_standard_key = "/srv/obs/obs-default-gpg.asc";,' /usr/lib/obs/server/BSConfig.pm
sed -i 's,.*our $keyfile.*,our $keyfile = "/srv/obs/obs-default-gpg.asc";,' /usr/lib/obs/server/BSConfig.pm
sed -i 's,.*our $sign = .*,our $sign = "/usr/bin/sign";,' /usr/lib/obs/server/BSConfig.pm
sed -i 's,.*our $forceprojectkeys.*,our $forceprojectkeys = 1;,' /usr/lib/obs/server/BSConfig.pm
chmod 4755 /usr/bin/sign

#======================================
# Fix user id values to unbreak updates
#--------------------------------------
obsrun_user=`getent passwd 103|cut -d: -f 1`
if [ -n "$obsrun_user" -a "$obsrun_user" != "obsrun" ]; then
  usermod -u 942 "$obsrun_user" || exit 1 # move away conflicting uid user
  usermod -u 103 obsrun || exit 1 # use fixed obsrun uid
fi
obsrun_user=`getent passwd 103|cut -d: -f 1`
if [ -n "$obsrun_user" -a "$obsrun_user" != "obsrun" ]; then
  print "wrong user for id 103: $obsrun_user"
  exit 1
fi

fi

#======================================
# Add Default Repositories
#--------------------------------------
zypper ar http://download.opensuse.org/distribution/13.2/repo/oss                        openSUSE:13.2
zypper ar http://download.opensuse.org/update/13.2                                       openSUSE:13.2:Update
zypper ar http://download.opensuse.org/repositories/openSUSE:Tools/openSUSE_13.2         openSUSE:Tools
zypper ar http://download.opensuse.org/repositories/OBS:Server:2.6/openSUSE_13.2    OBS:Server:Unstable

#======================================
# Import trusted keys
#--------------------------------------
cat > OBS.pubkey <<EOF
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)

mQENBFEjZoUBCAC4PFLGczW3H6doqMRNXVCwhQ0Qexh47Af4NqsEzqE3yjfd7x02
ZANxqFbFWDnR1hZA6TcNbSWRgrku2DR7hAVUnkwZ1Ke+ZCC73hO4AYPMon+LNOy6
5BBf75Hogo9SKtEw4AVk8N6/H0P3p2G588A1zFnaEMRC66yAPn5CCvPMi4vY1XMZ
2obfGpLoD9TtWvh+YhdyuBz1MtgGIcxIUmjJAzYpEeEDYBdqpmyVPYbIaIgGyA5G
xnkHfjRMV5sRX7ooMO68JlFobVEiY8b/PpQUJs/5Kleq9+2X20tWq52XU539CXFh
3u0ujO0xLArhEOxQomjmzRSTRZFy0R5GNTexABEBAAG0KE9CUyBPQlMgUHJvamVj
dCA8T0JTQGJ1aWxkLm9wZW5zdXNlLm9yZz6JATwEEwECACYFAlEjZoUCGwMFCQQe
sAAGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRDoQgq4xcIZ588CB/0VXgoO4V1f
H79Ks7IEYandGIISBpd5DWGHaVOhv4UvS3KJVtj7hrWefL9eztR0csb3LpikkPJU
v7lO49a+8WfI1H0zseUBknBMJPAxxVBZtTjg1YqzFEvu56n0PGKJEtfCZyFNOf20
aQCjCgiqoJ7ksV3r+G/OGaDzHJOwX7tAh22vtt39qdwqcnRaOODWzBbuYZCZoGGH
VMXFiLYRXphf8NAVaqyGMApFC78OZiPKowr4B0GyY87dIqORBQEUx/WZokoy8BnI
JppPSvR8kvmPPJTRoumqrItupK3cxiIO9yqmCwyNf5lOjQByIh8c38zro6c3lCZF
yBdRcwqSzlxBiEYEExECAAYFAlEjZoUACgkQOzARt2udZSOC+QCeMXyfYqtIGXTE
U2qT0Jra0XLltHIAoIpzj6aiBdGDfGQQTBi/vCUF8SyB
=vCGk
-----END PGP PUBLIC KEY BLOCK-----
EOF
for i in /usr/lib/rpm/gnupg/keys/gpg-pubkey*asc OBS.pubkey; do
    # importing can fail if it already exists
    rpm --import $i || true
done

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

exit 0