2389ee61db32dc07c37b65f6d5feaa494d5325f9

Author
zertrin <zertrin@gmail.com>
Committer
zertrin <zertrin@gmail.com>
Date

Message

Fix program version output when cwd is not the same as scriptdir

Diff

 1diff --git a/duplicity-backup.sh b/duplicity-backup.sh
 2index 3e529a72de678466f31d1e0c6934a33dae2be407..255283ce06c02d8cb6a26d3737c461490881a566 100755
 3--- a/duplicity-backup.sh
 4+++ b/duplicity-backup.sh
 5@@ -130,7 +130,8 @@ version_compare "${DUPLICITY_VERSION}" 0.7
 6 case $? in 2) LT07=1;; *) LT07=0;; esac
 7 
 8 # Read the version string from the file VERSION
 9-DBSH_VERSION=$(<VERSION)
10+DBSH_DIRPATH=$(dirname "$(readlink -f "$0")")
11+DBSH_VERSION=$(<"${DBSH_DIRPATH}/VERSION")
12 
13 version(){
14   echo "duplicity-backup.sh ${DBSH_VERSION}"
15@@ -900,9 +901,10 @@ check_variables
16 
17 echo -e "--------    START DUPLICITY-BACKUP SCRIPT for ${HOSTNAME}   --------\n" >&5
18 
19-echo -e "-------[ Program versions ]-------\n"
20-echo -e "duplicity-backup.sh ${DBSH_VERSION}\n"
21-echo -e "duplicity ${DUPLICITY_VERSION}\n"
22+echo -e "-------[ Program versions ]-------"
23+echo -e "duplicity-backup.sh ${DBSH_VERSION}"
24+echo -e "duplicity ${DUPLICITY_VERSION}"
25+echo -e "----------------------------------\n"
26 
27 get_lock
28