cleanup main program initialization and add stdtime function to libs

This commit is contained in:
fatalerrors
2021-06-07 18:31:54 +02:00
parent 8bef5d7a6a
commit 754dfa1934
2 changed files with 12 additions and 6 deletions

View File

@@ -1,4 +1,11 @@
# Define normalised time display, filename friendly
stdtime()
{
date --rfc-3339=seconds | sed -e 's/ /-/' -e 's/://g'
}
export -f stdtime
# Backup original installation files
# (or any old files if runned several time on same file)
backupdist()
@@ -9,7 +16,7 @@ backupdist()
for file in $@; do
if [[ -e ${file} ]]; then
tmpstmp=$(date --rfc-3339=seconds | sed -e 's/ /-/' -e 's/://g')
tmpstmp=$(stdtime)
prnt I "Création d'une sauvegarde de ${file} du $tmpstmp..."
cp -av $file $file.dist.$tmpstmp
fi