diff options
-rwxr-xr-x | clone_stage4 | 33 | ||||
-rw-r--r-- | data/basic.nocopy | 23 |
2 files changed, 56 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." + diff --git a/data/basic.nocopy b/data/basic.nocopy new file mode 100644 index 00000000..ea8ce588 --- /dev/null +++ b/data/basic.nocopy @@ -0,0 +1,23 @@ +/var/run +/var/log +/dev +/proc +/sys +/boot +/export +/home/vmuser +/lost+found +/media +/mnt +/opt/openslx +/run +/tmp +/root +/usr/src +/lib/modules +*tm-scripts* +*~ +*.bak +*.tmp +*.pid + |