60 lines
1.2 KiB
Bash
60 lines
1.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# Start linux matrix...
|
|
#
|
|
|
|
# Load default env variables from profiles(e.g. /etc/profile.d/weston.sh)
|
|
. /etc/profile
|
|
|
|
case "$1" in
|
|
start)
|
|
printf "Starting matrix: "
|
|
export LC_ALL='zh_CN.utf8'
|
|
|
|
# Uncomment to disable mirror mode
|
|
# unset WESTON_DRM_MIRROR
|
|
|
|
export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/var/run}
|
|
export QT_QPA_PLATFORM=${QT_QPA_PLATFORM:-wayland}
|
|
|
|
{
|
|
num=60
|
|
while [ $num -gt 0 ]; do
|
|
if [ -e ${XDG_RUNTIME_DIR}/wayland-0 ];then
|
|
echo "matrix-browser:weston service ready" >> /dev/console
|
|
if ( ps aux | grep lighttpd | grep -v grep );then
|
|
echo "matrix-browser:lighttpd service ready" >> /dev/console
|
|
while [ $num -gt 0 ]; do
|
|
if [ -z "$(ifconfig | grep "lo")" ];then
|
|
ifconfig lo 127.0.0.1 up
|
|
else
|
|
break
|
|
fi
|
|
sleep 1
|
|
let num--
|
|
done
|
|
echo "matrix-browser:localhost set" >> /dev/console
|
|
/usr/bin/matrix-browser -no-sandbox --disable-gpu 127.0.0.1 >> /dev/null &
|
|
break
|
|
else
|
|
break
|
|
fi
|
|
else
|
|
sleep 1
|
|
let num--
|
|
fi
|
|
done
|
|
|
|
}&
|
|
;;
|
|
stop)
|
|
killall matrix-browser
|
|
printf "stop finished"
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
exit 0
|