dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 0a434c2baf22c60192f9a9a2d544720e80a89383
parent b5f83933a5dd8a60b35841c3f1ddc4505fa2d5bc
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Mon, 23 Apr 2018 19:43:06 +0200

Added a disk cloning script

Diffstat:
A.bin/clonedisk | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.bin/clonedisk-ignore | 15+++++++++++++++
2 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/.bin/clonedisk b/.bin/clonedisk @@ -0,0 +1,55 @@ +#!/bin/bash + +# Disc backup/clone script +# Requires rsync 3 + +# Ask for the administrator password upfront +sudo -v + +if [ $# -ne 2 ]; then + echo "Usage: clonedisk [source] [destination]" + exit 1 +else + SRC=$1 + DST=$2 +fi + +EXCLUDE="clonedisk-ignore" + +PROG=$0 + +if [ ! -r "$SRC" ]; then + logger -t $PROG "Source $SRC not readable - Cannot start the sync process" + exit; +fi + +if [ ! -w "$DST" ]; then + logger -t $PROG "Destination $DST not writeable - Cannot start the sync process" + exit; +fi + +logger -t $PROG "Start rsync" + +sudo /usr/local/bin/rsync --acls \ + --archive \ + --delete \ + --delete-excluded \ + --exclude-from=$EXCLUDE \ + --hard-links \ + --one-file-system \ + --sparse \ + --verbose \ + --xattrs \ + "$SRC" "$DST" + +logger -t $PROG "End rsync" + +echo -n "Make the backup disk bootable? [Y/n]: " +read -nq shouldboot + +if [ $shouldboot == "y" ]; then + # Make the backup bootable + sudo bless -folder "$DST"/System/Library/CoreServices +fi + +exit 0 diff --git a/.bin/clonedisk-ignore b/.bin/clonedisk-ignore @@ -0,0 +1,15 @@ +.Spotlight-*/ +.Trashes +/afs/* +/automount/* +/cores/* +/dev/* +/Network/* +/private/tmp/* +/private/var/run/* +/private/var/spool/postfix/* +/private/var/vm/* +/Previous Systems.localized +/tmp/* +/Volumes/* +*/.Trash