introduced distro version detection and automatic system dependent configuration loading

This commit is contained in:
levasseur
2021-09-29 17:29:39 +02:00
parent 148742008a
commit dc53b749f1
13 changed files with 155 additions and 10 deletions

View File

@@ -115,6 +115,45 @@ read_commandline()
export -f read_commandline
# ------------------------------------------------------------------------------
# Automatically load system specific configuration if file exist in the
# following order:
# 1) auto/arch.conf.sh
# 2) auto/distro.conf.sh
# 3) auto/distro-arch.conf.sh
# 4) auto/distro-version.conf.sh
# 5) auto/distro-codename.conf.sh (if sys_code defined)
# 6) auto/distro-version-arch.conf.sh
# 7) auto/distro-codename-arch.conf.sh (if sys_code defined)
load_autoconf()
{
local prefix="$MYPATH/conf/auto"
if [[ -e $prefix/$SYS_ARCH.conf.sh ]]; then
. $prefix/$SYS_ARCH.conf.sh
fi
if [[ -e $prefix/$SYS_DIST.conf.sh ]]; then
. $prefix/$SYS_DIST.conf.sh
fi
if [[ -e $prefix/$SYS_DIST-$SYS_ARCH.conf.sh ]]; then
. $prefix/$SYS_DIST-$SYS_ARCH.conf.sh
fi
if [[ -e $prefix/$SYS_DIST-$SYS_VER.conf.sh ]]; then
. $prefix/$SYS_DIST-$SYS_VER.conf.sh
fi
if [[ -n $SYS_CODE && -e $prefix/$SYS_DIST-$SYS_CODE.conf.sh ]]; then
. $prefix/$SYS_DIST-$SYS_CODE.conf.sh
fi
if [[ -e $prefix/$SYS_DIST-$SYS_VER-$SYS_ARCH.conf.sh ]]; then
. $prefix/$SYS_DIST-$SYS_VER-$SYS_ARCH.conf.sh
fi
if [[ -n $SYS_CODE && -e $prefix/$SYS_DIST-$SYS_CODE-$SYS_ARCH.conf.sh ]]; then
. $prefix/$SYS_DIST-$SYS_CODE-$SYS_ARCH.conf.sh
fi
}
export -f load_autoconf
# ------------------------------------------------------------------------------
# Load configuration with the following priorities:
# 1) Those given on command line, if any