aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/openbsd_firefox
blob: a34abcb81b8004bcca9210f84b1a5925f8710767 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

DATASIZE="10485760"
OPENFILES="400"

xm_log() {
        echo -n "$@\nDo you want to run Firefox anyway?\n\
(If you don't increase these limits, Firefox might fail to work properly.)" | \
                xmessage -file - -center -buttons yes:0,no:1 -default no
}


# A stack overflow post said you also have to increase virtmem but that
# doesn't seem to be the case. If tabs start crashing then try increasing
# virtmem.

#if [ $(ulimit -Sv) -lt ${DATASIZE} ]; then
#        ulimit -Sv ${DATASIZE} || \
#                xm_log "Cannot increase virtualmem-cur to at least ${DATASIZE}"
#                [ $? -eq 0 ] || exit
#fi

if [ $(ulimit -Sd) -lt ${DATASIZE} ]; then
        ulimit -Sd ${DATASIZE} || \
                xm_log "Cannot increase datasize-cur to at least ${DATASIZE}"
                [ $? -eq 0 ] || exit
fi

if [ $(ulimit -Sn) -lt ${OPENFILES} ]; then
        ulimit -Sn ${OPENFILES} || \
                xm_log "Cannot increase openfiles-cur to at least ${OPENFILES}"
                [ $? -eq 0 ] || exit
fi

exec /usr/local/bin/firefox "${@}"