summaryrefslogblamecommitdiffstats
path: root/satellit_installer/satellit_installer
blob: d609bec4c4d4ef06046004eff328c8155795a9e0 (plain) (tree)

























                                                                                







                                                                                  


                                            
 
                                                   

                                     
 





                         
                                          
                               
                                            
                   

                         
          



                                                                            





                                                                        
                                                                            
 

                             










                                                                                                      




                                                                                         
                                                                                          



                                                                                                                     
                                                                                                                      
 
                   
 
                                                                                





                                                                     

                                                                                






                                                               
                                     

                                               
 





                                                                           
                                                                                      

               

          
           

      
#!/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 "#"

if [ "$1" == "-h" -o "$1" == "--help" ]; then
	echo "#"
	echo "# Currently there are no options to be set. If you need to change"
	echo "# any predefined values, take a look into includes/00-variables.inc"
	echo "# and set them there."
	exit
fi

# Set and save some environmental variables:
OLDUMASK=$(umask)
OLD_DEBIAN_FRONTEND="$DEBIAN_FRONTEND"

# For other variables see includes/00-variables.inc
export SELF="$(readlink -f "$0")"
export BASEDIR="$(dirname "${SELF}")"

#
#
#	TRAPPING hierhin!
#
#

# First, to include includes include them:
echo -n "# Sourcing includes: "
for INCLUDE in "$BASEDIR"/includes/*.inc; do
	echo -n "."
	source "$INCLUDE"
done
echo " ok"

####### Main program #######

install_packages "$PACKAGELIST_SCRIPT"		# Packages needed for script

# Then, let's download the needed helper files to static_files, as there
# is no sense in commencing if one of these files is missing.
get_files_http
[ "${ERR}" -ne 0 ] && exit 1

setup_dhcp					# dhcp: no dhclient but pump

uninstall_packages mpt-status

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_users_groups				# Adding necessary users and groups

sudo_config					# Adding sudo config for user taskmanager

add_mysql_dbs_users				# mysql stuff; adding databases and users
patch_mysql_config				# adding utf8 entries to /etc/mysql/my.cnf

unpack_tar_gz "$BASEDIR/static_files/ftp-config.tar.gz" "-C /"		# $1: tar.gz-file, $2: unpacking to directory

patch_pureftpd_config bwLehrpool bwLehrpool "$MYSQL_BWLEHRPOOL_PASS"	# $1: user, $2: database, $3: Password
check_pureftpd_key							# check pureftp key (and gen. on if necessary)

patch_atftpd_config

patch_lighttpd_config "$OPENSLXSRVDIR"/www		# $1: lighttpd http root

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 $OPENSLXSRVDIR/www"
unpack_tar_gz "$BASEDIR/static_files/openslx_tftp.tar.gz" "-C $OPENSLXSRVDIR"
unpack_tar_gz "$BASEDIR/static_files/ldadp.tgz" "-C /opt/ldadp"

set_directory_permissions

# NFS server configuration:
config_nfs

# Samba configuration: User and share
# This is out-commented, as not needed recently
# setup_samba

# 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! This is for debugging purposes only!
# purge_install

set_prompt

end_message

exit 0