summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-11-21 16:10:05 -0500
committerAndrew Cady <d@jerkface.net>2022-11-21 16:10:05 -0500
commit2c16f9e780f67aa471489002e97264d2bafea278 (patch)
tree7bcd5c647333fb611e0c5b179c3702374ab778c6
parent2418a213c1cc099e9b2b00fe73ece6d7f606d3e7 (diff)
firestart: improve error reporting
-rwxr-xr-xfirestart13
1 files changed, 9 insertions, 4 deletions
diff --git a/firestart b/firestart
index d88ae52..da094c6 100755
--- a/firestart
+++ b/firestart
@@ -1,16 +1,18 @@
1#!/bin/sh 1#!/bin/sh
2 2
3die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; }
4
3CMD=firefox 5CMD=firefox
4UNIT=$CMD 6UNIT=$CMD
5DIR=~/.mozilla 7DIR=~/.mozilla
6MEMORY_MAX=50% 8MEMORY_MAX=50%
7READ_OPS=1G 9READ_OPS=1G
8WRITE_OPS=$READ_OPS 10WRITE_OPS=$READ_OPS
11CONFDIR=$HOME/.config/firestart/conf
9 12
10cfg=$HOME/.config/firestart/conf 13if [ -e "$CONFDIR" ]
11if [ -e "$cfg" ]
12then 14then
13 . "$cfg" 15 . "$CONFDIR"
14fi 16fi
15 17
16if systemctl --user is-active "$UNIT" >/dev/null 18if systemctl --user is-active "$UNIT" >/dev/null
@@ -19,8 +21,11 @@ then
19 exit 21 exit
20fi 22fi
21 23
24[ -e "$DIR" ] || die "does not exist: $DIR"
25[ -d "$DIR" ] || die "not a directory: $DIR"
26
22DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n)) 27DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n))
23[ "$DEV" ] || exit 28[ "$DEV" ] || die "could not determine backing device for $DIR"
24 29
25systemctl --user reset-failed "$UNIT" 2>/dev/null 30systemctl --user reset-failed "$UNIT" 2>/dev/null
26systemd-run --user \ 31systemd-run --user \