summaryrefslogtreecommitdiff
path: root/firestart
diff options
context:
space:
mode:
Diffstat (limited to 'firestart')
-rwxr-xr-xfirestart31
1 files changed, 26 insertions, 5 deletions
diff --git a/firestart b/firestart
index 5f388b5..f9f3bf0 100755
--- a/firestart
+++ b/firestart
@@ -1,20 +1,41 @@
1#!/bin/sh 1#!/bin/bash
2 2
3die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; } 3die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; }
4 4
5# Test DEVICE WRITE OPS BY WRITEOPS
6test_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
5CMD=firefox 22CMD=firefox
6UNIT=$CMD 23UNIT=$CMD
7DIR=~/.mozilla 24DIR=~/.mozilla
8MEMORY_MAX=50% 25MEMORY_MAX=50%
9READ_OPS=1G 26READ_OPS=1G
10WRITE_OPS=$READ_OPS 27WRITE_OPS=$READ_OPS
11CONFDIR=$HOME/.config/firestart/conf 28CONFDIR=$HOME/.config/firestart
12 29
13if [ -e "$CONFDIR" ] 30if [ -e "$CONFDIR"/conf ]
14then 31then
15 . "$CONFDIR" 32 . "$CONFDIR"/conf
16fi 33fi
17 34
35WRITE_OPS=$(test_write_ops "$CONFDIR"/diskspeed.dat)
36WRITE_OPS=${WRITE_OPS%.*}
37READ_OPS=$WRITE_OPS
38
18if systemctl --user is-active "$UNIT" >/dev/null 39if systemctl --user is-active "$UNIT" >/dev/null
19then 40then
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
27DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n)) 48DEV=$(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
30ioslay-mgr.sh launch-unit 51firefox-io-slayer launch-unit
31 52
32systemctl --user reset-failed "$UNIT" 2>/dev/null 53systemctl --user reset-failed "$UNIT" 2>/dev/null
33systemd-run --user \ 54systemd-run --user \