File config.sh of Package gnu-health-13.1

#!/bin/bash
#================
# FILE          : config.sh
#----------------
# PROJECT       : OpenSuSE KIWI Image System
# COPYRIGHT     : (c) 2006 SUSE LINUX Products GmbH. All rights reserved
#               :
# AUTHOR        : Marcus Schaefer <ms@suse.de>
#               :
# BELONGS TO    : Operating System images
#               :
# DESCRIPTION   : configuration script for SUSE based
#               : operating systems
#               :
#               :
# STATUS        : BETA
#----------------
#======================================
# Functions...
#--------------------------------------
test -f /.kconfig && . /.kconfig
test -f /.profile && . /.profile

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

#======================================
# SuSEconfig
#--------------------------------------
echo "** Running suseConfig..."
suseConfig

echo "** Running ldconfig..."
/sbin/ldconfig

#======================================
# Setup default runlevel
#--------------------------------------
baseSetRunlevel 5

#======================================
# Add missing gpg keys to rpm
#--------------------------------------
suseImportBuildKey


#======================================
# Firewall Configuration
#--------------------------------------
echo '** Configuring firewall...'
chkconfig SuSEfirewall2_init on
chkconfig SuSEfirewall2_setup on

sed --in-place -e 's/# solver.onlyRequires.*/solver.onlyRequires = true/' /etc/zypp/zypp.conf

# Enable sshd
chkconfig sshd on

#======================================
# Sysconfig Update
#--------------------------------------
echo '** Update sysconfig entries...'
baseUpdateSysConfig /etc/sysconfig/keyboard KEYTABLE english-us
baseUpdateSysConfig /etc/sysconfig/network/config FIREWALL yes
baseUpdateSysConfig /etc/sysconfig/network/config LINKLOCAL_INTERFACES ''
baseUpdateSysConfig /etc/init.d/suse_studio_firstboot NETWORKMANAGER yes
baseUpdateSysConfig /etc/sysconfig/SuSEfirewall2 FW_SERVICES_EXT_TCP 22\ 80\ 443
baseUpdateSysConfig /etc/sysconfig/console CONSOLE_FONT lat9w-16.psfu
baseUpdateSysConfig /etc/sysconfig/displaymanager DISPLAYMANAGER_AUTOLOGIN gnuhealth
baseUpdateSysConfig /etc/sysconfig/displaymanager DISPLAYMANAGER kdm4
baseUpdateSysConfig /etc/sysconfig/windowmanager DEFAULT_WM kde


#======================================
# Setting up overlay files 
#--------------------------------------
echo '** Setting up overlay files...'
echo mkdir -p /
mkdir -p /
echo tar xfp /image/e654bb175247169b88a17ce39774cc56 -C /
tar xfp /image/e654bb175247169b88a17ce39774cc56 -C /
echo rm /image/e654bb175247169b88a17ce39774cc56
rm /image/e654bb175247169b88a17ce39774cc56
mkdir -p /
mv /studio/overlay-tmp/files///01-gnuhealth_301_oS131.tar.bz2 //01-gnuhealth_301_oS131.tar.bz2
chown postgres:users //01-gnuhealth_301_oS131.tar.bz2
chmod 644 //01-gnuhealth_301_oS131.tar.bz2
echo mkdir -p /
mkdir -p /
echo tar xfp /image/dolphintarbz2-7hJHKLB2bj -C /
tar xfp /image/dolphintarbz2-7hJHKLB2bj -C /
echo rm /image/dolphintarbz2-7hJHKLB2bj
rm /image/dolphintarbz2-7hJHKLB2bj
mkdir -p /
mv /studio/overlay-tmp/files///dolphin.tar.bz2 //dolphin.tar.bz2
chown postgres:users //dolphin.tar.bz2
chmod 644 //dolphin.tar.bz2
echo mkdir -p /
mkdir -p /
echo tar xfp /image/d58280a558f1a2c4b4dc03994f9dca59 -C /
tar xfp /image/d58280a558f1a2c4b4dc03994f9dca59 -C /
echo rm /image/d58280a558f1a2c4b4dc03994f9dca59
rm /image/d58280a558f1a2c4b4dc03994f9dca59
mkdir -p /
mv /studio/overlay-tmp/files///gnuhealth_attachs.tar.bz2 //gnuhealth_attachs.tar.bz2
chown root:users //gnuhealth_attachs.tar.bz2
chmod 666 //gnuhealth_attachs.tar.bz2
echo mkdir -p /
mkdir -p /
echo tar xfp /image/konqtarbz2-pYJpaDNA5z -C /
tar xfp /image/konqtarbz2-pYJpaDNA5z -C /
echo rm /image/konqtarbz2-pYJpaDNA5z
rm /image/konqtarbz2-pYJpaDNA5z
mkdir -p /
mv /studio/overlay-tmp/files///konq.tar.bz2 //konq.tar.bz2
chown root:root //konq.tar.bz2
chmod 644 //konq.tar.bz2
echo mkdir -p /
mkdir -p /
echo tar xfp /image/konquerortarbz2-CNrgCUJT52 -C /
tar xfp /image/konquerortarbz2-CNrgCUJT52 -C /
echo rm /image/konquerortarbz2-CNrgCUJT52
rm /image/konquerortarbz2-CNrgCUJT52
mkdir -p /
mv /studio/overlay-tmp/files///konqueror.tar.bz2 //konqueror.tar.bz2
chown gnuhealth:users //konqueror.tar.bz2
chmod 644 //konqueror.tar.bz2
echo mkdir -p /home/gnuhealth/
mkdir -p /home/gnuhealth/
echo tar xfp /image/f1d7890c4d1a0ddeda55afa8789aafda -C /home/gnuhealth/
tar xfp /image/f1d7890c4d1a0ddeda55afa8789aafda -C /home/gnuhealth/
echo rm /image/f1d7890c4d1a0ddeda55afa8789aafda
rm /image/f1d7890c4d1a0ddeda55afa8789aafda
mkdir -p /home/gnuhealth/
mv /studio/overlay-tmp/files//home/gnuhealth//libreoffice.tar.bz2 /home/gnuhealth//libreoffice.tar.bz2
chown gnuhealth:users /home/gnuhealth//libreoffice.tar.bz2
chmod 644 /home/gnuhealth//libreoffice.tar.bz2
mkdir -p /
mv /studio/overlay-tmp/files///license.tar.gz //license.tar.gz
chown root:root //license.tar.gz
chmod 644 //license.tar.gz
echo mkdir -p /home/gnuhealth/
mkdir -p /home/gnuhealth/
echo tar xfp /image/fff43cf8b9531b6d36993e0c7b48caf1 -C /home/gnuhealth/
tar xfp /image/fff43cf8b9531b6d36993e0c7b48caf1 -C /home/gnuhealth/
echo rm /image/fff43cf8b9531b6d36993e0c7b48caf1
rm /image/fff43cf8b9531b6d36993e0c7b48caf1
mkdir -p /home/gnuhealth/
mv /studio/overlay-tmp/files//home/gnuhealth//tryton-config.tar.gz /home/gnuhealth//tryton-config.tar.gz
chown gnuhealth:users /home/gnuhealth//tryton-config.tar.gz
chmod 644 /home/gnuhealth//tryton-config.tar.gz
mkdir -p /home/gnuhealth/.kde4/share/apps/konqueror/
mv /studio/overlay-tmp/files//home/gnuhealth/.kde4/share/apps/konqueror//bookmarks.xml /home/gnuhealth/.kde4/share/apps/konqueror//bookmarks.xml
chown gnuhealth:users /home/gnuhealth/.kde4/share/apps/konqueror//bookmarks.xml
chmod 644 /home/gnuhealth/.kde4/share/apps/konqueror//bookmarks.xml
mkdir -p /etc/init.d/
mv /studio/overlay-tmp/files//etc/init.d//boot.local /etc/init.d//boot.local
chown root:root /etc/init.d//boot.local
chmod 744 /etc/init.d//boot.local
mkdir -p /etc/skel/.kde4/share/config/
mv /studio/overlay-tmp/files//etc/skel/.kde4/share/config//dolphinrc /etc/skel/.kde4/share/config//dolphinrc
chown gnuhealth:users /etc/skel/.kde4/share/config//dolphinrc
chmod 600 /etc/skel/.kde4/share/config//dolphinrc
mkdir -p /home/gnuhealth/Desktop/
mv /studio/overlay-tmp/files//home/gnuhealth/Desktop//GNUHealth.desktop /home/gnuhealth/Desktop//GNUHealth.desktop
chown gnuhealth:users /home/gnuhealth/Desktop//GNUHealth.desktop
chmod 755 /home/gnuhealth/Desktop//GNUHealth.desktop
mkdir -p /home/gnuhealth/Desktop/
mv /studio/overlay-tmp/files//home/gnuhealth/Desktop//GNUHealth_Live_CD.README.SUSE /home/gnuhealth/Desktop//GNUHealth_Live_CD.README.SUSE
chown gnuhealth:users /home/gnuhealth/Desktop//GNUHealth_Live_CD.README.SUSE
chmod 644 /home/gnuhealth/Desktop//GNUHealth_Live_CD.README.SUSE
mkdir -p /etx/skel/.kde4/share/config/
mv /studio/overlay-tmp/files//etx/skel/.kde4/share/config//kickoffrc /etx/skel/.kde4/share/config//kickoffrc
chown gnuhealth:users /etx/skel/.kde4/share/config//kickoffrc
chmod 600 /etx/skel/.kde4/share/config//kickoffrc
mkdir -p /home/gnuhealth/Desktop/
mv /studio/overlay-tmp/files//home/gnuhealth/Desktop//konqbrowser.desktop /home/gnuhealth/Desktop//konqbrowser.desktop
chown gnuhealth:users /home/gnuhealth/Desktop//konqbrowser.desktop
chmod 644 /home/gnuhealth/Desktop//konqbrowser.desktop
mkdir -p /etc/sysconfig/
mv /studio/overlay-tmp/files//etc/sysconfig//SuSEfirewall2 /etc/sysconfig//SuSEfirewall2
chown root:root /etc/sysconfig//SuSEfirewall2
chmod 644 /etc/sysconfig//SuSEfirewall2
mkdir -p /etc/tryton/
mv /studio/overlay-tmp/files//etc/tryton//trytond.conf /etc/tryton//trytond.conf
chown root:root /etc/tryton//trytond.conf
chmod 644 /etc/tryton//trytond.conf
test -d /studio || mkdir /studio
cp /image/.profile /studio/profile
cp /image/config.xml /studio/config.xml
chown root:root /studio/build-custom
chmod 755 /studio/build-custom
# run custom build_script after build
if ! /studio/build-custom; then
    cat <<EOF

*********************************
/studio/build-custom failed!
*********************************

EOF

    exit 1
fi
chown root:root /studio/suse-studio-custom
chmod 755 /studio/suse-studio-custom
rm -rf /studio/overlay-tmp
true
#======================================
# Configure PostgreSQL database
#--------------------------------------

DATADIR=~postgres/data

# Handy wrapper to call pg_ctl with the correct user.
pg_ctl () {
  CMD="/usr/bin/pg_ctl $@"
  su - postgres -c "$CMD"
}

# Helper function to execute the given sql file.
execute_sql_file() {
  su postgres -c "psql -q < $1 2>&1"
}

# Initialize PostgreSQL
echo "## Initializing PostgreSQL databases and tables..."
# Setting /tmp to 777 with sticky bit for initdb to work properly
# Fix for bnc#919520
echo "## Setting /tmp to 777 with sticky bit..."
chmod a+trwx /tmp
LANG_SYSCONFIG=/etc/sysconfig/language
LANG=$(test -f $LANG_SYSCONFIG && . $LANG_SYSCONFIG && echo ${POSTGRES_LANG:-$RC_LANG})
install -d -o postgres -g postgres -m 700 ${DATADIR} && su - postgres -c \
  "/usr/bin/initdb --locale=$LANG --auth='ident' $DATADIR &> initlog"

# Start PostgreSQL without networking
echo "## Starting PostgreSQL..."
pg_ctl start -s -w -D $DATADIR

# Load PostgreSQL data dump, if it exists
pgsql_dump=/tmp/pgsql_dump.sql
if [ -f "$pgsql_dump" ]; then
  echo "## Loading PostgreSQL data dump..."
  execute_sql_file "$pgsql_dump"
else
  echo "## No PostgreSQL data dump found, skipping"
fi

# Load PostgreSQL users and permissions, if setup file exists
pgsql_perms=/tmp/pgsql_config.sql
if [ -f "$pgsql_perms" ]; then
  echo "## Loading PostgreSQL users and perms..."
  execute_sql_file "$pgsql_perms"

  # update config file to allow md5 login
  sed -i "s/^\(host .*\) ident/\1 md5/" /var/lib/pgsql/data/pg_hba.conf

else
  echo "## No PostgreSQL user/perms config found, skipping"
fi

# Auto-start PostgreSQL
echo "## Configuring PostgreSQL to auto-start on boot..."
chkconfig postgresql on

# Stop PostgreSQL service (for uncontained builds)
echo "## Stopping PostgreSQL..."
pg_ctl stop -s -D $DATADIR -m fast

# Clean up temp files (for uncontained builds)
rm -f "$pgsql_perms" "$pgsql_dump"

echo "## PostgreSQL configuration complete"

#======================================
# SSL Certificates Configuration
#--------------------------------------
echo '** Rehashing SSL Certificates...'
c_rehash


sh /studio/configure_kdm4_theme.sh



sh /studio/configure_kde4_background.sh