summarylogtreecommitdiffstats
path: root/mercury-browser.sh
blob: ea7e7f01220cf68f2e6b19410b688afe5abd9029 (plain)
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
#!/usr/bin/env bash

# check microprocessor architecture level
if /usr/lib/ld-linux-x86-64.so.2 --help | grep -qsE '^\s+x86-64-v3.*supported.*$' ; then
  _message=''
  _message+=$'The fastest Firefox fork on Earth.'
elif grep -qE '\bpni\b' /proc/cpuinfo ; then
  _message=''
  _message+=$'Your processor does not support x86-64-v3.\n'
  _message+=$'You may want to use mercury-browser-sse3-bin.'
else
  _message=''
  _message+=$'Your processor does not support SSE3 instructions.\n'
  _message+=$'mercury-browser may not work on your computer.'
fi

# Allow users to override command-line options
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}
_FLAGFILE="$XDG_CONFIG_HOME/mercury-flags.conf"
if [[ -f "$_FLAGFILE" ]]; then
  _USER_FLAGS=$(cat "$_FLAGFILE")
fi

# display processor support message
if tty -s ; then
  echo "$_message"
else
  [ ! -e "$HOME/.mercury" ] && notify-send -a "mercury-browser" -t 7500 "$_message"
fi

# Launch
exec /opt/mercury-browser/mercury $_USER_FLAGS "$@"