From 1b95a1dd7d6392f908a58e819daf232492556b23 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Thu, 6 Nov 2008 21:13:12 -0600 Subject: add option to use template hostsettings. This is almost identical to syssettings with the following exception. -only the settings table is loaded -the order of combining the database & settings file is swapped. This is needed to preserve the old settings from the database. --- .../live-installer/restore_default_settings.sh | 68 +++++++++++++++------- 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/abs/core-testing/live-installer/restore_default_settings.sh b/abs/core-testing/live-installer/restore_default_settings.sh index e2b7044..5690f48 100755 --- a/abs/core-testing/live-installer/restore_default_settings.sh +++ b/abs/core-testing/live-installer/restore_default_settings.sh @@ -67,7 +67,7 @@ if [ $# -eq 0 ] then echo "Valid options are:" echo " -c (save|restore|load|uhostname|BECONFIG|ZIP|ACCESSCONTROL)" - echo " -t (syssettings)" + echo " -t (syssettings|hostsettings)" echo " -d databasename" echo " -h hostname" echo " -s systemtype (master|slave|standalone|frontendonly)" @@ -94,11 +94,17 @@ do Thistemplate=$OPTARG if [ x$Thistemplate = x"syssettings" ] - then - echo "" - else - echo "invalid template name" - exit 1 + then + echo "template is syssettings" + loadhost=false + elif [ x$Thistemplate = x"hostsettings" ] + then + echo "template is hostsettings" + Thistemplate=syssettings + loadhost=true + else + echo "invalid template name" + exit 1 fi ;; d) echo "$SWITCH" "$OPTARG" @@ -165,22 +171,40 @@ case $OPERATION in #used to restore settings from syssettings if [ -d $TEMPLATES/$Thistemplate ] then - cd $TEMPLATES/$Thistemplate - for i in $TABLES - do - SQL_DEFINE $i - sed -e "s/REPLACEME/$hostname/g" $i.txt > /tmp/$i.txt - #echo $MYSQLCMD "$SELECTSQL" - echo $i - $MYSQLCMD "$CREATESQL" - $MYSQLCMD "$ALTERSQL" - $MYSQLCMD "$COPY_TMP_SQL" - $MYSQLCMD "$INSERTSQL" - $MYSQLCMD "$DROPSQL" - $MYSQLCMD "$COPY_BCK_SQL " - $MYSQLCMD "$DROP_TABLE " - #rm /tmp/$i.txt - done + cd $TEMPLATES/$Thistemplate + if [ $loadhost = false ] + then + for i in $TABLES + do + SQL_DEFINE $i + sed -e "s/REPLACEME/$hostname/g" $i.txt > /tmp/$i.txt + #echo $MYSQLCMD "$SELECTSQL" + echo $i + $MYSQLCMD "$CREATESQL" + $MYSQLCMD "$ALTERSQL" + $MYSQLCMD "$COPY_TMP_SQL" + $MYSQLCMD "$INSERTSQL" + $MYSQLCMD "$DROPSQL" + $MYSQLCMD "$COPY_BCK_SQL " + $MYSQLCMD "$DROP_TABLE " + #rm /tmp/$i.txt + done + fi + if [ $loadhost = true ] + then + #only load the settings table with values HOST + i=settings + SQL_DEFINE $i + sed -e "s/REPLACEME/$hostname/g" $i.txt > /tmp/$i.txt + echo $i + $MYSQLCMD "$CREATESQL" + $MYSQLCMD "$ALTERSQL" + $MYSQLCMD "$INSERTSQL" + $MYSQLCMD "$COPY_TMP_SQL" + $MYSQLCMD "$DROPSQL" + $MYSQLCMD "$COPY_BCK_SQL" + $MYSQLCMD "$DROP_TABLE " + fi else echo "couldn't find $TEMPLATES/$Thistemplate" fi -- cgit v0.12