From c8e1ddf1aab5ea1a2d04e7534fbed8efc83b8e3e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 8 Oct 2015 07:25:26 +0200 Subject: [PATCH] backup: adjust for changed wlan name, ssh socket, and $DISPLAY --- backup | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/backup b/backup index 8d553c5..05fd640 100755 --- 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 -- 2.39.5