diff options
author | Simon Rettberg | 2014-10-22 19:13:05 +0200 |
---|---|---|
committer | Simon Rettberg | 2014-10-22 19:13:05 +0200 |
commit | 0d8dded26c5c1934eb1f4dd85228595c6eb43a0a (patch) | |
tree | e43874c96bd0e4404c4f47809ffbba2c97b87dc0 | |
parent | Add open-vm-tools (diff) | |
download | setup-scripts-0d8dded26c5c1934eb1f4dd85228595c6eb43a0a.tar.gz setup-scripts-0d8dded26c5c1934eb1f4dd85228595c6eb43a0a.tar.xz setup-scripts-0d8dded26c5c1934eb1f4dd85228595c6eb43a0a.zip |
Outsource and translate firstrun.sh, rename variables
- Moved the firstrun script to a static file to make its handling easier (no more escaping hell)
- firstrun.sh is now in German, as it will be run by the end user
- Also renamed some variables to better fit their purpose (LOGDIR, INSTALLDIR)
-rw-r--r-- | satellit_installer/includes/00-dirs.inc | 11 | ||||
-rw-r--r-- | satellit_installer/includes/00-variables.inc | 11 | ||||
-rw-r--r-- | satellit_installer/includes/10-purge_install.inc | 4 | ||||
-rw-r--r-- | satellit_installer/includes/10-query_user.inc | 16 | ||||
-rw-r--r-- | satellit_installer/includes/10-script_dropper.inc | 189 | ||||
-rw-r--r-- | satellit_installer/includes/10-set_motd.inc | 9 | ||||
-rw-r--r-- | satellit_installer/includes/20-prerequisites.inc | 2 | ||||
-rwxr-xr-x | satellit_installer/satellit_installer | 17 | ||||
-rw-r--r-- | satellit_installer/static_files/dropped_script | 155 |
9 files changed, 197 insertions, 217 deletions
diff --git a/satellit_installer/includes/00-dirs.inc b/satellit_installer/includes/00-dirs.inc new file mode 100644 index 0000000..091ee13 --- /dev/null +++ b/satellit_installer/includes/00-dirs.inc @@ -0,0 +1,11 @@ +# Do not rename this file, it is copied later on by the script dropper +export CONFIGDIR="$BASEDIR/config" +export DMSDDIR="/opt/dmsd/" +export TASKMANDIR="/opt/taskmanager/" +export OPENSLXDIR="/opt/openslx/" +export OPENSLXSRVDIR="/srv/openslx/" +export LDADPDIR="/opt/ldadp/" +export SYNCDAEMONDIR="/opt/syncdaemon/" +export TFTPDIR="/srv/openslx/tftp" +export WWWDIR="/srv/openslx/www" +readonly CONFIGDIR DMSDDIR TASKMANDIR OPENSLXDIR OPENSLXSRVDIR LDADPDIR SYNCDAEMONDIR TFTPDIR WWWDIR diff --git a/satellit_installer/includes/00-variables.inc b/satellit_installer/includes/00-variables.inc index 80ad884..5d8f115 100644 --- a/satellit_installer/includes/00-variables.inc +++ b/satellit_installer/includes/00-variables.inc @@ -6,17 +6,6 @@ # SELF="$(readlink -f "$0")" # BASEDIR="$(dirname "${SELF}")" -export LOGDIR="$BASEDIR/config" -export INSTALLDIR="/opt/dmsd/" -export TASKMANDIR="/opt/taskmanager/" -export OPENSLXDIR="/opt/openslx/" -export OPENSLXSRVDIR="/srv/openslx/" -export LDADPDIR="/opt/ldadp/" -export SYNCDAEMONDIR="/opt/syncdaemon/" -export TFTPDIR="/srv/openslx/tftp" -export WWWDIR="/srv/openslx/www" -readonly LOGDIR INSTALLDIR TASKMANDIR OPENSLXDIR OPENSLXSRVDIR LDADPDIR SYNCDAEMONDIR TFTPDIR WWWDIR - export DEBIAN_FRONTEND="noninteractive" # Part of keeping apt quiet export LANG="en_US.UTF-8" diff --git a/satellit_installer/includes/10-purge_install.inc b/satellit_installer/includes/10-purge_install.inc index 921ae11..bc109c8 100644 --- a/satellit_installer/includes/10-purge_install.inc +++ b/satellit_installer/includes/10-purge_install.inc @@ -1,6 +1,6 @@ read_password() { - MYSQL_ROOT_PASS="$(grep MYSQL_ROOT_PASS "$LOGDIR/config"|cut -f 2 -d "=")" 2>/dev/null - MYSQL_ROOT_PASS_OLD="$(grep MYSQL_ROOT_PASS "$LOGDIR/config.prerun" | cut -f 2 -d "=")" 2>/dev/null + MYSQL_ROOT_PASS="$(grep MYSQL_ROOT_PASS "$CONFIGDIR/config"|cut -f 2 -d "=")" 2>/dev/null + MYSQL_ROOT_PASS_OLD="$(grep MYSQL_ROOT_PASS "$CONFIGDIR/config.prerun" | cut -f 2 -d "=")" 2>/dev/null } purge_install() { diff --git a/satellit_installer/includes/10-query_user.inc b/satellit_installer/includes/10-query_user.inc index 45e3bee..8b214ff 100644 --- a/satellit_installer/includes/10-query_user.inc +++ b/satellit_installer/includes/10-query_user.inc @@ -48,10 +48,10 @@ query_passwords() { echo "$ANSWER_OK" done # Activate this only for debugging purposes... - # echo "OPENSLX_PASS=$OPENSLX_PASS" >> "$LOGDIR"/config - # echo "MYSQL_ROOT_PASS=$MYSQL_ROOT_PASS" >> "$LOGDIR"/config - # echo "MYSQL_OPENSLX_PASS=$MYSQL_OPENSLX_PASS" >> "$LOGDIR"/config - # echo "MYSQL_BWLEHRPOOL_PASS=$MYSQL_BWLEHRPOOL_PASS" >> "$LOGDIR"/config + # echo "OPENSLX_PASS=$OPENSLX_PASS" >> "$CONFIGDIR"/config + # echo "MYSQL_ROOT_PASS=$MYSQL_ROOT_PASS" >> "$CONFIGDIR"/config + # echo "MYSQL_OPENSLX_PASS=$MYSQL_OPENSLX_PASS" >> "$CONFIGDIR"/config + # echo "MYSQL_BWLEHRPOOL_PASS=$MYSQL_BWLEHRPOOL_PASS" >> "$CONFIGDIR"/config } generate_password() { @@ -73,9 +73,9 @@ set_passwords() { # as they will be changed by the dropper script. # If you need the permanently valid password, you will need to # decrypt static_files/new_passwords.encrypted. - echo "OPENSLX_PASS=$OPENSLX_PASS" > "$LOGDIR"/config - echo "MYSQL_ROOT_PASS=$MYSQL_ROOT_PASS" >> "$LOGDIR"/config - echo "MYSQL_OPENSLX_PASS=$MYSQL_OPENSLX_PASS" >> "$LOGDIR"/config - echo "MYSQL_BWLEHRPOOL_PASS=$MYSQL_BWLEHRPOOL_PASS" >> "$LOGDIR"/config + echo "OPENSLX_PASS=$OPENSLX_PASS" > "$CONFIGDIR"/config + echo "MYSQL_ROOT_PASS=$MYSQL_ROOT_PASS" >> "$CONFIGDIR"/config + echo "MYSQL_OPENSLX_PASS=$MYSQL_OPENSLX_PASS" >> "$CONFIGDIR"/config + echo "MYSQL_BWLEHRPOOL_PASS=$MYSQL_BWLEHRPOOL_PASS" >> "$CONFIGDIR"/config echo "ok." } diff --git a/satellit_installer/includes/10-script_dropper.inc b/satellit_installer/includes/10-script_dropper.inc index 703ff2e..ac6ed03 100644 --- a/satellit_installer/includes/10-script_dropper.inc +++ b/satellit_installer/includes/10-script_dropper.inc @@ -1,185 +1,22 @@ -patch_bashrc() { - if [ $(grep -c $(echo "^${INSTALLDIR}.*first_run") /root/.bashrc) -gt 0 ]; then - echo "# first_run script already in root's bashrc, doing nothing." +patch_profile() { + if grep -q "/root/installer/firstrun.sh" /root/.profile; then + echo "# first_run script already in root's .profile, doing nothing." else - echo "# Patching root's bashrc...) " - echo "${INSTALLDIR}/first_run" >> /root/.bashrc + echo "# Patching root's .profile" + echo "/root/installer/firstrun.sh" >> /root/.profile fi } -copy_public_key() { - cp -p "${BASEDIR}/static_files/finish_setup_public_key.pem" ${INSTALLDIR} \ - || echo "Warning: Could not copy public key to ${INSTALLDIR}!" -} - drop_script() { - cat >"${INSTALLDIR}/first_run"<<-EOF - #!/bin/bash - - generate_password() { - local password="\$(< /dev/urandom tr -dc _A-Za-z0-9 | head -c${1:-16};)" - echo "\$password" - } - - LANG=en_US.UTF-8 - echo - echo "Satellite server install post-install script" - echo - echo "This script will set safe password for root, the mysql root user," - echo 'two mysql user accounts (openslx and bwLehrpool) and debian-sys-maint.' - echo - echo "We recommend you choose a secure password for root. The other" - echo "passwords will be auto generated." - echo "" - echo "Please set a secure password for root:" - echo "" - passwd - echo - echo "Thank you." - echo - echo "Now we will auto-generate new passwords for the mentioned mysql users:" - echo - MYSQL_ROOT_PASS="\$(grep MYSQL_ROOT_PASS "$LOGDIR/config"|cut -f 2 -d "=")" - umask 0066 - - MYSQL_ROOT_NEW=\$(generate_password) - mysqladmin -u root -p\${MYSQL_ROOT_PASS} password \${MYSQL_ROOT_NEW} - echo "MYSQL_ROOT_PASS=\$MYSQL_ROOT_NEW" > /root/new_passwords - echo "Mysql root password," - - MYSQL_BWLEHRPOOL_NEW=\$(generate_password) - echo "SET PASSWORD FOR 'bwLehrpool'@'localhost' = PASSWORD('\$MYSQL_BWLEHRPOOL_NEW');" | mysql -u root -p\${MYSQL_ROOT_NEW} - echo "MYSQL_BWLEHRPOOL_PASS=\$MYSQL_BWLEHRPOOL_NEW" >> /root/new_passwords - echo "Mysql bwLehrpool password," - - MYSQL_OPENSLX_NEW=\$(generate_password) - echo "SET PASSWORD FOR 'openslx'@'localhost' = PASSWORD('\$MYSQL_OPENSLX_NEW');" | mysql -u root -p\${MYSQL_ROOT_NEW} - echo "MYSQL_OPENSLX_PASS=\$MYSQL_OPENSLX_NEW" >> /root/new_passwords - echo "mysql openslx password," - - MYSQL_SYSMAINT_NEW=\$(generate_password) - echo "SET PASSWORD FOR 'debian-sys-maint'@'localhost' = PASSWORD('\$MYSQL_SYSMAINT_NEW');" | mysql -u root -p\${MYSQL_ROOT_NEW} - echo "and debian-sys-maint." - - echo "... done." - echo - echo "Now we will save the newly set passwords (save debian-sys-maint)" - echo "in an encrypted file..." - - cat /root/new_passwords | openssl rsautl -encrypt -pubin -inkey ${BASEDIR}/static_files/finish_setup_public_key.pem > \ - ${BASEDIR}/static_files/new_passwords.encrypted - rm -f /root/new_passwords 2>/dev/null - echo "...ok." - - echo "And due to popular demand we will save the mysql root password also " - echo "in the file /root/mysqlpass (and set it to 600, of course)... " - echo "\$MYSQL_ROOT_NEW" > /root/mysqlpass - chmod 600 /root/mysqlpass - - # Patching bwLehrpool-mysql-userpass into bwSuite Server config: - sed -i "s/%MYSQL_BWLEHRPOOL_PASS%/\$MYSQL_BWLEHRPOOL_NEW/g" "$INSTALLDIR/Server_Config.ini" - - # Patching bwLehrpool-mysql-userpass into pureftpd config: - sed -i "s/MYSQLPassword.*$/MYSQLPassword \$MYSQL_BWLEHRPOOL_NEW/g" /etc/pure-ftpd/db/mysql.conf - - # Patching bwLehrpool-mysql-userpass into satellite-daemon config: - sed -i "s/%MYSQL_BWLEHRPOOL_PASS%/\$MYSQL_BWLEHRPOOL_NEW/g" /opt/syncdaemon/config/mysql.properties - - # Patching bwLehrpool-mysql-userpass into vmchooser list.php: - sed -i "s/%MYSQL_BWLEHRPOOL_PASS%/\$MYSQL_BWLEHRPOOL_NEW/g" /srv/openslx/www/vmchooser/list.php - - # Patching openslx-mysql-userpass into slx-admin config: - sed -i "s/%MYSQL_OPENSLX_PASS%/\$MYSQL_OPENSLX_NEW/g" "$WWWDIR/slx-admin/config.php" - - # Patching debian-sys-maint password into /etc/mysql/debian.cnf: - sed -i "s/password = .*/password = \$MYSQL_SYSMAINT_NEW/g" "/etc/mysql/debian.cnf" - - # inittab-entry dmsd: - if [ \$(grep -c "dmsd.*respawn" /etc/inittab) -gt 0 ]; then - echo "bwLehrpool Suite inittab entry detected, doing nothing. " - else - echo -n "bwLehrpool Suite: patching inittab..." - echo "dmsd:2345:respawn:$INSTALLDIR/dmsd.sh" >> /etc/inittab - echo "ok." - fi - - # inittab-entry taskmanager: - if [ \$(grep -c "tman.*respawn" /etc/inittab) -gt 0 ]; then - echo "Taskmanager inittab entry detected, doing nothing." - else - echo -n "bwLehrpool Suite: patching inittab..." - echo "tman:2345:respawn:$TASKMANDIR/taskmanager.sh" >> /etc/inittab - echo "ok." - fi - - # inittab-entry syncdaemon: - if [ \$(grep -c "synd.*respawn" /etc/inittab) -gt 0 ]; then - echo "syncdaemon inittab entry detected, doing nothing. " - else - echo -n "syncdaemon: patching inittab..." - echo "synd:2345:respawn:/opt/syncdaemon/syncdaemon.sh" >> /etc/inittab - echo "ok." - fi - - echo "Now, nearing the end, we generate new sshd identities for root." - echo "Old identity files id_rsa and id_rsa.pub will be backed up to .bak." - echo "These keys will not carry a passphrase. Delete it if you do not want this." - echo "Generating keys... " - - [ -f /etc/ssh/ssh_host_rsa_key ] && mv /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.bak - [ -f /etc/ssh/ssh_host_rsa_key.pub ] && mv /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_rsa_key.pub.bak - [ -f /etc/ssh/ssh_host_dsa_key ] && mv /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.bak - [ -f /etc/ssh/ssh_host_dsa_key.pub ] && mv /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_dsa_key.pub.bak - [ -f /etc/ssh/ssh_host_ecdsa_key ] && mv /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.bak - [ -f /etc/ssh/ssh_host_ecdsa_key.pub ] && mv /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub.bak - - echo -n "... RSA ... " - ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N "" -t rsa -q - ERR=\$? - if [ \$ERR -ne 0 ]; then - echo "Error while generating sshd rsa host key. Please check and generate manually, if wanted." - else - echo "ok." - fi - - echo -n "... DSA ... " - ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N "" -t dsa -q - ERR=\$? - if [ \$ERR -ne 0 ]; then - echo "Error while generating sshd dsa host key. Please check and generate manually, if wanted." - else - echo "ok." - fi - - echo -n "... ECDSA ... " - ssh-keygen -f /etc/ssh/ssh_host_ecdsa -N "" -t ecdsa -q - ERR=\$? - if [ \$ERR -ne 0 ]; then - echo "Error while generating sshd ecdsa host key. Please check and generate manually, if wanted." - else - echo "ok." - fi - - echo - echo "Due to popular demand we will now start a script to configure a static IP, if wanted." - echo - /usr/local/sbin/config_static_ip - - echo "Last thing to is to delete the script starter from root's .bashrc..." - sed -i "/first_run/d" /root/.bashrc - echo "...done." - echo - echo "Please reboot the server. Do you want me to reboot it now?" - echo - echo "(Press 'y' to reboot, any other key to end script)" - read REBOOT - [[ "\$REBOOT" == "y" ]] && reboot - EOF - chmod u+x ${INSTALLDIR}/first_run + mkdir -p "/root/installer" + # So we know all the paths and the mysql password + cat "${BASEDIR}/includes/00-dirs.inc" "${CONFIGDIR}/config" > "/root/installer/config" + chmod 0600 "/root/installer/config" + cp "${BASEDIR}/firstrun_script.sh" "/root/installer/firstrun.sh" + chmod u+x "/root/installer/firstrun.sh" } -script_dropper () { - copy_public_key - patch_bashrc +drop_firstrun_script () { + patch_profile drop_script } diff --git a/satellit_installer/includes/10-set_motd.inc b/satellit_installer/includes/10-set_motd.inc deleted file mode 100644 index 769ebb3..0000000 --- a/satellit_installer/includes/10-set_motd.inc +++ /dev/null @@ -1,9 +0,0 @@ -set_motd() { - if [ ! -f /etc/motd.orig ]; then - cp -p /etc/motd /etc/motd.orig - fi - - echo "" > /etc/motd - echo "Welcome to the openSLX-NG Satellite server (bwLehrpool Suite)" >> /etc/motd - echo "" >> /etc/motd -} diff --git a/satellit_installer/includes/20-prerequisites.inc b/satellit_installer/includes/20-prerequisites.inc index 85c896d..1c93405 100644 --- a/satellit_installer/includes/20-prerequisites.inc +++ b/satellit_installer/includes/20-prerequisites.inc @@ -3,7 +3,7 @@ prerequisites() { mkdir -p -m 700 "$BASEDIR"/temp # Old debugging config file there? - [ -f "$LOGDIR/config" ] && cp -p "$LOGDIR/config" "$LOGDIR/config.prerun" 2>/dev/null + [ -f "$CONFIGDIR/config" ] && cp -p "$CONFIGDIR/config" "$CONFIGDIR/config.prerun" 2>/dev/null # 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 diff --git a/satellit_installer/satellit_installer b/satellit_installer/satellit_installer index bf681b8..7451446 100755 --- a/satellit_installer/satellit_installer +++ b/satellit_installer/satellit_installer @@ -100,7 +100,7 @@ patch_lighttpd_config "$WWWDIR" # $1: lighttpd http root write_apt_config -install_bwSuite_server /opt/dmsd +install_bwSuite_server "$DMSDDIR" install_taskmanager /opt/taskmanager @@ -127,22 +127,19 @@ config_nfs # Copying a script to configure a static IP install_config_static_ip -# This part drops a script and anchors it's execution within root's bashrc: -script_dropper - # Set a cronjob to cron.d which cleans bwlp-* stuff from /tmp if older than 2 days install_tmpdelete -# 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 setup_logging +# This part drops a script and anchors it's execution within root's .profile: +drop_firstrun_script + +# Activate 'purge_install' here - but be careful! This is for debugging purposes only! +# purge_install + end_message exit 0 diff --git a/satellit_installer/static_files/dropped_script b/satellit_installer/static_files/dropped_script new file mode 100644 index 0000000..8ffc948 --- /dev/null +++ b/satellit_installer/static_files/dropped_script @@ -0,0 +1,155 @@ +#!/bin/bash + +if [ ! -r "/root/installer/config" ]; then + echo "Keine firstrun-config gefunden! Tue nichts..." + exit 0 +fi + +source "/root/installer/config" || { echo "Fehler beim Sourcen der firstrun-config."; exit 1; } + +if [ -z "$MYSQL_ROOT_PASS" ]; then + echo "WARNUNG: Aktuelles MySQL-root-Passwort nicht bekannt!" + echo "**** Installationsfehler ****" + exit 1 +fi + +MY_PID=$$ +perror() { + echo "$@" + [ "$MY_PID" != "$$" ] && kill "$MY_PID" + exit 5 +} + +generate_password() { + tr -dc _A-Za-z0-9 < /dev/urandom | head -c 16 +} + +patchfiles() { + # <find> <replace> <file1> <file2> ... <fileN> + # Warning: does not escape! + FIND=$1 + REPLACE=$2 + shift 2 + while [ $# -gt 0 ]; do + sed -i "s/${FIND}/${REPLACE}/g" "$1" + shift + done +} + +export LANG=de_DE.UTF-8 + +cat <<-HEREDOC +Willkommen zur Grundkonfiguration des bwLehrpool-Satellitenservers. + +Diese einmalige Konfiguration dient dazu, das root-Passwort des Servers +zu ändern, sowie ggf. die Netzwerkkonfiguration des Servers anzupassen. + +Aus Sicherheitsgründen ist es dringend zu empfehlen, das root-Passwort +im Produktivbetrieb zu ändern! + +HEREDOC + +passwd + +echo +echo "Nun werden einige intern genutzte Passwörter (z.B. MySQL-Zugänge) neu" +echo "generiert....." +umask 0077 + +MYSQL_ROOT_NEW=$(generate_password) +mysqladmin -u root -p"${MYSQL_ROOT_PASS}" password "${MYSQL_ROOT_NEW}" || perror "Neusetzen des root-MySQL-Passworts fehlgeschlagen" +# Just in case... +sed -i "s/^MYSQL_ROOT_PASS=.*\$/${MYSQL_ROOT_NEW}/g" "/root/installer/config" + +MYSQL_BWLEHRPOOL_NEW=$(generate_password) +echo "SET PASSWORD FOR 'bwLehrpool'@'localhost' = PASSWORD('$MYSQL_BWLEHRPOOL_NEW');" | mysql -u root -p"${MYSQL_ROOT_NEW}" || perror "Neusetzen des bwLehrpool-MySQL-Passworts fehlgeschlagen" + +MYSQL_OPENSLX_NEW=$(generate_password) +echo "SET PASSWORD FOR 'openslx'@'localhost' = PASSWORD('$MYSQL_OPENSLX_NEW');" | mysql -u root -p"${MYSQL_ROOT_NEW}" || perror "Neusetzen des openslx-MySQL-Passworts fehlgeschlagen" + +MYSQL_SYSMAINT_NEW=$(generate_password) +echo "SET PASSWORD FOR 'debian-sys-maint'@'localhost' = PASSWORD('$MYSQL_SYSMAINT_NEW');" | mysql -u root -p"${MYSQL_ROOT_NEW}" || perror "Neusetzen des debian-sys-maint-Passworts fehlgeschlagen" + +# Store mysql root pass in root's home +echo "$MYSQL_ROOT_NEW" > /root/mysqlpass +chmod 600 /root/mysqlpass + +# No more going back +unlink "/root/installer/config" 2>/dev/null +sed -i "/firstrun.sh/d" /root/.profile + +# Write MOTD +cat > /etc/motd <<-THEREDOC + *** bwLehrpool Satelliten-Server *** + Eingerichtet am $(date) + + Wenn Sie sich als root eingeloggt haben, haben Sie nun folgende Optionen: + netsetup - Konfiguriert das Netzwerk-Interface neu (DHCP oder statisch) + reboot - System neustarten + poweroff - System herunterfahren + + Andere Modifikationen am System sind in der Regel nicht notwendig. +THEREDOC + +echo "Konfigurationsdateien werden aktualisiert..." + +# bwLehrpool mysql pass +# Patch dmsd, syncdaemon, vmchooser-query-script +patchfiles "%MYSQL_BWLEHRPOOL_PASS%" "$MYSQL_BWLEHRPOOL_NEW" "$DMSDDIR/Server_Config.ini" "/opt/syncdaemon/config/mysql.properties" "/srv/openslx/www/vmchooser/list.php" +# Pureftpd +patchfiles 'MYSQLPassword.*$' "MYSQLPassword $MYSQL_BWLEHRPOOL_NEW" "/etc/pure-ftpd/db/mysql.conf" + +# openslx mysql pass +# Patching openslx-mysql-userpass into slx-admin config: +patchfiles "%MYSQL_OPENSLX_PASS%" "$MYSQL_OPENSLX_NEW" "$WWWDIR/slx-admin/config.php" + +# Patching debian-sys-maint password into /etc/mysql/debian.cnf: +patchfiles 'password *=.*$' "password = $MYSQL_SYSMAINT_NEW" "/etc/mysql/debian.cnf" + +echo "Dienste werden aktiviert..." + +# inittab-entry dmsd: +if ! grep -q "dmsd.*respawn" /etc/inittab; then + echo "dmsd:2345:respawn:$DMSDDIR/dmsd.sh" >> /etc/inittab +fi + +# inittab-entry taskmanager: +if ! grep -c "tman.*respawn" /etc/inittab; then + echo "tman:2345:respawn:$TASKMANDIR/taskmanager.sh" >> /etc/inittab +fi + +# inittab-entry syncdaemon: +if ! grep -c "synd.*respawn" /etc/inittab; then + echo "synd:2345:respawn:/opt/syncdaemon/syncdaemon.sh" >> /etc/inittab +fi + +echo +echo "Neue SSH host keys werden generiert" +echo "(Beim nächsten Verbinden mit dem Satelliten-Server werden Sie möglicherweise" +echo "eine entsprechende Warnung erhalten)" +echo + +rm -f /etc/ssh/ssh_host_*key* 2>/dev/null + +ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N "" -t rsa -q +ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N "" -t dsa -q +ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N "" -t ecdsa -q + +echo "Abschließend können Sie festlegen, ob der Server seine IP-Konfiguration" +echo "per DHCP erhält, oder eine statische Konfiguration verwendet wird." +/usr/local/sbin/netsetup + +cat <<HEREDOC + +Damit ist die Einrichtung abgeschlossen. Die weitere Konfiguration des +bwLehrpool-Systems erfolgt über die Webschnittstelle, die über die +IP-Addresse oder den Hostnamen des Servers erreichbar ist. + +Der Server wird sich jetzt neustarten. + +HEREDOC + +sleep 4 +unlink "/root/installer/firstrun.sh" +reboot + |