#!/bin/bash
#Hier gehören die eigenen Pfade rein
DRQUEUE_MASTER=127.0.0.1 #URL/IP des Masters
DRQUEUE_INSTALL_PATH=/opt #Installationspfad für drqueue
DRQUEUE_DATA_PATH=/mnt/drqueue #Pfad für die gerenderten Daten(wird per Samba an alle Rechner verteilt)
DRQVERSION=0.64.3 #Zu installierende drqueue-Version
INSTALL_TYPE=MASTER #Typ der Installation (MASTER oder SLAVE)
USERNAME=test #Username für SMB-Mount
PASSWORD=test #Passwort für SMB-Mount
#Benötigte Abhängigkeiten installieren:
apt-get -y install scons libgtk2.0-dev g++ gcc python samba smbfs tcsh
#Erstmal besorgen wir uns ne funktionsfähige Version
#von drqueue und packen sie aus
cd /usr/src
wget http://drqueue.org/files/drqueue.$DRQVERSION.tgz
tar -xzvf drqueue.$DRQVERSION.tgz
cd drqueue-$DRQVERSION
scons PREFIX=$DRQUEUE_INSTALL_PATH install #Dr.Queue installieren
scons PREFIX=$DRQUEUE_INSTALL_PATH install #Installation wiederholen nach Abbruch
DRQUEUE_INSTALL_PATH=$DRQUEUE_INSTALL_PATH/drqueue
cd $DRQUEUE_INSTALL_PATH
echo "Bitte ändern Sie im Folgenden die Pfade entsprechend ihrer Konfiguration ab."
echo -e "\n#Customized Configuration\nlogs=$DRQUEUE_DATA_PATH/logs\ntmp=$DRQUEUE_DATA_PATH/tmp\ndb=$DRQUEUE_INSTALL_PATH/db\nbin=$DRQUEUE_INSTALL_PATH/bin\netc=$DRQUEUE_INSTALL_PATH/etc" >> etc/master.conf
echo -e "\n#Customized Configuration\nlogs=$DRQUEUE_DATA_PATH/logs\ntmp=$DRQUEUE_DATA_PATH/tmp" >> etc/slave.conf
echo -e "\n#Customized Configuration\nlogs=$DRQUEUE_DATA_PATH/logs\ntmp=$DRQUEUE_DATA_PATH/tmp\ndb=$DRQUEUE_INSTALL_PATH/db" >> etc/drqman.conf
mkdir $DRQUEUE_DATA_PATH
chmod a+rwx $DRQUEUE_DATA_PATH
#Erstellen der Shared Directory auf dem Server,
#nur wenn Installation auf dem Server läuft.
if [ "$INSTALL_TYPE" == "MASTER" ] ; then
cd $DRQUEUE_DATA_PATH
mkdir etc tmp logs db
chmod a+rwx etc tmp logs db
#Gemeinsamen Ordner mit Samba erstellen
cd /etc/samba
echo -e "[drqueue]\npath = $DRQUEUE_DATA_PATH\nwritable = yes\npublic = yes\ncomment = dr_queue\navailable = yes\nbrowseable = yes\nguest ok = yes\nforce user = root\ncreate mask = 0777\ndirectory mask = 0777" >> smb.conf
elif [ "$INSTALL_TYPE" == "SLAVE" ] ; then
echo "//$DRQUEUE_MASTER/drqueue $DRQUEUE_DATA_PATH smbfs guest,dmask=0777 0 0" >> /etc/fstab
mount -a
fi
#Wir wollen das die Variablen beim Einloggen erstellt werden,
#also rein damit in die .bashrc(für dediziert Slaves/Master ist ein anderes vorgehen erforderlich)
echo "#Pfade für DRQUEUE" >> $HOME/.bashrc
echo "export DRQUEUE_DB=$DRQUEUE_DATA_PATH/db" >> $HOME/.bashrc
echo "export DRQUEUE_LOGS=$DRQUEUE_DATA_PATH/logs" >> $HOME/.bashrc
echo "export DRQUEUE_ETC=$DRQUEUE_INSTALL_PATH/etc" >> $HOME/.bashrc
echo "export DRQUEUE_ROOT=$DRQUEUE_INSTALL_PATH" >> $HOME/.bashrc
echo "export DRQUEUE_TMP=$DRQUEUE_DATA_PATH/tmp" >> $HOME/.bashrc
echo "export DRQUEUE_MASTER=$DRQUEUE_MASTER" >> $HOME/.bashrc
echo "export PATH=$PATH:$DRQUEUE_INSTALL_PATH/bin" >> $HOME/.bashrc
echo "Installation abgeschlossen, dieser Rechner ist ein $INSTALL_TYPE"