summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Rößler2014-06-30 18:39:56 +0200
committerChristian Rößler2014-06-30 18:39:56 +0200
commit088fd8ff43b2463ea93fa26a37806ae734c592fa (patch)
treedcd697794170e76dd6e6cc5f810cb8905063adbb
parent[SSPS] Renaming of includes (.inc extension obligatory) (diff)
downloadsetup-scripts-088fd8ff43b2463ea93fa26a37806ae734c592fa.tar.gz
setup-scripts-088fd8ff43b2463ea93fa26a37806ae734c592fa.tar.xz
setup-scripts-088fd8ff43b2463ea93fa26a37806ae734c592fa.zip
[SSPS] Some more bigfixes; better output, better checks for dhclient/pump.
-rw-r--r--satellit_installer/.gitignore5
-rw-r--r--satellit_installer/includes/20-prerequisites.inc14
-rw-r--r--satellit_installer/includes/30-setup_dhcp.inc69
-rw-r--r--satellit_installer/includes/50-add_mysql_dbs_users13
-rw-r--r--satellit_installer/includes/50-add_users_groups10
-rwxr-xr-xsatellit_installer/satellit_installer68
6 files changed, 92 insertions, 87 deletions
diff --git a/satellit_installer/.gitignore b/satellit_installer/.gitignore
new file mode 100644
index 0000000..468f13f
--- /dev/null
+++ b/satellit_installer/.gitignore
@@ -0,0 +1,5 @@
+*~
+*.swp
+*.so
+/satellit_installer/config/
+/satellit_installer/static_files/new_passwords.encrypted
diff --git a/satellit_installer/includes/20-prerequisites.inc b/satellit_installer/includes/20-prerequisites.inc
index 687b613..85c896d 100644
--- a/satellit_installer/includes/20-prerequisites.inc
+++ b/satellit_installer/includes/20-prerequisites.inc
@@ -7,12 +7,22 @@ prerequisites() {
# Let's look whether an english locale is alread active (we choose en_US.UTF-8)
if [[ $(grep "en_US.UTF-8" /etc/locale.gen|cut -f 1 -d " ") == "#" ]]; then
- echo "# Generating an english locale (UTF-8)..."
+ echo -n "# Generating an english UTF-8 based locale (this may take some time)..."
# Backing up never hurts:
cp -p /etc/locale.gen /etc/locale.gen.orig
# Now patch the localization file:
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
- dpkg-reconfigure locales
+ dpkg-reconfigure locales 2>/dev/null 1>&2
+ if [ "$ERR" -ne 0 ]; then
+ echo
+ echo "# WARNING: Could not reconfigure locales. This is annoying, as"
+ echo "# it will yield some mixed languages, perhaps."
+ echo "# Please make sure thy system has an UTF-8 based"
+ echo "# character set."
+ else
+ echo " ok."
+ fi
+
else
echo "# English locale detected; all is well."
fi
diff --git a/satellit_installer/includes/30-setup_dhcp.inc b/satellit_installer/includes/30-setup_dhcp.inc
index 0d13705..14e2d54 100644
--- a/satellit_installer/includes/30-setup_dhcp.inc
+++ b/satellit_installer/includes/30-setup_dhcp.inc
@@ -1,31 +1,60 @@
-setup_dhcp() {
- # First: let's see whether the package isc-dhcp-client is installed
- # (we do not like it due to udp checksum failures using virtIO)
- echo "# Checking dhcp configuration / utilities..."
- if [ $(which dhclient) ]; then
- echo -n "# dhclient detected. Uninstalling package isc-dhcp-client..."
- dpkg --purge isc-dhcp-client
- ERR=$?
- if [ "$ERR" -ne 0 ]; then
- echo
- echo "# WARNING: Could not uninstall isc-dhcp-client (dhclient)!"
- echo "# Trying to install pump anyway, but make sure"
- echo "# pump is functional!"
- else
- echo " ok."
- fi
+install_dhclient() {
+ echo -n "# Installing dhclient (isc-dhclient)..."
+ apt-get install isc-dhcp-client 2>/dev/null 1>&2
+ if [ "$ERR" -ne 0 ]; then
+ echo
+ echo "# WARNING: Could not re-install dhclient (isc-dhcp-client)!"
+ echo "# This should not happen. I give up."
+ echo "# Please keep in mind this problem has to be solved"
+ echo "# before the next boot, as the server will most likely"
+ echo "# not receive an IP (if not set statically)."
+ else
+ echo " ok."
fi
+}
+install_pump() {
if [ ! $(which pump) ]; then
echo -n "# Installing pump..."
- apt-get install pump
+ apt-get install pump 2>/dev/null 1>&2
if [ "$ERR" -ne 0 ]; then
echo
- echo "# WARNING: Could install isc-dhcp-client (dhclient)!"
- echo "# Trying to install pump anyway, but make sure"
- echo "# pump is functional!"
+ echo "# WARNING: Could not install pump! This is a problem, as pump"
+ echo "# is an essential package. The server install will"
+ echo "# continue, but keep in mind this problem has to be"
+ echo "# solved before the server will work correctly."
+ echo "# Now re-installing dhclient (isc-dhcp-client)..."
+ install_dhclient
else
echo " ok."
fi
fi
}
+
+uninstall_dhclient() {
+ echo -n "# Uninstalling dhclient (isc-dhclient)..."
+ dpkg --remove isc-dhcp-client 2>/dev/null 1>&2
+ if [ "$ERR" -ne 0 ]; then
+ echo
+ echo "# WARNING: Could not uninstall dhclient (isc-dhcp-client)!"
+ echo "# This should not happen. I give up."
+ echo "# Please keep in mind this problem has to be solved"
+ echo "# before the next boot, as the server will most likely"
+ echo "# not receive an IP (if not set statically)."
+ echo "# pump will be installed anyway, but keep an eye on possible problems."
+ else
+ echo " ok."
+ fi
+}
+
+setup_dhcp() {
+ echo "#"
+ echo "# First: let's see whether the package isc-dhcp-client is installed,"
+ echo "# as we do not like it due to udp checksum failures using virtIO."
+ echo "# Checking dhcp configuration / utilities..."
+ if [ $(which dhclient) ]; then
+ echo "# dhclient detected. dhclient will be uninstalled due to virtIO-problems."
+ uninstall_dhclient
+ fi
+ install_pump
+}
diff --git a/satellit_installer/includes/50-add_mysql_dbs_users b/satellit_installer/includes/50-add_mysql_dbs_users
deleted file mode 100644
index 58b7428..0000000
--- a/satellit_installer/includes/50-add_mysql_dbs_users
+++ /dev/null
@@ -1,13 +0,0 @@
-add_mysql_dbs_users() {
- # 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
-}
diff --git a/satellit_installer/includes/50-add_users_groups b/satellit_installer/includes/50-add_users_groups
deleted file mode 100644
index ae93e58..0000000
--- a/satellit_installer/includes/50-add_users_groups
+++ /dev/null
@@ -1,10 +0,0 @@
-add_users_groups() {
- 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
-}
diff --git a/satellit_installer/satellit_installer b/satellit_installer/satellit_installer
index c560b50..17425f8 100755
--- a/satellit_installer/satellit_installer
+++ b/satellit_installer/satellit_installer
@@ -35,34 +35,36 @@ 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
+# Set list of needed packages (scripting needs) - remember, Debian-specific so far.
+PACKAGELIST_SCRIPT="cracklib-runtime"
+
+# 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"
+PACKAGELIST_SERVER+=" nfs-common"
+
#
#
# 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:
+echo -n "# Sourcing includes: "
for INCLUDE in "$BASEDIR"/includes/*.inc; do
- echo "# Sourcing $INCLUDE..."
+ echo -n "."
source "$INCLUDE"
done
+echo " ok"
####### Main program #######
install_packages "$PACKAGELIST_SCRIPT" # Packages needed for script
setup_dhcp # dhcp: no dhclient but pump
+
prerequisites # config directory, locales
# query_passwords
@@ -74,37 +76,19 @@ 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"
+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
+
+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
+
patch_atftpd_config
-# $1: lighttpd http root
-patch_lighttpd_config /srv/openslx/www
+
+patch_lighttpd_config /srv/openslx/www # $1: lighttpd http root
install_bwSuite_server /opt/dmsd
@@ -126,12 +110,12 @@ script_dropper
# Change motd to something openslx-ng-ier...
set_motd
-# Activate 'purge_install' here - but be careful!
+
+# Activate 'purge_install' here - but be careful! This is for debugging purposes only!
#
# purge_install
-
# umask $OLDUMASK
exit 0