diff options
author | Simon Rettberg | 2016-07-06 14:27:40 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-07-06 14:27:40 +0200 |
commit | 158c54a50f27bc9a8bab208c21cb1d6baf606e49 (patch) | |
tree | d8111e025a4e3573b8856b6a3960b157b70ba6c4 /satellit_upgrader/updater.template.sh | |
parent | [SSPS] Ship slxadmin config.php; add lighty rules for new dozmod cache (diff) | |
download | setup-scripts-158c54a50f27bc9a8bab208c21cb1d6baf606e49.tar.gz setup-scripts-158c54a50f27bc9a8bab208c21cb1d6baf606e49.tar.xz setup-scripts-158c54a50f27bc9a8bab208c21cb1d6baf606e49.zip |
[SSUS] Use static slx-admin config and reapply password
Diffstat (limited to 'satellit_upgrader/updater.template.sh')
-rw-r--r-- | satellit_upgrader/updater.template.sh | 28 |
1 files changed, 10 insertions, 18 deletions
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" |