From 158c54a50f27bc9a8bab208c21cb1d6baf606e49 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 6 Jul 2016 14:27:40 +0200 Subject: [SSUS] Use static slx-admin config and reapply password --- satellit_upgrader/updater.template.sh | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'satellit_upgrader/updater.template.sh') diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh index d4c7e5f..debfdec 100644 --- a/satellit_upgrader/updater.template.sh +++ b/satellit_upgrader/updater.template.sh @@ -200,25 +200,17 @@ if [ -n "$TGZ_SLXADMIN" ]; then pwarning "slxadmin updater didn't finish with 'Done.'" fi ) - # Patch config with new features - # TODO: In the future it might be easier to parse the old config for the sql pass and just create a new one - if ! grep -q 'MENU_CAT_SORT_ORDER' "$PATH_SLXADMIN/config.php"; then - cat >>"$PATH_SLXADMIN/config.php" <<-"BLABLA" - // Menu sort order - $MENU_CAT_SORT_ORDER = array('main.content' => 0, 'main.settings-client' => 1, 'main.settings-server' => 2, 'main.status' => 3, 'main.users' => 4); - $MENU_SETTING_SORT_ORDER = array( - 'news' => 0, 'sysconfig' => 1, 'baseconfig' => 2, 'locations' => 3, 'exams' => 4, 'minilinux' => 5, // main.content - 'serversetup' => 0, 'internetaccess' => 1, 'vmstore' => 2, 'webinterface' => 3, 'backup' => 4, // main.settings - 'systemstatus' => 0, 'eventlog' => 1, 'syslog' => 2, 'statistics' => 3 // main.status - ); - BLABLA - fi - if ! grep -q 'CONFIG_DOZMOD_EXPIRE' "$PATH_SLXADMIN/config.php"; then - cat >>"$PATH_SLXADMIN/config.php" <<-"BLABLA" - /* for the dozmod API proxy cache */ - define('CONFIG_DOZMOD_EXPIRE', 60*60); // 1 Minute - BLABLA + # New config.php supplied + if [ -s "$FILEDIR/slxadmin-config.php" ]; then + # Patch config with new features using old mysql password + SQLPASS=$(grep -m1 '^define.*CONFIG_SQL_PASS.*;' "${PATH_SLXADMIN}/config.php" | awk -F "'" '{print $4}') + if [ -z "$SQLPASS" ]; then + pwarning "Could not extract old slx-admin mysql password - cannot update config :(" + else + sed "s/%MYSQL_OPENSLX_PASS%/${SQLPASS}/g" "$FILEDIR/slxadmin-config.php" > "${PATH_SLXADMIN}/config.php" + fi fi + fixperms "$PATH_SLXADMIN" root:root chmod 0640 "$PATH_SLXADMIN/config.php" chown root:www-data "$PATH_SLXADMIN/config.php" -- cgit v1.2.3-55-g7522