From 46fc58210eafe7cb3020aec9b32eeb55388a7426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Zolt=C3=A1n?= Date: Thu, 6 Mar 2025 18:37:19 +0100 Subject: [PATCH] Added --noconf option to the rotate_folder script. --- .metadata | Bin 14515 -> 14515 bytes .templates/bin/rotate_folder | 10 ++++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.metadata b/.metadata index ff38257313ab7022405ede87773030b888115002..782f4981d0916888ae17a983ae5935956afdf6a2 100644 GIT binary patch delta 47 zcmdm7xVdmcGaHZR+7syvKw#y#nR9X?x9H@4W!1?BBD|Zgv6UOJ9NBy_eRH6B5+eYY CIuOeM delta 49 zcmdm7xVdmcGaHZVsuSr9K=3isM`Us$x9H@4W!1?BBD|Zgv6UMz^_Wg}t<8 diff --git a/.templates/bin/rotate_folder b/.templates/bin/rotate_folder index 3b72121..ef23546 100755 --- a/.templates/bin/rotate_folder +++ b/.templates/bin/rotate_folder @@ -55,6 +55,9 @@ # Author: Kovács Zoltán # Kovács Zoltán # License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html) +# 2025-03-06 v1.1 +# new: added the --noconf option which prevents reading and creating +# the configuration file. # 2023-06-18 v1.0 # new: forked from the "SMARTERP_skeleton" repository. # 2021.02.12 v0.3 @@ -77,6 +80,7 @@ RETAIN_MONTHS=${RETAIN_MONTHS-"12"} # Other initialisations (maybe overridden by configuration). # DOIT="" +NOCONF="" # Messages (maybe overriden by configuration). # @@ -106,6 +110,7 @@ do case ${option} in "-" ) if [ "$OPTARG" = "doit" ]; then DOIT="yes" + elif [ "$OPTARG" = "noconf" ]; then NOCONF="yes" else echo "$MSG_BADOPT --$OPTARG" >&2; exit 1 fi ;; @@ -135,9 +140,10 @@ BACKUP_FOLDER=${BACKUP_FOLDER%/} if [ -z "$BACKUP_FOLDER" -o ! -d "$BACKUP_FOLDER" -o ! -w "$BACKUP_FOLDER" ] then echo -e "$MSG_BADFOLDER $BACKUP_FOLDER" >&2; exit 1; fi -# Gets the configuration (if any). +# Applies the configuration (if it exists and if it doesn't need to be ignored). BACKUP_CONF="$BACKUP_FOLDER/.$("$BASENAME" "$0").conf" -if [ -r $BACKUP_CONF ]; then . "$BACKUP_CONF" +if [ "$NOCONF" = "yes" ]; then : +elif [ -r $BACKUP_CONF ]; then . "$BACKUP_CONF" else # Warns about failure. echo -e "$MSG_NOCONF $BACKUP_CONF"