summaryrefslogtreecommitdiff
path: root/src/edit-firefox@
diff options
context:
space:
mode:
authorDebian Live user <user@debian-BULLSEYE-live-builder-AMD64>2023-04-28 22:09:09 -0400
committerDebian Live user <user@debian-BULLSEYE-live-builder-AMD64>2023-04-28 22:09:17 -0400
commitce8bd3eb52b72a9489e41939cc0b98c46454bb52 (patch)
tree5069e81cb51cd206e61e8ecb92a0d61bbd0e7ae7 /src/edit-firefox@
parentc04b7b520a03ee020fa658c502b185a5a9857301 (diff)
use "systemd edit" instead of generating a template
Diffstat (limited to 'src/edit-firefox@')
-rwxr-xr-xsrc/edit-firefox@49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/edit-firefox@ b/src/edit-firefox@
new file mode 100755
index 0000000..2fc99bd
--- /dev/null
+++ b/src/edit-firefox@
@@ -0,0 +1,49 @@
1#!/bin/bash
2
3TARGET=$1
4
5die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; }
6
7# Test DEVICE WRITE OPS BY WRITEOPS
8test_write_ops()
9{
10 if ! [ -e "$1" ]
11 then
12 mkdir -p "$(dirname "$1")"
13 sync
14 begin=$(date +%s%N)
15 dd if=/dev/urandom of="$DIR"/urandom.out bs=1M count=300
16 sync
17 end=$(date +%s%N)
18 ops=$(( (end - begin) / 1000000000 ))
19 rm "$DIR"/urandom.out
20 echo "$ops" > "$1"
21 fi
22 cat "$1"
23}
24
25DIR=~/.mozilla
26READ_OPS=1G
27WRITE_OPS=$READ_OPS
28CONFDIR=$HOME/.config/firestart
29
30if [ -e "$CONFDIR"/conf ]
31then
32 . "$CONFDIR"/conf
33fi
34
35WRITE_OPS=$(test_write_ops "$CONFDIR"/diskspeed.dat)
36WRITE_OPS=${WRITE_OPS%.*}
37READ_OPS=$WRITE_OPS
38
39[ -e "$DIR" ] || die "does not exist: $DIR"
40[ -d "$DIR" ] || die "not a directory: $DIR"
41
42DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n))
43[ "$DEV" ] || die "could not determine backing device for $DIR"
44
45cat > "$TARGET" <<END
46[Service]
47IOReadIOPSMax = $DEV $READ_OPS
48IOWriteIOPSMax = $DEV $WRITE_OPS
49END