summaryrefslogtreecommitdiffstats
path: root/remote/setup_target
diff options
context:
space:
mode:
authorSimon Rettberg2013-07-29 13:43:34 +0200
committerSimon Rettberg2013-07-29 13:43:34 +0200
commit995be0d52ec3b4f75e9ac9f7a264c46ff02beeb4 (patch)
treeb2e9a27b6e75a138577098597212747a3707843a /remote/setup_target
parent[demo-server] Added hash check (md5) for downloaded files (not for unused (diff)
downloadtm-scripts-995be0d52ec3b4f75e9ac9f7a264c46ff02beeb4.tar.gz
tm-scripts-995be0d52ec3b4f75e9ac9f7a264c46ff02beeb4.tar.xz
tm-scripts-995be0d52ec3b4f75e9ac9f7a264c46ff02beeb4.zip
<BREAKING> Start to implement distribution specific module configs instead of
just packet-manager specific. This requires adapting the configs of all modules (but not their build scripts)
Diffstat (limited to 'remote/setup_target')
-rwxr-xr-xremote/setup_target50
1 files changed, 45 insertions, 5 deletions
diff --git a/remote/setup_target b/remote/setup_target
index 378606b0..2115d18e 100755
--- a/remote/setup_target
+++ b/remote/setup_target
@@ -58,7 +58,37 @@ EXPORT_DIR="/export/build"
PROCESSED_MODULES=""
initial_checks () {
- :
+ # Set up distribution and package management
+ # Lowercase distributor ID is what we use as the general distribution name
+ SYS_DISTRIBUTION=$(lsb_release -is | tolower | sed -r 's/[^a-z0-9]//g;s/project$//g;s/scientificsl$/scientific/g')
+ # Then determine packet manager
+ case "$SYS_DISTRIBUTION" in
+ ubuntu|debian)
+ PACKET_MANAGER="apt"
+ ;;
+ opensuse)
+ PACKET_MANAGER="zypper"
+ ;;
+ scientific)
+ PACKET_MANAGER="yum"
+ ;;
+ *)
+ perror "Unknown Distribution: $SYS_DISTRIBUTION - Please specify its packet manager in remote/setup_target"
+ ;;
+ esac
+ # Get version - we mangle this quite a bit. first make sure it has no spaces, then split version at period (.), underscore (_) and dash (-)
+ local VERSION=$(lsb_release -rs | tolower | sed -r 's/\s//g;s/[\._]/ /g;s/-//g')
+ local STRTMP=""
+ PRINT_SYS_VERSIONS="*.conf.$SYS_DISTRIBUTION"
+ SYS_VERSIONS="$SYS_DISTRIBUTION"
+ for PART in $VERSION; do
+ [ -z "$PART" ] && continue
+ STRTMP+=".$PART"
+ SYS_VERSIONS="${SYS_DISTRIBUTION}${STRTMP} $SYS_VERSIONS"
+ PRINT_SYS_VERSIONS="*.conf.${SYS_DISTRIBUTION}${STRTMP} $PRINT_SYS_VERSIONS"
+ done
+ pinfo "Config source order: *.conf first, then the first one of these (if found)"
+ pinfo "$PRINT_SYS_VERSIONS"
}
#
@@ -76,10 +106,20 @@ read_config () {
[ ! -e "${MODULE_CONFIG}" ] && perror "Config for '$MODULE' not found."
# source the config file
. "${MODULE_CONFIG}" || perror "Sourcing '${MODULE_CONFIG}' failed."
- if [ -e "${MODULE_CONFIG}.${PACKET_MANAGER}" ]; then
- # a specific tool.conf seems to exist, use it to override certain vars
- . "${MODULE_CONFIG}.${PACKET_MANAGER}" || perror "Sourcing '${MODULE_CONFIG}.${PACKET_MANAGER}' failed."
- fi
+ # sanity checks - no distribution specific things in the global config
+ local CHECK
+ for CHECK in REQUIRED_CONTENT_PACKAGES REQUIRED_INSTALLED_PACKAGES; do
+ [ -n "${!CHECK}" ] && perror "$CHECK is set in ${MODULE}.conf, but distribution specific config has to go to one of these files:\n$PRINT_SYS_VERSIONS"
+ done
+ local FILE
+ for FILE in $SYS_VERSIONS; do
+ if [ -e "${MODULE_CONFIG}.${FILE}" ]; then
+ # a specific tool.conf seems to exist, use it to override/extend certain vars
+ . "${MODULE_CONFIG}.${FILE}" || perror "Sourcing '${MODULE_CONFIG}.${PACKET_MANAGER}' failed."
+ pinfo "Sourced distribution specific ${MODULE_CONFIG}.${FILE}"
+ break
+ fi
+ done
}
#