6fdd09f3b5f0f40e9aee7c50fa9a137b83303b24
[distro-setup] / laptop-btrbk
1 #!/bin/bash
2 # Copyright (C) 2019 Ian Kelling
3 # SPDX-License-Identifier: AGPL-3.0-or-later
4
5 if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
6 shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
7 set -eE -o pipefail
8 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?. PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR
9
10 locked=false
11 if lock_info=$(xscreensaver-command -time); then
12 if [[ $lock_info != *non-blanked* ]]; then
13 locked=true
14 fi
15 else
16 locked=true
17 fi
18
19 if ! $locked; then
20 btrbk run
21 fi