diff options
Diffstat (limited to 'satellit_installer/includes')
-rw-r--r-- | satellit_installer/includes/65-gpg.inc | 13 | ||||
-rw-r--r-- | satellit_installer/includes/90-patch_slxadmin.inc | 29 |
2 files changed, 23 insertions, 19 deletions
diff --git a/satellit_installer/includes/65-gpg.inc b/satellit_installer/includes/65-gpg.inc deleted file mode 100644 index 95f51b5..0000000 --- a/satellit_installer/includes/65-gpg.inc +++ /dev/null @@ -1,13 +0,0 @@ - -import_gpg () { - # Install trust for all users - this is dumb but gpg wants to WRITE tp that directory, so - # we can't just use a public dir owned by root with 0755 permissions (which would be OK security-wise, - # as we never sign anything but just want to verify) - local PWUSER - local KEY="/tmp/bwlp-blubbediblubb.asc" - cp "${BASEDIR}/static_files/gpg-key.asc" "$KEY" - chmod 0444 "$KEY" - for PWUSER in taskmanager root; do - sudo -u "$PWUSER" gpg --import "$KEY" || perror "Could not import gpg key for $PWUSER" - done -} diff --git a/satellit_installer/includes/90-patch_slxadmin.inc b/satellit_installer/includes/90-patch_slxadmin.inc index 99f4c16..d6d6e88 100644 --- a/satellit_installer/includes/90-patch_slxadmin.inc +++ b/satellit_installer/includes/90-patch_slxadmin.inc @@ -1,12 +1,12 @@ -patch_slxadmin () { +copy_slxadmin_config () { # Install config cp -p "${BASEDIR}/static_files/slxadmin-config.php" "$WWWDIR/slx-admin/config.php" || perror "slxadmin config.php not found" chmod 640 "$WWWDIR/slx-admin/config.php" chown root:www-data "$WWWDIR/slx-admin/config.php" +} - # appending a variable with satellite server build date/time to slx-admin config: - echo "define('CONFIG_FOOTER', 'Build time: $(date "+%Y-%m-%d %H:%m:%S"), $VERSION');" >> "$WWWDIR/slx-admin/config.php" - +# Prepare files and symlinks in slx-admin www dir +patch_slxadmin_dir () { # Create redirect for / cat > "$WWWDIR/index.php" <<-HIERDOCK <?php @@ -18,8 +18,8 @@ patch_slxadmin () { mkdir -p "$WWWDIR/slx-admin/modules" cd "$WWWDIR/slx-admin/modules" || perror "Cannot cd to slxadmin/modules" for MOD in ${SLXADMIN_MODULES}; do - NAME=${MOD%%-*} - ln -s "../modules-available/$MOD" "$NAME" || pwarning "Could not activate module '$MOD' (alias '$NAME')" + NAME="${MOD%%-*}" + ln -s "../modules-available/$MOD" "$NAME" || perror "Could not activate module '$MOD' (alias '$NAME')" done cd - 1>/dev/null # Add system cronjob to execute slx-admin cronjob @@ -31,3 +31,20 @@ patch_slxadmin () { ln -nfs "../slxadmin-boot.service" "/etc/systemd/system/multi-user.target.wants/slxadmin-boot.service" || perror "Could not enable slxadmin boot service" } +# This needs to be called after mysql users have been created +install_slxadmin_db () { + # Prepare temporary config + copy_slxadmin_config + sed -i "s/%MYSQL_OPENSLX_PASS%/${MYSQL_OPENSLX_PASS}/" "$WWWDIR/slx-admin/config.php" + # Install slx-admin DB + cd "$WWWDIR/slx-admin" || perror "Cannot cd to $WWWDIR" + echo "# Installing slx-admin database" + sudo -n -u www-data ./install-all || perror "Could not install slx-admin database" + cd - 1>/dev/null + # Fill with data we need + php "${BASEDIR}/static_files/slxadmin-init/slxadmin-init.php" || perror "Filling tables with required data failed" + # Reset with original template for firstboot script + copy_slxadmin_config + # appending a variable with satellite server build date/time to slx-admin config: + echo "define('CONFIG_FOOTER', 'Build time: $(date "+%Y-%m-%d %H:%m:%S"), $VERSION');" >> "$WWWDIR/slx-admin/config.php" +} |