diff --git a/inc/meta-config b/inc/meta-config index b6fe437802..6eb7a00f69 100644 --- a/inc/meta-config +++ b/inc/meta-config @@ -195,6 +195,25 @@ function merge_config_group { done } +function extract_localrc_section { + local configfile=$1 # top_dir/local.conf + local localrcfile=$2 # top_dir/localrc + local localautofile=$3 # top_dir/.localrc.auto + + if [[ -r $configfile ]]; then + LRC=$(get_meta_section_files $configfile local) + for lfile in $LRC; do + if [[ "$lfile" == "localrc" ]]; then + if [[ -r $localrcfile ]]; then + echo "localrc and local.conf:[[local]] both exist, using localrc" + else + echo "# Generated file, do not edit" >$localautofile + get_meta_section $configfile local $lfile >>$localautofile + fi + fi + done + fi +} # Restore xtrace $_XTRACE_INC_META diff --git a/stack.sh b/stack.sh index b5dc51c6ec..90481e09a6 100755 --- a/stack.sh +++ b/stack.sh @@ -149,19 +149,7 @@ GetDistro # Phase: local rm -f $TOP_DIR/.localrc.auto -if [[ -r $TOP_DIR/local.conf ]]; then - LRC=$(get_meta_section_files $TOP_DIR/local.conf local) - for lfile in $LRC; do - if [[ "$lfile" == "localrc" ]]; then - if [[ -r $TOP_DIR/localrc ]]; then - warn $LINENO "localrc and local.conf:[[local]] both exist, using localrc" - else - echo "# Generated file, do not edit" >$TOP_DIR/.localrc.auto - get_meta_section $TOP_DIR/local.conf local $lfile >>$TOP_DIR/.localrc.auto - fi - fi - done -fi +extract_localrc_section $TOP_DIR/local.conf $TOP_DIR/localrc $TOP_DIR/.localrc.auto # ``stack.sh`` is customizable by setting environment variables. Override a # default setting via export:: diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh index e24d9ed0b9..46ff0b6fda 100755 --- a/tools/xen/install_os_domU.sh +++ b/tools/xen/install_os_domU.sh @@ -12,13 +12,6 @@ set -o xtrace export LC_ALL=C -# Abort if localrc is not set -if [ ! -e ../../localrc ]; then - echo "You must have a localrc with ALL necessary passwords defined before proceeding." - echo "See the xen README for required passwords." - exit 1 -fi - # This directory THIS_DIR=$(cd $(dirname "$0") && pwd) @@ -31,6 +24,10 @@ THIS_DIR=$(cd $(dirname "$0") && pwd) # # Get Settings # +TOP_DIR=$(cd $THIS_DIR/../../ && pwd) +source $TOP_DIR/inc/meta-config +rm -f $TOP_DIR/.localrc.auto +extract_localrc_section $TOP_DIR/local.conf $TOP_DIR/localrc $TOP_DIR/.localrc.auto # Source params - override xenrc params in your localrc to suit your taste source $THIS_DIR/xenrc