summaryrefslogblamecommitdiffstats
path: root/satellit_installer/includes/90-setup_slxadmin.inc
blob: 0220bdc2b8f72b139a715ff09fbda59388fc69f8 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                                 
                            



                                                                                                                                

                                                                                                                      

                        

 


                                                             
                                
                                                                                                                                                       




                                                                                          
                                                       
                                                                                                         
                                                           


                                                          


                                                                                                                               
# Prepare files and symlinks in slx-admin www dir
enable_slxadmin_modules () {
	# Create modules directory and link modules from modules-available according to slxadmin module list (SLXADMIN_MODULES):
	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" || perror "Could not activate module '$MOD' (alias '$NAME')"
	done
	cd - 1>/dev/null
}

# This needs to be called after mysql users have been created
install_slxadmin_db () {
	# Prepare temporary config
	install_files "slxadmin"
	sed -i "s/%MYSQL_OPENSLX_PASS%/${TEMP_DB_PASS}/" "$WWWDIR/slx-admin/config.php" || perror "Could not write temporary DB password to 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 database with data we need (run as root)
	/opt/openslx/restore.d/slxadmin-init/init.sh || perror "Filling tables with required data failed"
	# Reset with original template for firstboot script
	install_files "slxadmin"
	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"
}