diff options
Diffstat (limited to 'firestart')
-rwxr-xr-x | firestart | 31 |
1 files changed, 26 insertions, 5 deletions
@@ -1,20 +1,41 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/bash |
2 | 2 | ||
3 | die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; } | 3 | die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; } |
4 | 4 | ||
5 | # Test DEVICE WRITE OPS BY WRITEOPS | ||
6 | test_write_ops() | ||
7 | { | ||
8 | if ! [ -e "$1" ] | ||
9 | then | ||
10 | mkdir -p "$(dirname "$1")" | ||
11 | sync | ||
12 | begin=$(date +%s.%N) | ||
13 | dd if=/dev/urandom of="$DIR"/urandom.out bs=1M count=300 | ||
14 | sync | ||
15 | end=$(date +%s.%N) | ||
16 | rm "$DIR"/urandom.out | ||
17 | bc -q > "$1" <<< "scale=5; seconds=$end - $begin; 300*1000*1000/seconds" | ||
18 | fi | ||
19 | cat "$1" | ||
20 | } | ||
21 | |||
5 | CMD=firefox | 22 | CMD=firefox |
6 | UNIT=$CMD | 23 | UNIT=$CMD |
7 | DIR=~/.mozilla | 24 | DIR=~/.mozilla |
8 | MEMORY_MAX=50% | 25 | MEMORY_MAX=50% |
9 | READ_OPS=1G | 26 | READ_OPS=1G |
10 | WRITE_OPS=$READ_OPS | 27 | WRITE_OPS=$READ_OPS |
11 | CONFDIR=$HOME/.config/firestart/conf | 28 | CONFDIR=$HOME/.config/firestart |
12 | 29 | ||
13 | if [ -e "$CONFDIR" ] | 30 | if [ -e "$CONFDIR"/conf ] |
14 | then | 31 | then |
15 | . "$CONFDIR" | 32 | . "$CONFDIR"/conf |
16 | fi | 33 | fi |
17 | 34 | ||
35 | WRITE_OPS=$(test_write_ops "$CONFDIR"/diskspeed.dat) | ||
36 | WRITE_OPS=${WRITE_OPS%.*} | ||
37 | READ_OPS=$WRITE_OPS | ||
38 | |||
18 | if systemctl --user is-active "$UNIT" >/dev/null | 39 | if systemctl --user is-active "$UNIT" >/dev/null |
19 | then | 40 | then |
20 | exec "$CMD" "$@" # Asks existing firefox to open a new window. | 41 | exec "$CMD" "$@" # Asks existing firefox to open a new window. |
@@ -27,7 +48,7 @@ fi | |||
27 | DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n)) | 48 | DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n)) |
28 | [ "$DEV" ] || die "could not determine backing device for $DIR" | 49 | [ "$DEV" ] || die "could not determine backing device for $DIR" |
29 | 50 | ||
30 | ioslay-mgr.sh launch-unit | 51 | firefox-io-slayer launch-unit |
31 | 52 | ||
32 | systemctl --user reset-failed "$UNIT" 2>/dev/null | 53 | systemctl --user reset-failed "$UNIT" 2>/dev/null |
33 | systemd-run --user \ | 54 | systemd-run --user \ |