c8d249da189a0b449ece2c5a280d3f8c047e9363

Author
Matt Dirba <matt@dirba.org>
Committer
Matt Dirba <matt@dirba.org>
Date

Message

removed perl dependancy

Diff

 1diff --git a/duplicity-backup.sh b/duplicity-backup.sh
 2index 58eb71340be951e537eeec0dc60ce16362ddde2e..4f067ed98ec233a88bef30f536a70e2c4df26b45 100644
 3--- a/duplicity-backup.sh
 4+++ b/duplicity-backup.sh
 5@@ -401,7 +401,7 @@ get_remote_file_size()
 6     "ss")
 7       TMPDEST="${DEST#*://*/}"
 8       TMPDEST="${DEST%/${TMPDEST}}"
 9-      ssh_opt=`echo $STATIC_OPTIONS |perl -ne 'print "-i $1" if (/IdentityFile="?([^"]*)/);'`
10+      ssh_opt=`echo $STATIC_OPTIONS |awk -vo="--ssh-options=" '{s=index($0,o); if (s) {s=substr($0,s+length(o)); m=substr(s,0,1); for (i=2; i < length(s); i++) { if (substr(s,i,1) == m && substr(s,i-1,1) != "\\") break; } print substr(s,2,i-2)}}'`
11 
12       SIZE=`${TMPDEST%://*} ${ssh_opt} ${TMPDEST#*//} du -hs ${DEST#${TMPDEST}/} | awk '{print $1}'` 2>> ${LOGFILE}
13       EMAIL_SUBJECT="$EMAIL_SUBJECT $SIZE `${TMPDEST%://*} ${ssh_opt} ${TMPDEST#*//} df -hP ${DEST#${TMPDEST}/} | awk '{tmp=$5 " used"}END{print tmp}'`" 2>> ${LOGFILE}