summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmltk22
-rwxr-xr-xremote/setup_target9
2 files changed, 23 insertions, 8 deletions
diff --git a/mltk b/mltk
index a42f46f0..b0243c8d 100755
--- a/mltk
+++ b/mltk
@@ -133,7 +133,7 @@ read_params() {
case "$1" in
server)
MODE="SERVER"
- [ "$#" -lt "2" ] && perror "Missing argument to -s (expecting remote host)"
+ [ "$#" -lt "2" ] && perror "Missing argument to server-mode flag 'server' (expecting remote host)"
REMOTE_IP="$2"
shift
;;
@@ -149,11 +149,11 @@ read_params() {
shift
# A target represents a set of modules to be build for a specific stage.
- # i.e. a very basic stage31 includes:
+ # i.e. a very basic stage31 target should includes:
# - busybox
# - kernel
# - rootfs-stage31
- # a basic stage32 would also contain these and additionally:
+ # a basic stage32 target could add:
# - systemd
# - dbus
# - pam
@@ -165,7 +165,7 @@ read_params() {
if [[ $1 != "-"* ]]; then
TARGET=$1
shift
- elif [[ $1 != "-s" ]]; then
+ elif [[ $1 != "-s" ]] && [[ $1 != "-n" ]]; then
perror "A target is required. None given."
fi
@@ -205,13 +205,20 @@ read_params() {
;;
-e)
[ "$#" -lt "1" ] && perror "Missing argument to -e"
- [ "$MODE" != "SERVER" ] && perror "-e can only be used in server mode"
[[ "stage31|stage32|addons" != *"$1"* ]] && perror "Wrong type specified. Muste be either 'stage31', 'stage32' or 'addons'"
SERVER_EXPORT="1"
SERVER_EXPORT_TYPE="$1"
shift
continue
;;
+ -n)
+ if [ "$MODE" == "REMOTE" ]; then
+ [ "x" != "x$1" ] && perror "'-n' accepts no parameters. Given: $1"
+ REMOTE_EXPORT="1"
+ fi
+ shift
+ continue
+ ;;
*)
pwarning "Unknown flag to target: $PARAM"
print_usage
@@ -230,15 +237,16 @@ read_params() {
# exit if no command
- [[ $SERVER_CLEAN == 0 && $SERVER_EXPORT == 0 && $REMOTE_CLEAN == 0 && $REMOTE_BUILD == 0 && $SERVER_SYNC == 0 ]] && print_usage && exit 1
+ [[ $SERVER_CLEAN == 0 && $SERVER_EXPORT == 0 && $REMOTE_CLEAN == 0 && $REMOTE_BUILD == 0 && $SERVER_SYNC == 0 && $REMOTE_EXPORT == 0 ]] && print_usage && exit 1
}
run() {
- if [[ $REMOTE_CLEAN == 1 || $REMOTE_BUILD == 1 ]]; then
+ if [[ $REMOTE_CLEAN == 1 || $REMOTE_BUILD == 1 || $REMOTE_EXPORT == 1 ]]; then
[[ $REMOTE_DEBUG == 1 ]] && unset_quiet || set_quiet
. "${REMOTE_SETUP_TARGET}" || perror "Cannot source ${REMOTE_SETUP_TARGET}"
[[ $REMOTE_CLEAN == 1 ]] && clean_modules $TARGET $REMOTE_LIST_CLEAN
[[ $REMOTE_BUILD == 1 ]] && generate_target $TARGET $REMOTE_LIST_BUILD
+ [[ $REMOTE_EXPORT == 1 ]] && export_builds
fi
if [[ $SERVER_CLEAN == 1 || $SERVER_EXPORT == 1 || $SERVER_SYNC == 1 ]]; then
[[ $SERVER_DEBUG == 1 ]] && unset_quiet || set_quiet
diff --git a/remote/setup_target b/remote/setup_target
index 54ed0cb0..d193638a 100755
--- a/remote/setup_target
+++ b/remote/setup_target
@@ -53,7 +53,7 @@
#
MODE_DIR="${ROOT_DIR}/remote"
MODULES_DIR="${MODE_DIR}/modules"
-
+EXPORT_DIR="/export/build"
# Keep track of processed modules
PROCESSED_MODULES=""
@@ -93,6 +93,13 @@ read_build () {
. "${BUILD_SCRIPT}" || perror "Sourcing '${BUILD_SCRIPT}' failed."
}
+export_builds() {
+ [ ! -d "${MODE_DIR}/builds" ] && perror "No ${MODE_DIR}/builds, nothing to export."
+ pinfo "Mounting ${MODE_DIR}/builds to ${EXPORT_DIR}. This will make the local builds syncable from another machine."
+ [ ! -d "${EXPORT_DIR}" ] && mkdir -p "${EXPORT_DIR}"
+ mount --bind ${MODE_DIR}/builds ${EXPORT_DIR} || perror "Failed to bind mount ${MODE_DIR}/builds to ${EXPORT_DIR}"
+}
+
#
# main function which copies all files, directories, binaries and external libraries to TARGET_BUILD_DIR
#