=== modified file 'snapshot.lvm2' --- snapshot.lvm2 2013-10-25 18:35:49 +0000 +++ snapshot.lvm2 2013-10-25 18:33:33 +0000 @@ -16,20 +16,16 @@ if grep -qF "$S_DEV"; then # TODO match only on start of line umount $S_DEV || exit $? fi - lvremove -f "$S_DEV" || exit $? + lvremove -f "$S_DEV" fi if test -d "$SNAPSHOT"; then # make sure it's empty and unused - rmdir "$SNAPSHOT" || exit $? + rmdir "$SNAPSHOT" fi -echo $$ >"$LOCKFILE" || exit $? -mkdir -p "$SNAPSHOT" || exit $? -lvcreate -n "${SRC##*/}.snaprep" -L "${SNAPSHOT_SIZE:-10G}" -s "$SRC" || exit $? -die_lvremove() { - lvremove -f "$S_VOL" - exit $? -} -mount "$S_DEV" "$SNAPSHOT" || die_lvremove $? +echo $$ >"$LOCKFILE" +mkdir -p "$SNAPSHOT" +lvcreate -n "${SRC##*/}.snaprep" -L "${SNAPSHOT_SIZE:-10G}" -s "$SRC" +mount "$S_DEV" "$SNAPSHOT" "$@" RETCODE=$? umount "$SNAPSHOT"