]> piware.de Git - bin.git/commitdiff
backup: adjust for changed wlan name, ssh socket, and $DISPLAY
authorMartin Pitt <martin.pitt@ubuntu.com>
Thu, 8 Oct 2015 05:25:26 +0000 (07:25 +0200)
committerMartin Pitt <martin.pitt@ubuntu.com>
Thu, 8 Oct 2015 05:25:26 +0000 (07:25 +0200)
backup

diff --git a/backup b/backup
index 8d553c5cac6779e02f7e6f2df434c383be9a38b6..05fd6407af2231fc07385035055db170fe4b5cfe 100755 (executable)
--- a/backup
+++ b/backup
@@ -9,22 +9,16 @@ if [ -e "$LOG" ] && [ $(( `date +%s` - `stat -c %Y $LOG` )) -lt 86300 ]; then
 fi
 
 # figure out $DISPLAY when running from cron
-if [ -z "${DISPLAY:-}" ]; then
-    socket="/run/user/`id -u`/X11-display"
-    if [ -L "$socket" ]; then
-        socket=$(readlink "$socket")
-        export DISPLAY=:${socket##*/X}
-    fi
-fi
+export DISPLAY="${DISPLAY:-:0}"
 
-if ! ip route | grep -q '^default.*wlan'; then
+if ! ip route | grep -q '^default.*wl'; then
     notify-send "Backup skipped, not on WLAN"
     exit 0
 fi
 
 # figure out ssh agent when running from cron
 if [ -z "${SSH_AUTH_SOCK:-}" ]; then
-    ssh_socket=$(ls /run/user/`id -u`/keyring-*/ssh 2>/dev/null)
+    ssh_socket=$(ls /run/user/`id -u`/keyring*/ssh 2>/dev/null)
     if [ -S "$ssh_socket" ]; then
         export SSH_AUTH_SOCK="$ssh_socket"
     fi