diff options
author | James Meyer <james.meyer@operamail.com> | 2008-11-07 03:13:12 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2008-11-07 03:13:12 (GMT) |
commit | 1b95a1dd7d6392f908a58e819daf232492556b23 (patch) | |
tree | e326cdfd4abfe1b340f7ae4745c2f9a8fa4e1c11 /abs/core-testing/live-installer | |
parent | 53ed8e22c9626d9dccf9676f0dfc95f6e7b9756c (diff) | |
download | linhes_pkgbuild-1b95a1dd7d6392f908a58e819daf232492556b23.zip linhes_pkgbuild-1b95a1dd7d6392f908a58e819daf232492556b23.tar.gz linhes_pkgbuild-1b95a1dd7d6392f908a58e819daf232492556b23.tar.bz2 |
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.
Diffstat (limited to 'abs/core-testing/live-installer')
-rwxr-xr-x | abs/core-testing/live-installer/restore_default_settings.sh | 68 |
1 files 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 |