diff options
| author | sr | 2013-05-07 16:49:44 +0200 |
|---|---|---|
| committer | sr | 2013-05-07 16:49:44 +0200 |
| commit | cd959f22456ae2c822b056367c29919edf9ee8bb (patch) | |
| tree | 8673b26d3afd0c0b1ad282beb8dda0834de917c9 /clone_stage4 | |
| parent | added '-openslx' suffix to kernel version to distinguish it from regular vers... (diff) | |
| download | tm-scripts-cd959f22456ae2c822b056367c29919edf9ee8bb.tar.gz tm-scripts-cd959f22456ae2c822b056367c29919edf9ee8bb.tar.xz tm-scripts-cd959f22456ae2c822b056367c29919edf9ee8bb.zip | |
Add basic script to pull stage 4 data from remote machine
Diffstat (limited to 'clone_stage4')
| -rwxr-xr-x | clone_stage4 | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clone_stage4 b/clone_stage4 new file mode 100755 index 00000000..f692c9e4 --- /dev/null +++ b/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." + |
