2010-10-15 20:59:30 +02:00
#!/bin/sh
2010-10-18 19:01:49 +02:00
env-update
source /etc/profile
2010-10-16 23:52:11 +02:00
# merge config updates first
echo -5 | equo conf update
2010-10-18 19:01:49 +02:00
# make sure that sun-jdk is in use
java-config -S sun-jdk || exit 1
2010-11-04 20:50:52 +01:00
# Create OEM directory
mkdir -p /etc/oem
# Setup fbsplash (babel theme)
2010-11-04 23:33:21 +01:00
mv /.mcs/fbsplash-babel /etc/splash/babel || exit 1
2010-11-04 20:50:52 +01:00
chown root:root /etc/splash/babel -R || exit 1
echo "babel" > /etc/oem/splash_name || exit 1
# update initramfs with new splash data
for img in /boot/initramfs-genkernel-*; do
splash_geninitramfs -a " ${ img } " babel || exit 1
done
# copy background over
cp /.mcs/background/* /usr/share/backgrounds/ -R || exit 1
2010-11-04 23:33:21 +01:00
chown root:root /usr/share/backgrounds/ -R || exit 1
2010-11-04 20:50:52 +01:00
# setup background in /etc/skel
for file in ` find /etc/skel -type f` ; do
sed -i "s:/usr/share/backgrounds/sabayonlinux.jpg:/usr/share/backgrounds/background-mailware.jpg:g" " ${ file } "
sed -i "s:/usr/share/backgrounds/sabayonlinux.png:/usr/share/backgrounds/background-mailware.png:g" " ${ file } "
done
2010-11-13 08:52:39 +01:00
sed -i "s:/usr/share/backgrounds/sabayonlinux.png:/usr/share/backgrounds/background-mailware.png:g" /etc/init.d/installer-gui
2010-11-04 20:50:52 +01:00
2010-10-15 20:59:30 +02:00
# setup Desktop icons
rm /etc/skel/Desktop/*.desktop
cp /usr/share/applications/keyboard.desktop /etc/skel/Desktop/ -p
cp /usr/share/applications/389-console*.desktop /etc/skel/Desktop/ -p
2010-10-29 21:41:42 +02:00
cp /.mcs/desktop/* /etc/skel/Desktop -R
chmod +x /etc/skel/Desktop/*
2010-10-15 20:59:30 +02:00
chown root:root /etc/skel/Desktop -R
2010-10-29 21:41:42 +02:00
# Setup Firefox
for file in ` find /etc/skel/.mozilla -name prefs.js` ; do
sed -i 's:sabayon.org:babel.it:g' " ${ file } "
done
mkdir -p /etc/skel/.local/share/applications
echo "[Added Associations]" >> /etc/skel/.local/share/applications/mimeapps.list
2011-04-06 19:33:44 +02:00
echo "application/octet-stream=firefox.desktop;" >> /etc/skel/.local/share/applications/mimeapps.list
2010-10-29 21:41:42 +02:00
2010-10-15 20:59:30 +02:00
# Setup init scripts
cp /.mcs/mcs-functions.sh /sbin/mcs-functions.sh
chmod 755 /sbin/mcs-functions.sh
chown root:root /sbin/mcs-functions.sh
cp /.mcs/mcs-oemsystem-default /etc/init.d/oemsystem-default
chmod 755 /etc/init.d/oemsystem-default
chown root:root /etc/init.d/oemsystem-default
rc-update add oemsystem-default default
# setup fqdn
2010-11-05 10:46:41 +01:00
sed -i 's/sabayon/localhost.localdomain example.com sabayon/g' /etc/hosts
2010-10-18 19:01:49 +02:00
sed -i 's/sabayon/localhost.localdomain/g' /etc/conf.d/hostname
# setup fqdn in 389-admin, stop annoying apache crap
sed -i '/^#ServerName/ s/.*/ServerName localhost.localdomain/g' /etc/dirsrv/admin-serv/httpd.conf || exit 1
2010-10-15 20:59:30 +02:00
# setup MySQL
2010-10-16 23:52:11 +02:00
# Fixup mysqld permissions, ebuild bug?
chown mysql:mysql /var/run/mysqld -R
2010-10-15 20:59:30 +02:00
echo "password=mcsmanager" > /root/.my.cnf || exit 1
2010-10-28 12:04:04 +02:00
HOSTNAME = "somethingelse" equo config dev-db/mysql || exit 1
2010-10-15 20:59:30 +02:00
if [ " ${ ? } " != "0" ] ; then
exit 1
fi
rm /root/.my.cnf -f
# setup password
sed -i '/^#password/ s/your_password/mcsmanager/g' /etc/mysql/my.cnf || exit 1
sed -i '/^#password/ s/#//g' /etc/mysql/my.cnf || exit 1
2010-10-16 23:52:11 +02:00
# start and insert data
echo "Setting up mysql"
/etc/init.d/mysql start --nodeps || exit 1
mysql -u root --password= mcsmanager -h localhost < /.mcs/mwsql.sql
2010-11-05 14:31:41 +01:00
mysql -u root --password= mcsmanager -h localhost < /.mcs/mwsql-user.sql
2010-10-16 23:52:11 +02:00
mysql -u root --password= mcsmanager -h localhost < /.mcs/bedework.sql
2010-11-10 15:48:44 +01:00
mysql -u root --password= mcsmanager -h localhost < /.mcs/bedework_init.sql
2010-10-16 23:52:11 +02:00
/etc/init.d/mysql stop --nodeps
2010-10-15 20:59:30 +02:00
# setup 389-console data
mkdir /etc/skel/.389-console
echo " UserID=admin
HostURL = http\: //localhost\: 9830
" > /etc/skel/.389-console/Console.1.1.5.Login.preferences
2010-10-16 23:52:11 +02:00
# Setup Postfix
echo "Setting up Postfix"
cp /.mcs/postfix/main.cf /etc/postfix/main.cf || exit 1
cp /.mcs/postfix/master.cf /etc/postfix/master.cf || exit 1
cp /.mcs/postfix/ldapconf /etc/postfix/ldapconf -Rp || exit 1
chown root:root /etc/postfix/{ main,master} .cf || exit 1
chmod 644 /etc/postfix/{ main,master} .cf || exit 1
chmod 755 /etc/postfix/ldapconf || exit 1
chmod 644 /etc/postfix/ldapconf/*.cf || exit 1
chown root:root /etc/postfix/ldapconf -R || exit 1
2010-11-05 14:31:41 +01:00
( cd /etc/mail && newaliases ) || exit 1
touch /etc/postfix/transport || exit 1
( cd /etc/postfix && postmap hash:/etc/postfix/transport ) || exit 1
mkdir /var/spool/filter || exit 1
chown mail:mail /var/spool/filter || exit 1
chmod 775 /var/spool/filter || exit 1
2010-10-16 23:52:11 +02:00
# mmt_scripts
cp /.mcs/mmt_scripts /usr/local/ -Rp || exit 1
chown root:root /usr/local/mmt_scripts -R || exit 1
chmod 755 /usr/local/mmt_scripts/* -R || exit 1
2010-11-05 14:31:41 +01:00
chmod 755 /usr/local/mmt_scripts || exit 1
2010-10-16 23:52:11 +02:00
2010-10-22 17:24:48 +02:00
# temp unpack jboss-deploy.tar.bz2
echo "Unpacking jboss-deploy data"
tar xjf /.mcs/jboss-deploy.tar.bz2 -C /tmp || exit 1
jboss_deploy = "/tmp/jboss-deploy"
if [ ! -d " ${ jboss_deploy } " ] ; then
echo " ${ jboss_deploy } not a dir "
exit 1
fi
2010-10-19 19:41:55 +02:00
# copy mcs-ldapinit.pl somewhere, it will be used to setup mcs ldap schema at runtime
2010-10-22 17:24:48 +02:00
cp /.mcs/scripts/mcs-ldapinit.pl /usr/sbin/ || exit 1
2010-10-19 19:41:55 +02:00
chmod +x /usr/sbin/mcs-ldapinit.pl || exit 1
chown root:root /usr/sbin/mcs-ldapinit.pl || exit 1
## Setup MCS
2010-10-22 17:24:48 +02:00
# copy jboss data over
echo "Copying jboss-bin deploy data over"
2010-10-29 14:37:27 +02:00
cp /tmp/jboss-deploy/* /opt/jboss-bin-4.2/server/default/deploy/ -Rp || exit 1
2010-10-22 17:24:48 +02:00
chown jboss:jboss /opt/jboss-bin-4.2/server/default/deploy/ -R || exit 1
2010-10-29 14:37:27 +02:00
rm -r /tmp/jboss-deploy || exit 1
# setup jboss login info
2010-10-29 21:41:42 +02:00
cp /.mcs/mailware-jboss-conf/login-config.xml /opt/jboss-bin-4.2/server/default/conf/login-config.xml || exit 1
2010-10-29 14:37:27 +02:00
chown jboss:jboss /opt/jboss-bin-4.2/server/default/conf/login-config.xml || exit 1
cp /.mcs/mailware-jboss-conf/jboss-log4j.xml /opt/jboss-bin-4.2/server/default/conf/jboss-log4j.xml || exit 1
chown jboss:jboss /opt/jboss-bin-4.2/server/default/conf/jboss-log4j.xml || exit 1
2010-10-22 17:24:48 +02:00
2010-11-12 13:27:57 +01:00
# temp fix (waiting for updated pkgs) for 389-ds dir perms
chmod 755 /var/lock/dirsrv || exit 1
chmod 755 /var/lib/dirsrv || exit 1
2010-10-19 19:41:55 +02:00
# setup 389 schema
2010-10-22 17:24:48 +02:00
cp /.mcs/389-mailware-schema/* /etc/dirsrv/schema/ || exit 1
2010-10-19 19:41:55 +02:00
chown root:root /etc/dirsrv/schema/*.ldif -R || exit 1
2010-10-22 17:24:48 +02:00
# setup config
cp /.mcs/mailware-sabayon-conf/web/WEB-INF/balance.xml /opt/jboss-bin-4.2/server/default/deploy/MailWare-Manager.war/WEB-INF/balance.xml || exit 1
cp /.mcs/mailware-sabayon-conf/web/WEB-INF/conf/axis2.xml /opt/jboss-bin-4.2/server/default/deploy/MailWare-Manager.war/WEB-INF/conf/axis2.xml || exit 1
2010-10-19 19:41:55 +02:00
2010-11-05 14:31:41 +01:00
# setup MySQL jdbc connector
echo "setting up MySQL jdbc connector"
ln -s /usr/share/jdbc-mysql/lib/jdbc-mysql.jar /opt/jboss-bin-4.2/server/default/lib/ || exit 1
# setup MCS MySQL password
sed -i "s:<password>password</password>:<password>mcsmanager</password>:g" /opt/jboss-bin-4.2/server/default/deploy/mailware-collaboration-mysql-ds.xml || exit 1
sed -i "s:<password>password</password>:<password>mcsmanager</password>:g" /opt/jboss-bin-4.2/server/default/deploy/bedework-mysql-ds.xml || exit 1
sed -i "s:org.bedework.global.jdbcpw=.*:org.bedework.global.jdbcpw=mcsmanager:g" /opt/jboss-bin-4.2/server/default/deploy/rpical.ear/properties/calendar/env.properties || exit 1
2010-11-05 14:37:24 +01:00
sed -i "s:mailware1.babel.it:localhost:g" /opt/jboss-bin-4.2/server/default/deploy/*/WEB-INF/classes/mw-collaboration.properties || exit 1
sed -i "s:mailware1:localhost:g" /opt/jboss-bin-4.2/server/default/deploy/*/WEB-INF/classes/mw-collaboration.properties || exit 1
2010-11-05 14:31:41 +01:00
2010-10-19 19:41:55 +02:00
mkdir /maildirs || exit 1
chown mail:mail /maildirs -R || exit 1
# Setup dovecot
cp /.mcs/dovecot*.conf /etc/dovecot/ || exit 1
chown root:root /etc/dovecot/dovecot*.conf || exit 1
chmod 644 /etc/dovecot/dovecot*.conf || exit 1
2010-11-05 14:31:41 +01:00
touch /etc/dovecot/passwd.masterusers || exit 1
2010-10-19 19:41:55 +02:00
2010-10-23 12:34:49 +02:00
# Setup ejabberd, why do I need to enable shell for ejabberd-babel?
usermod -s /bin/sh jabber || exit 1
2010-10-28 12:04:04 +02:00
usermod -d /home/jabber -m jabber || exit 1
mkdir -p /home/jabber || exit 1
chown jabber:jabber /home/jabber -R || exit 1
# Copy babel configuration file over
2010-11-05 16:14:53 +01:00
cp /.mcs/ejabberd.cfg.vanilla.working /etc/jabber/ejabberd.cfg || exit 1
2010-10-28 12:04:04 +02:00
chown root:jabber /etc/jabber/ejabberd.cfg || exit 1
chmod 640 /etc/jabber/ejabberd.cfg || exit 1
2010-10-23 12:34:49 +02:00
2010-10-15 20:59:30 +02:00
# add services to init
2010-10-16 23:52:11 +02:00
# autostarted by the mcs setup script
## rc-update add 389-ds default
## rc-update add 389-admin default
2010-10-15 20:59:30 +02:00
rc-update add 389-ds-snmp default
rc-update add jboss-bin-4.2 default
rc-update add mysql default
2010-10-16 23:52:11 +02:00
rc-update add dovecot default
rc-update add postfix default
2010-10-23 00:51:20 +02:00
rc-update add ejabberd default
2010-10-15 20:59:30 +02:00
# remove unused services from init
rc-update del sabayon-mce default
rc-update del sabayon-mce boot
rc-update del music default
2010-10-16 23:52:11 +02:00
# remove temp .mcs dir
rm /.mcs -rf
2010-10-15 20:59:30 +02:00
# Sabayon stuff
2010-10-21 09:54:17 +02:00
echo "Working out Sabayon stuff"
rm -rf /install-data || exit 1
rm -rf /usr/share/sabayon/xdg || exit 1
2010-10-21 17:32:43 +02:00
rm -rf /usr/share/applications/sabayon-*.desktop
2010-10-15 20:59:30 +02:00
mount -t proc proc /proc
/lib/rc/bin/rc-depend -u
echo "Vacuum cleaning client db"
rm /var/lib/entropy/client/database/*/sabayonlinux.org -rf
2011-06-24 16:14:07 +02:00
rm /var/lib/entropy/client/database/*/sabayon-weekly -rf
2010-10-15 20:59:30 +02:00
equo rescue vacuum
# cleanup log dir
rm /var/lib/entropy/logs -rf
# Generate openrc cache
2011-07-06 10:58:26 +02:00
touch /lib/rc/init.d/softlevel
2010-10-15 20:59:30 +02:00
/etc/init.d/savecache start
/etc/init.d/savecache zap
ldconfig
ldconfig
umount /proc
equo deptest --pretend
emaint --fix world
# remove non-interactive settings
rm /etc/env.d/00mcs-etp-noninteractive -f
rm -rf /var/lib/entropy/*cache*