From cd959f22456ae2c822b056367c29919edf9ee8bb Mon Sep 17 00:00:00 2001 From: sr Date: Tue, 7 May 2013 16:49:44 +0200 Subject: Add basic script to pull stage 4 data from remote machine --- clone_stage4 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 clone_stage4 (limited to 'clone_stage4') 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 " + +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." + -- cgit v1.2.3-55-g7522