on 6d80eaa help sign in
unity8/run.sh
92 lines 2.9 kB history raw
1#!/bin/sh
3. /etc/environment
4export QML2_IMPORT_PATH
6QML_PHONE_SHELL_PATH=./builddir/src/unity8
7GDB=false
8FAKE=false
9PINLOCK=false
10KEYLOCK=false
11USE_MOCKS=false
12MOUSE_TOUCH=true
14usage() {
15 echo "usage: "$0" [OPTIONS]\n" >&2
16 echo "Script to run the shell.\n" >&2
17 echo "OPTIONS:" >&2
18 echo " -f, --fake Force use of fake Qml modules." >&2
19 echo " -p, --pinlock Use a pin protected user." >&2
20 echo " -k, --keylock Use a passphrase protected user." >&2
21 echo " -g, --gdb Run through gdb." >&2
22 echo " -h, --help Show this help." >&2
23 echo " -m, --nomousetouch Run without -mousetouch argument." >&2
24 echo >&2
25 exit 1
28ARGS=`getopt -n$0 -u -a --longoptions="fake,pinlock,keylock,gdb,help,nomousetouch" -o "fpkghm" -- "$@"`
29[ $? -ne 0 ] && usage
30eval set -- "$ARGS"
32while [ $# -gt 0 ]
33do
34 case "$1" in
35 -f|--fake) FAKE=true; USE_MOCKS=true;;
36 -p|--pinlock) PINLOCK=true; USE_MOCKS=true;;
37 -k|--keylock) KEYLOCK=true; USE_MOCKS=true;;
38 -g|--gdb) GDB=true;;
39 -h|--help) usage;;
40 -m|--nomousetouch) MOUSE_TOUCH=false;;
41 --) shift;break;;
42 esac
43 shift
44done
46if $FAKE; then
47 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single
48fi
50if $PINLOCK; then
51 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-pin
52fi
54if $KEYLOCK; then
55 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-passphrase
56fi
58if $USE_MOCKS; then
59 rm -f $PWD/builddir/nonmirplugins/LightDM # undo symlink (from below) for cleanliness
60 export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
61else
62 # Still fake no-login user for convenience (it's annoying to be prompted for your password when testing)
63 # And in particular, just link our LightDM mock into the nonmirplugins folder. We don't want the rest of
64 # our plugins to be used.
65 ln -s $PWD/builddir/tests/mocks/LightDM $PWD/builddir/nonmirplugins/
66 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/LightDM/single
67fi
69QML_PHONE_SHELL_ARGS=""
70if $MOUSE_TOUCH; then
71 QML_PHONE_SHELL_ARGS="$QML_PHONE_SHELL_ARGS -mousetouch"
72fi
74control_c()
76 /sbin/initctl stop unity8
77 exit $?
80trap control_c INT
82if $GDB; then
83 gdb -ex run --args $QML_PHONE_SHELL_PATH $QML_PHONE_SHELL_ARGS $@
84else
85 status=`/sbin/initctl status unity8`
86 if [ "$status" != "unity8 stop/waiting" ]; then
87 echo "Unity8 is already running, please stop it first"
88 exit 1
89 fi
90 /sbin/initctl start unity8 BINARY="`readlink -f $QML_PHONE_SHELL_PATH` $QML_PHONE_SHELL_ARGS $@" QML2_IMPORT_PATH=$QML2_IMPORT_PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH
91 tailf -n 0 ~/.cache/upstart/unity8.log
92fi