From cc04f61e145eae22808694e4c99887262109e7e2 Mon Sep 17 00:00:00 2001 From: levasseur Date: Mon, 4 Oct 2021 12:00:31 +0200 Subject: [PATCH] backupdist: added support for symbolic links --- lib/filefct.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/filefct.sh b/lib/filefct.sh index 3df9b70..effefb8 100644 --- a/lib/filefct.sh +++ b/lib/filefct.sh @@ -30,7 +30,10 @@ backupdist() for file in $@; do local tmstmp=$(stdtime) - if [[ -f ${file} ]]; then + if [[ - L ${file} ]]; then + # With symbolik links we call again backupdist to treat target + backupdist $(readlink -f ${file}) + elif [[ -f ${file} ]]; then prnt I "Création d'une sauvegarde de ${file} du $tmstmp..." cp -av $file ${file}.dist.${tmstmp} if [[ $? -ne 0 ]]; then @@ -80,12 +83,12 @@ installfile() fi done - # Empty for just to obtain the target which is the last element of the list + # Empty to just obtain the target which is the last element of the list for i in $filelist; do : done if [[ ! $i == /* ]]; then - prnt E "installfile(): Target must be on the root filesystem and fuul path must be provided." + prnt E "installfile(): Target must be on the root filesystem and full path must be provided." die 13 fi if [[ -d $(dirname $i) ]]; then