summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian2014-01-30 10:40:11 +0100
committerSebastian2014-01-30 10:40:11 +0100
commit2e61e503974571153cd81e662abda5892b8b39e0 (patch)
tree0d94add73fa62d14ccc1bd52d3e395a349f27997
parentadd module for swiss keymaps/locals (diff)
downloadtm-scripts-2e61e503974571153cd81e662abda5892b8b39e0.tar.gz
tm-scripts-2e61e503974571153cd81e662abda5892b8b39e0.tar.xz
tm-scripts-2e61e503974571153cd81e662abda5892b8b39e0.zip
allow to change default export path; on remote via mltk -n name; on server via
export REMOTE_EXPORT_DIR=/export/name
-rwxr-xr-xmltk13
-rwxr-xr-xremote/setup_target3
-rw-r--r--server/blacklists/essential/linux-base2
-rwxr-xr-xserver/export_target9
4 files changed, 19 insertions, 8 deletions
diff --git a/mltk b/mltk
index 95b924d5..4810de06 100755
--- a/mltk
+++ b/mltk
@@ -65,14 +65,16 @@ print_usage() {
echo -e ""
echo -e "Toolkit for creating preboot mini-linux for OpenSLX NG (mltk)"
#echo -e "Usage: $(basename ${SELF}) <target> [-d] [-c [module]*] [-b [module]*] [-p profile]"
- echo -e "Usage: $ARG0 <target> [-d] [-c [module]*] [-b [module]*] [-n]"
+ echo -e "Usage: $ARG0 <target> [-d] [-c [module]*] [-b [module]*] [-n [name]]"
echo -e ""
echo -e " Options:"
echo -e " -d activates debug output for the task (spamy)"
echo -e " -b build module(s) and copy them to the target build directory"
echo -e " -c clean build directory of module(s) and target dir"
#echo -e " -p profile build all modules from given profile (DEPRECATED?)"
- echo -e " -n bind mount all the local builds (remote/builds) to /export/builds"
+ echo -e " -n bind mount all the local builds (remote/builds) to /export/builds;"
+ echo -e " the optional parameter name allows to change the default mount target"
+ echo -e " <name> -> /export/<name>"
echo -e ""
echo -e " You can pass names of specific modules to clean/build (-c / -b)."
echo -e " Otherwise, all modules will be cleaned/built."
@@ -218,7 +220,12 @@ read_params() {
continue
;;
-n)
- [ "x" != "x$1" ] && perror "'-n' accepts no parameters. Given: $1"
+ if [ -z "$1" ]; then
+ REMOTE_EXPORT_DIR=/export/build
+ else
+ REMOTE_EXPORT_DIR="/export/$1"
+ shift
+ fi
REMOTE_EXPORT="1"
continue
;;
diff --git a/remote/setup_target b/remote/setup_target
index 11a8ffbb..21831fde 100755
--- a/remote/setup_target
+++ b/remote/setup_target
@@ -54,6 +54,7 @@
MODE_DIR="${ROOT_DIR}/remote"
MODULES_DIR="${MODE_DIR}/modules"
EXPORT_DIR="/export/build"
+[ -z "$REMOTE_EXPORT_DIR" ] || EXPORT_DIR=$REMOTE_EXPORT_DIR
# Keep track of processed modules so we don't
# build a module multiple times when following dependencies
PROCESSED_MODULES=""
@@ -120,7 +121,7 @@ read_build () {
export_builds() {
[ ! -d "${MODE_DIR}/builds" ] && perror "No ${MODE_DIR}/builds, nothing to export."
- if mount|grep -q tm-scripts/remote/builds; then
+ if mount|grep -q ${MODE_DIR}/builds; then
pwarning "${MODE_DIR}/builds already exported! Ignoring..."
return 1;
fi
diff --git a/server/blacklists/essential/linux-base b/server/blacklists/essential/linux-base
index c8f7c343..85392873 100644
--- a/server/blacklists/essential/linux-base
+++ b/server/blacklists/essential/linux-base
@@ -39,7 +39,7 @@
- /sbin/halt
- /bin/sh
# This is where the bind-mount of mltk resides...
-- /export/build
+- /export/
- /etc/group-
- /etc/gshadow
- /etc/gshadow-
diff --git a/server/export_target b/server/export_target
index 6edcecdc..22b8b062 100755
--- a/server/export_target
+++ b/server/export_target
@@ -25,6 +25,9 @@ SERVER_BUILD_DIR="${MODE_DIR}/local_builds/${REMOTE_IP}"
# target directory
SERVER_CONFIGS_DIR="${MODE_DIR}/configs"
+# allow to specify a different remote export dir via ENV
+[ -z $REMOTE_EXPORT_DIR ] && REMOTE_EXPORT_DIR="/export/build"
+
# initial checks
initial_checks() {
@@ -46,16 +49,16 @@ copy_kernel() {
sync_remote() {
[[ "${#SERVER_BUILD_DIR}" -lt "10" ]] && perror "Safety check failed: SERVER_BUILD_DIR is less than 10 chars. ($SERVER_BUILD_DIR)"
- pinfo "Synching 'root@$REMOTE_IP:export/build' to '$SERVER_BUILD_DIR'. This might take a while..."
+ pinfo "Synching 'root@$REMOTE_IP:$REMOTE_EXPORT_DIR' to '$SERVER_BUILD_DIR'. This might take a while..."
#TODO setup link to remote build directory, later this directory will be rsynced or exported to this server...
mkdir -p "${SERVER_BUILD_DIR}" || perror "Could not create directory for local copy of remote system ($SERVER_BUILD_DIR)"
- rsync -a --numeric-ids --exclude '**/.mltk' --delete --delete-excluded -v -e "ssh -c arcfour -oStrictHostKeyChecking=no" "root@$REMOTE_IP:/export/build/*" "$SERVER_BUILD_DIR"
+ rsync -a --numeric-ids --exclude '**/.mltk' --delete --delete-excluded -v -e "ssh -c arcfour -oStrictHostKeyChecking=no" "root@$REMOTE_IP:$REMOTE_EXPORT_DIR/*" "$SERVER_BUILD_DIR"
local RET=$?
if [ $RET -eq 0 ]; then
pinfo "Syncing completed."
else
- perror "Syncing of 'root@$REMOTE_IP:/export/build' to '$SERVER_BUILD_DIR' failed with error code: $RET. (Is '/export/build' available on target machine? If not run './mltk -n' on remote machine to export the build directory.)"
+ perror "Syncing of 'root@$REMOTE_IP:$REMOTE_EXPORT_DIR' to '$SERVER_BUILD_DIR' failed with error code: $RET. (Is '$REMOTE_EXPORT_DIR' available on target machine? If not run './mltk -n' on remote machine to export the build directory.)"
fi
}