diff options
| author | Simon Rettberg | 2013-03-19 19:42:41 +0100 |
|---|---|---|
| committer | Simon Rettberg | 2013-03-19 19:42:41 +0100 |
| commit | 61b94929a4d429a8480dcc06487c52be15db5e1f (patch) | |
| tree | 871d76618b66216ec5adb6446907a7ea8bde8ebd /remote/setup_target | |
| parent | Tweak modules to work with openSUSE 12.1 (diff) | |
| parent | Enable /tmp on ID44 partition if available. (diff) | |
| download | tm-scripts-61b94929a4d429a8480dcc06487c52be15db5e1f.tar.gz tm-scripts-61b94929a4d429a8480dcc06487c52be15db5e1f.tar.xz tm-scripts-61b94929a4d429a8480dcc06487c52be15db5e1f.zip | |
Merge branch 'master' of ssh://openslx/openslx-ng/tm-scripts
Diffstat (limited to 'remote/setup_target')
| -rwxr-xr-x | remote/setup_target | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/remote/setup_target b/remote/setup_target index e3273f4d..e7370b1b 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -3,32 +3,44 @@ MODE_DIR="${ROOT_DIR}/remote" MODULES_DIR="${MODE_DIR}/modules" -# check for target directory -TARGET_DIR="${MODE_DIR}/targets/${TARGET}" -[ -d $TARGET_DIR ] || perror "Given target directory does not exist: $TARGET" -TARGET_BUILD_DIR="${MODE_DIR}/builds/${TARGET}" +KERNEL_DIR="${MODE_DIR}/builds/kernel" # Keep track of processed modules PROCESSED_MODULES="" initial_checks () { + # check for required tools for BIN in git locate depmod do local TEST=$(which ${BIN}) [ -z "$TEST" ] && pinfo "Installing $BIN..." && apt-get install $BIN done + } +copy_kernel() { + + local KERNEL_VER="vmlinuz-$(uname -r)" + [ -e "${KERNEL_DIR}/${KERNEL_VER}" ] && return + + local TOOL_STR="$TOOL_STR copy_kernel:" + + [ ! -d "${KERNEL_DIR}" ] && mkdir -p ${KERNEL_DIR} + + pinfo "New kernel found. Copying '${KERNEL_VER}' to '${KERNEL_DIR}'." + pinfo "You may want to update your systems firmware/modules to match the current kernel." + + cp "/boot/${KERNEL_VER}" "${KERNEL_DIR}" || perror "Cannot copy kernel from '/boot/${KERNEL_VER}' to '${KERNEL_DIR}'" + +} read_config () { - unset REQUIRED_BINARIES - unset REQUIRED_LIBRARIES - unset REQUIRED_DIRECTORIES - unset REQUIRED_FILES - unset REQUIRED_MODULES - unset REQUIRED_PACKAGES - unset REQUIRED_DEPENDENCIES + + # unset previous variables from other config files + for VARNAME in "${!REQUIRED_*}"; do + unset $VARNAME + done local MODULE_CONFIG="${MODULE_DIR}/${MODULE}.conf" @@ -136,14 +148,20 @@ copy_files_with_deps () { generate_target() { initial_checks + copy_kernel + + TARGET=$1 + TARGET_DIR="${MODE_DIR}/targets/${TARGET}" + TARGET_BUILD_DIR="${MODE_DIR}/builds/${TARGET}" + [ -d $TARGET_DIR ] || perror "Given target directory does not exist: $TARGET_DIR" [[ $TARGET == builds || $TARGET == modules ]] && \ perror "Target directory cannot be named 'builds' nor 'modules'." - + pinfo "Generating '$TARGET_BUILD_DIR' for '$TARGET'" # if no arguments assume all. - if [ "x$1" = "x" -o "x$1" = "xall" ]; then + if [ "x$2" = "x" -o "x$2" = "xall" ]; then MODULES=$(ls ${TARGET_DIR}) set -- $MODULES else @@ -223,7 +241,13 @@ process_module() { } clean_modules() { - if [ "x$1" = "x" -o "x$1" = "xall" ]; then + + TARGET=$1 + TARGET_DIR="${MODE_DIR}/targets/${TARGET}" + TARGET_BUILD_DIR="${MODE_DIR}/builds/${TARGET}" + [ -d $TARGET_DIR ] || perror "Given target directory does not exist: $TARGET_DIR" + + if [ "x$2" = "x" -o "x$2" = "xall" ]; then if [ -d ${TARGET_BUILD_DIR} ]; then pinfo "Cleaning '${TARGET_BUILD_DIR}'" \ && rm -rf "${TARGET_BUILD_DIR}"/* \ |
