From b7f41c4ec70bb50d480bfb785d99ef824338b12d Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Mon, 19 Apr 2021 22:01:50 +0200 Subject: [PATCH] Add option to not remount target on backup --- seqs/backup.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/seqs/backup.sh b/seqs/backup.sh index f3e3c21..2394322 100755 --- a/seqs/backup.sh +++ b/seqs/backup.sh @@ -82,7 +82,9 @@ step_3_info() { } step_3_alias() { ALIAS="budir"; } step_3() { + local arg local configTarget=0 + local noRemount=0 local buSource= local buTarget= local buExcludes= @@ -90,10 +92,16 @@ step_3() { # don't use step number shift - if [ "$1" == "-t" ] ; then - configTarget=1 - shift - fi + for arg in "$@"; do + case "$1" in + -t) + configTarget=1 + shift;; + -n) + noRemount=1 + shift;; + esac + done if [ -z "$1" ] ; then echoerr " [E] Nothing found to backup $1" @@ -144,9 +152,11 @@ step_3() { tmpTarget="${buTarget}/" fi - # remount target to be writable - exep "mount -o rw,remount '${buTarget}' >>/dev/null 2>&1" - endReturn -o $? "Remount (${buTarget}) to be writable failed" + if [ $noRemount -eq 0 ]; then + # remount target to be writable + exep "mount -o rw,remount '${buTarget}' >>/dev/null 2>&1" + endReturn -o $? "Remount (${buTarget}) to be writable failed" + fi if [ ! -w "${buTarget}" ] ; then echoerr " [E] Backup target (${buTarget}) is not writable"