aboutsummaryrefslogtreecommitdiff
path: root/X
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2022-04-27 23:02:49 +1200
committerTom Ryder <tom@sanctum.geek.nz>2022-04-27 23:06:34 +1200
commitded2454892dd1a1a3d7194e44825b1ee0bff064a (patch)
tree2adf5dfd3f972e9de2bb221c582cc9941b59c440 /X
parentSave checking Firefox/LibreWolf existence twice (diff)
downloaddotfiles-ded2454892dd1a1a3d7194e44825b1ee0bff064a.tar.gz
dotfiles-ded2454892dd1a1a3d7194e44825b1ee0bff064a.zip
Check for procfs file existence before usage
Diffstat (limited to 'X')
-rw-r--r--X/xsession.d/browser.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/X/xsession.d/browser.sh b/X/xsession.d/browser.sh
index dde8c784..319659a3 100644
--- a/X/xsession.d/browser.sh
+++ b/X/xsession.d/browser.sh
@@ -13,8 +13,10 @@ if (
command -v dillo || exit 1
# Do switch if BROWSER= isn't set yet
[ -n "$BROWSER" ] || exit 0
- # Do switch if procfs says we have less than 2GB of RAM
- awk '$1=="MemTotal:"&&$2<2^20{m++}END{exit!m}' < /proc/meminfo
+ # Do switch if we have procfs' meminfo resource, and it says we have less
+ # than 2GB of RAM; otherwise, conclude we won't switch
+ [ -e /proc/meminfo ] \
+ && awk '$1=="MemTotal:"&&$2<2^20{m++}END{exit!m}' < /proc/meminfo
) ; then
BROWSER=dillo
fi >/dev/null 2>&1