diff options
author | Jonathan Bauer | 2013-06-12 16:08:01 +0200 |
---|---|---|
committer | Jonathan Bauer | 2013-06-12 16:08:01 +0200 |
commit | 985d09a55a70e0bf290eb1109282fc822de15989 (patch) | |
tree | 52064bbd0f4d0bae1392638a92743106c1e25c4b /scripts/clone_stage4 | |
parent | [setup_target] started inline documentation... (diff) | |
download | tm-scripts-985d09a55a70e0bf290eb1109282fc822de15989.tar.gz tm-scripts-985d09a55a70e0bf290eb1109282fc822de15989.tar.xz tm-scripts-985d09a55a70e0bf290eb1109282fc822de15989.zip |
moved special setup scripts to scripts/
Diffstat (limited to 'scripts/clone_stage4')
-rwxr-xr-x | scripts/clone_stage4 | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/clone_stage4 b/scripts/clone_stage4 new file mode 100755 index 00000000..f692c9e4 --- /dev/null +++ b/scripts/clone_stage4 @@ -0,0 +1,33 @@ +#!/bin/bash + +. "helper/logging.inc" + +MLTK_PID="$$" + +qnd_exit() { + unset_quiet + kill "$MLTK_PID" + [ $# -ge 1 ] && kill "$1" +} + + +[ $# -lt 3 ] && perror "$0 <vorlage> <stage> <target_dir>" + +BASEDIR="./server/local_builds/$1" +BOOTDIR="./server/boot/$1" +[ ! -d "$BASEDIR" ] && perror "Unknown Vorlage '$1'" +BASEDIR="$BASEDIR/$2" +[ ! -d "$BASEDIR" ] && perror "Unknown Stage '$2' for Vorlage '$1'" +TARGETDIR="$3" +mkdir -p "$TARGETDIR" +mkdir -p "$BOOTDIR" +[ ! -z "$(ls "$TARGETDIR")" ] && perror "Target dir '$TARGETDIR' not empty" + +pinfo "Building rsync exclude-file for building stage 4...." +cp "data/basic.nocopy" "$BOOTDIR/exclude-stage4" +find "$BASEDIR" -type f | cut -c $[${#BASEDIR} + 1]- >> "$BOOTDIR/exclude-stage4" +pinfo "Done." + +pinfo "Cloning via rsync" +rsync -a --numeric-ids -v --exclude-from="$BOOTDIR/exclude-stage4" -e "ssh -oStrictHostKeyChecking=no" "root@$1:/" "$TARGETDIR" || perror "rsync from 'root@$1:/' to '$TARGETDIR' failed." + |