diff options
author | root | 2014-06-30 15:21:04 +0200 |
---|---|---|
committer | root | 2014-06-30 15:21:04 +0200 |
commit | 9aabe45d6e2865dcc95e4a6f5823c9310904b1e9 (patch) | |
tree | 2b53f43e95d3944b73864f4e5995a75ab42a61b0 /satellit_installer/satellit_installer | |
download | setup-scripts-9aabe45d6e2865dcc95e4a6f5823c9310904b1e9.tar.gz setup-scripts-9aabe45d6e2865dcc95e4a6f5823c9310904b1e9.tar.xz setup-scripts-9aabe45d6e2865dcc95e4a6f5823c9310904b1e9.zip |
[SSPS] Satellite server preparation script. Further heavy debugging needed -
this is just the first checkin after tidying to server as a starting point.
Diffstat (limited to 'satellit_installer/satellit_installer')
-rwxr-xr-x | satellit_installer/satellit_installer | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/satellit_installer/satellit_installer b/satellit_installer/satellit_installer new file mode 100755 index 0000000..c560b50 --- /dev/null +++ b/satellit_installer/satellit_installer @@ -0,0 +1,137 @@ +#!/bin/bash + +# set -x + +# This script tries to install a bwLehrpool satellite server in a (hopefully) +# automatic fashion. It is only verified to work on a Debian 7.x distribution. +# While it may work on any recent Debian-derived distribution this is not +# guaranteed in any way. +# +# If there were any errors in running this script do the following steps to +# re-install: +# 1. Un-outcomment the call to purge_install near the end of this script. +# 2. re-run the script; ignore any errors like "ERROR 1045 (28000): Access +# denied for user 'root'@'localhost'". This is caused by mysql root password +# mismatch; it will vanish on the second run. purge_install will uninstall +# the packages given in PACKAGELIST_SERVER _and_ purge their configuration. +# 3. re-run the script again; then the mysql root password will be set to the +# queried password entry. Then the mysql databases and users will be deleted. +# 4. Out-comment the call to purge_install and run the script again for a clean +# install. +# This cumbersome way will be remedied in the future. + +echo "#" +echo "# bwSuite Server and environment autoinstaller" +echo "#" + +# Set and save some environmental variables: +OLDUMASK=$(umask) +OLD_DEBIAN_FRONTEND="$DEBIAN_FRONTEND" +umask 0066 # in case we write something. + +export SELF="$(readlink -f "$0")" +export BASEDIR="$(dirname "${SELF}")" +export LOGDIR="$BASEDIR/config" +export INSTALLDIR="/opt/dmsd/" +export TASKMANDIR="/opt/taskmanager/" +export OPENSLXDIR="/opt/openslx/" +USERKILL="" +export DEBIAN_FRONTEND=noninteractive # Part of keepeng apt quiet +export LANG=en_US.UTF-8 + +# +# +# TRAPPING hierhin! +# +# + +# Set list of needed packages (scripting needs) - remember, Debian-specific so far. +PACKAGELIST_SCRIPT="cracklib-runtime vim" + +# Set list of needed packages (server needs) - remember, Debian-specific so far. +PACKAGELIST_SERVER="mysql-server lighttpd pure-ftpd-mysql atftpd php5-cgi php5-curl cifs-utils" +PACKAGELIST_SERVER+=" sudo php5-common php5-mysqlnd openjdk-7-jre-headless nfs-kernel-server nfs-common pump" +PACKAGELIST_SERVER+=" nfs-common pump" + +# First, to include includes include them: +for INCLUDE in "$BASEDIR"/includes/*.inc; do + echo "# Sourcing $INCLUDE..." + source "$INCLUDE" +done + +####### Main program ####### + +install_packages "$PACKAGELIST_SCRIPT" # Packages needed for script +setup_dhcp # dhcp: no dhclient but pump +prerequisites # config directory, locales + +# query_passwords +set_passwords # only to be used within certain circumstances - + # see includes/query_user. + +preset_mysql_root # so mysqld keeps quiet when installing +install_packages "$PACKAGELIST_SERVER" # Packages needed for server + +check_users # Meet interesting users with uid>=1000 and kill them. + # user 65534/sync will be ignored. +add_group openslx 1000 +add_group taskmanager 1001 +add_group ldadp 1002 +add_group images 12345 +add_user openslx 1000 1000 +add_user taskmanager 1001 1001 +add_user bwlehrpool 10001 12345 +add_user ldadp 1002 1002 + +# Adding sudo config for user taskmanager: +sudo_config + +# Now comes mysql stuff; adding databases: +mysql_add_db openslx +mysql_add_db bwLehrpool +# $1=user, $2=database, $3=privileges, $4=password +mysql_add_user bwLehrpool bwLehrpool "DELETE, INSERT, SELECT, UPDATE" "$MYSQL_BWLEHRPOOL_PASS" +mysql_add_user openslx openslx ALL "$MYSQL_OPENSLX_PASS" +# $1=sql-dumpfile, $2=database +mysql_import_dump "$BASEDIR/static_files/db_bwLehrpool_dump.sql" bwLehrpool +mysql_import_dump "$BASEDIR/static_files/db_openslx_dump.sql" openslx + + +# $1: tar.gz-file, $2: option for unpacking base dir +unpack_tar_gz "$BASEDIR/static_files/ftp-config.tar.gz" "-C /" + +# $1: user, $2: database, $3: Password +patch_pureftpd_config bwLehrpool bwLehrpool "$MYSQL_BWLEHRPOOL_PASS" +patch_atftpd_config +# $1: lighttpd http root +patch_lighttpd_config /srv/openslx/www + +install_bwSuite_server /opt/dmsd + +install_taskmanager /opt/taskmanager + +unpack_tar_gz "$BASEDIR/static_files/openslx.tar.gz" "-C $OPENSLXDIR" +unpack_tar_gz "$BASEDIR/static_files/openslx_www.tar.gz" "-C /srv/openslx/www" +unpack_tar_gz "$BASEDIR/static_files/openslx_tftp.tar.gz" "-C /srv/openslx" +unpack_tar_gz "$BASEDIR/static_files/ldadp.tgz" "-C /opt/ldadp" + +set_directory_permissions + +# NFS server configuration: +config_nfs + +# This part drops a script and anchors it's execution within root's bashrc: +script_dropper + +# Change motd to something openslx-ng-ier... +set_motd + +# Activate 'purge_install' here - but be careful! +# +# purge_install + + + +# umask $OLDUMASK + +exit 0 |