diff options
author | Christian Rößler | 2013-05-13 16:07:22 +0200 |
---|---|---|
committer | Christian Rößler | 2013-05-13 16:07:22 +0200 |
commit | 9172bf4a705b9ea472593a3d9dbdbc9e8fb365fd (patch) | |
tree | 347d0eb9e6607f671296bd7780010ffb72d466fd /data | |
parent | Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff) | |
download | tm-scripts-9172bf4a705b9ea472593a3d9dbdbc9e8fb365fd.tar.gz tm-scripts-9172bf4a705b9ea472593a3d9dbdbc9e8fb365fd.tar.xz tm-scripts-9172bf4a705b9ea472593a3d9dbdbc9e8fb365fd.zip |
Zusätzlich: Installation und Konfiguration von lighttpd und tftpd
Diffstat (limited to 'data')
-rwxr-xr-x | data/install_server.sh | 105 |
1 files changed, 104 insertions, 1 deletions
diff --git a/data/install_server.sh b/data/install_server.sh index 947f1688..ca67a6ed 100755 --- a/data/install_server.sh +++ b/data/install_server.sh @@ -1,6 +1,6 @@ #!/bin/sh -TOOLS="git squashfs-tools rsync" # TODO: lighttpd tftpd(?) +TOOLS="git squashfs-tools rsync lighttpd tftpd" for tool in $TOOLS; do echo " ###### Installiere $tool ##########" @@ -10,12 +10,115 @@ done # lighttpd konfigurieren # konfig: www-root = /srv/openslx/www +# damit es keinen Ärger wg. noch nicht vorhandenem docroot gibt +echo "Konfiguriere lighttpd ..." +echo "Stoppe installierten lighttpd ..." +/etc/init.d/lighttpd stop +ERR=$? +if [ "$ERR" -gt 0 ]; then + echo "Konnte lighttpd nicht anhalten - Abbruch!" + exit 1 +fi + +# lighttpd-Konfiguration patchen + +echo "Passe lighttpd-Konfiguration an ..." +cp -p /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig +ERR=$? +if [ "$ERR" -gt 0 ]; then + echo "Konnte alte lighttpd-Konfiguration nicht sichern - Abbruch!" + exit 1 +fi + +cat /etc/lighttpd/lighttpd.conf|sed 's/\/var\/www/\/srv\/openslx\/www/g'>/etc/lighttpd/lighttpd.conf.tmp +ERR=$? +if [ "$ERR" -gt 0 ]; then + echo "Konnte lighttpd-Konfiguration nicht patchen - Abbruch!" + exit 1 +fi + +mv /etc/lighttpd/lighttpd.conf.tmp /etc/lighttpd/lighttpd.conf +ERR=$? +if [ "$ERR" -gt 0 ]; then + echo "Konnte neue lighttpd-Konfiguration nicht speichern - Abbruch!" + exit 1 +fi + +# neues docroot (/srv/openslx/www) prüfen und ggf. erzeugen - ggf. altes docroot löschen? +echo "Prüfe docroot für lighttpd (/srv/openslx/www) ..." +if [ ! -d /srv/openslx/www ] ; then + echo "Erzeuge neues docroot für lighttpd (/srv/openslx/www) ..." + mkdir -p /srv/openslx/www + ERR=$? + if [ "$ERR" -gt 0 ]; then + echo "Konnte kein lighttpd-docroot-Verzeichnis erstellen - Abbruch!" + exit 1 + fi +fi + +# ... und lighttpd wieder hochziehen: +echo "Starte installierten lighttpd ..." +/etc/init.d/lighttpd start +ERR=$? +if [ "$ERR" -gt 0 ]; then + echo "Konnte lighttpd nicht starten - Abbruch!" + exit 1 +fi + # tftpd konfigurieren # tftp root = /srv/openslx/tftp +echo "Konfiguriere tftpd ..." +# neues docroot (/srv/openslx/tftp) prüfen und ggf. erzeugen - ggf. altes docroot löschen? +echo "Prüfe docroot für tftpd (/srv/openslx/tftp) ..." +if [ ! -d /srv/openslx/tftp ] ; then + echo "Erzeuge neues docroot für tftpf (/srv/openslx/tftp) ..." + mkdir -p /srv/openslx/tftp + ERR=$? + if [ "$ERR" -gt 0 ]; then + echo "Konnte kein tftpd-docroot-Verzeichnis erstellen - Abbruch!" + exit 1 + fi +fi + +echo "Halte xinetd an ..." +# Erstmal xinetd (kam mit tftpd) anhalten +/etc/init.d/xinetd stop # besser wäre zB service xinetd stop, aber wg. Kompatibilität +ERR=$? +if [ "$ERR" -gt 0 ]; then + echo "Konnte xinetd nicht anhalten - Abbruch!" + exit 1 +fi + +# tftpd-Konfiguration einschreiben +cat>/etc/xinetd.d/tftp<<HEREEND # +service tftp +{ +protocol = udp +port = 69 +socket_type = dgram +wait = yes +user = nobody +server = /usr/sbin/in.tftpd +server_args = /srv/openslx/tftp +disable = no +} +HEREEND + +echo "starte xinetd ..." +/etc/init.d/xinetd start +ERR=$? +if [ "$ERR" -gt 0 ]; then + echo "Konnte xinetd nicht starten - Abbruch!" + exit 1 +fi + echo " ##### Klone das mltk repository ########" +mkdir -p /opt/openslx +cd /opt/openslx + git clone git://git.openslx.org/openslx-ng/tm-scripts echo "....Fertig" |