backupdist: added support for symbolic links

This commit is contained in:
levasseur
2021-10-04 12:00:31 +02:00
parent 08d9724f99
commit cc04f61e14

View File

@@ -30,7 +30,10 @@ backupdist()
for file in $@; do for file in $@; do
local tmstmp=$(stdtime) 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..." prnt I "Création d'une sauvegarde de ${file} du $tmstmp..."
cp -av $file ${file}.dist.${tmstmp} cp -av $file ${file}.dist.${tmstmp}
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
@@ -80,12 +83,12 @@ installfile()
fi fi
done 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 for i in $filelist; do
: :
done done
if [[ ! $i == /* ]]; then 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 die 13
fi fi
if [[ -d $(dirname $i) ]]; then if [[ -d $(dirname $i) ]]; then