Initial import.
[yuu.git] / tools / nw-linux-wrapper
1 #!/bin/sh
2
3 # https://github.com/rogerwang/node-webkit/issues/136
4 # https://github.com/rogerwang/node-webkit/wiki/The-solution-of-lacking-libudev.so.0
5 #
6 # Though that page would be more accurately titled "apparently even
7 # Intel, Google, and every commercial distribution can't be bothered
8 # to maintain trivial compatibility on desktop Linux."
9
10 SELF=$(readlink -f "$0")
11 NWDIR=$(dirname "$SELF")/nw
12 NWBIN=$(command -v "$NWDIR/nw" nw | head -n 1)
13 NWFLAGS="--enable-webgl --ignore-gpu-blacklist"
14 PACKAGE="$NWDIR/package.nw"
15
16 if [ ! -x "$NWBIN" ]; then
17 echo "node-webkit (nw) executable could not be found." >&2
18 exit 127
19 fi
20
21 "$NWBIN" $NWFLAGS "$@" "$PACKAGE"
22 if [ "$?" = "127" -a -w "$NWBIN" ]; then
23 echo "Applying libudev.so.1 hack." >&2
24 sed -i 's/udev\.so\.0/udev.so.1/g' "$NWBIN"
25 "$NWBIN" $NWFLAGS "$@" "$PACKAGE"
26 fi