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