6
by Thomas Moenicke
sync with latest trunk phablet maliit-plugins |
1 |
#!/bin/sh
|
2 |
CODE_DIR=ubuntu-keyboard |
|
3 |
USER=phablet |
|
4 |
USER_ID=32011 |
|
5 |
PASSWORD=phablet |
|
6 |
PACKAGE=ubuntu-keyboard |
|
7 |
BINARY=maliit-server |
|
8 |
TARGET_IP=127.0.0.1 |
|
9 |
TARGET_SSH_PORT=2222 |
|
10 |
TARGET_DEBUG_PORT=3768 |
|
11 |
RUN_OPTIONS="" |
|
12 |
# -qmljsdebugger=port:$TARGET_DEBUG_PORT"
|
|
13 |
SETUP=false |
|
14 |
SUDO="echo $PASSWORD | sudo -S" |
|
15 |
||
16 |
usage() { |
|
17 |
echo "usage: run_on_device [OPTIONS]\n" |
|
18 |
echo "Script to setup a build environment for the shell and sync build and run it on the device\n" |
|
19 |
echo "OPTIONS:" |
|
20 |
echo " -s, --setup Setup the build environment" |
|
21 |
echo "" |
|
22 |
echo "IMPORTANT:" |
|
23 |
echo " * Make sure to have the networking and PPAs setup on the device beforehand (phablet-deploy-networking && phablet-ppa-fetch)." |
|
24 |
echo " * Execute that script from a directory containing a branch of the shell code." |
|
25 |
exit 1 |
|
26 |
}
|
|
27 |
||
28 |
exec_with_ssh() { |
|
29 |
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -t $USER@$TARGET_IP -p $TARGET_SSH_PORT "bash -ic \"$@\"" |
|
30 |
}
|
|
31 |
||
32 |
adb_root() { |
|
33 |
adb root |
|
34 |
adb wait-for-device |
|
35 |
}
|
|
36 |
||
37 |
install_ssh_key() { |
|
38 |
ssh-keygen -R $TARGET_IP
|
|
67.1.4
by Thomas Moenicke
adjusting anchorItem relative to screen instead of row |
39 |
HOME_DIR=/home/phablet |
6
by Thomas Moenicke
sync with latest trunk phablet maliit-plugins |
40 |
adb push ~/.ssh/id_rsa.pub $HOME_DIR/.ssh/authorized_keys
|
41 |
adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh |
|
42 |
adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh/authorized_keys |
|
43 |
adb shell chmod 700 $HOME_DIR/.ssh |
|
44 |
adb shell chmod 600 $HOME_DIR/.ssh/authorized_keys |
|
36.2.1
by Thomas Moenicke
added chinese keyboard loading code |
45 |
adb shell rm /etc/init/ssh.override |
6
by Thomas Moenicke
sync with latest trunk phablet maliit-plugins |
46 |
}
|
47 |
||
48 |
install_dependencies() { |
|
106.1.3
by Guenter Schwann
* remove Hunspell object if not used |
49 |
adb shell apt-get -y install openssh-server |
42.1.1
by Guenter Schwann
Use GSettings for the settings instead of the maliit ones |
50 |
adb shell start ssh |
42.1.2
by Guenter Schwann
Fix sleep in buildscript |
51 |
sleep 2
|
110.1.1
by Guenter Schwann
Make spell check usable without predictive text |
52 |
exec_with_ssh $SUDO apt-get update
|
115.1.51
by Thomas Moenicke
adding dev package for additional plugins |
53 |
exec_with_ssh $SUDO apt-get -y install build-essential rsync bzr ccache gdb libglib2.0-bin unzip fakeroot
|
94.2.1
by Guenter Schwann
Split up C++ and QML a bit better |
54 |
# exec_with_ssh $SUDO add-apt-repository -s -y ppa:phablet-team/ppa
|
94.3.15
by Thomas Moenicke
considering wordribbon size for canvas size |
55 |
exec_with_ssh $SUDO apt-get update
|
6
by Thomas Moenicke
sync with latest trunk phablet maliit-plugins |
56 |
exec_with_ssh $SUDO apt-get -y build-dep $PACKAGE |
115.1.26
by Thomas Moenicke
adding debian packages for language packs |
57 |
exec_with_ssh $SUDO apt-get -y install presage libpinyin-dev
|
6
by Thomas Moenicke
sync with latest trunk phablet maliit-plugins |
58 |
}
|
59 |
||
60 |
setup_adb_forwarding() { |
|
61 |
adb forward tcp:$TARGET_SSH_PORT tcp:22
|
|
62 |
adb forward tcp:$TARGET_DEBUG_PORT tcp:$TARGET_DEBUG_PORT |
|
63 |
}
|
|
64 |
||
65 |
sync_code() { |
|
66 |
bzr export --uncommitted --format=dir /tmp/$CODE_DIR |
|
67 |
rsync -crlOzv -e "ssh -p $TARGET_SSH_PORT -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" /tmp/$CODE_DIR/ $USER@$TARGET_IP:$CODE_DIR/ |
|
68 |
rm -rf /tmp/$CODE_DIR
|
|
69 |
}
|
|
70 |
||
71 |
build() { |
|
73.1.1
by Guenter Schwann
Fix for auto caps to work more than once |
72 |
# same options as in debian/rules
|
115.1.12
by Thomas Moenicke
fixed LanguageFeatures in unittests |
73 |
QMAKE_OPTIONS="-recursive MALIIT_DEFAULT_PROFILE=ubuntu CONFIG+=\\\"debug nodoc enable-presage enable-hunspell enable-pinyin\\\"" |
73.1.1
by Guenter Schwann
Fix for auto caps to work more than once |
74 |
exec_with_ssh "cd $CODE_DIR/ && qmake $QMAKE_OPTIONS && make -j 4" |
10.2.24
by Thomas Moenicke
implemented extended keys using popover component from Ubuntu Components |
75 |
echo "Installing" |
73.1.1
by Guenter Schwann
Fix for auto caps to work more than once |
76 |
adb shell pkill "maliit-server"
|
10.2.24
by Thomas Moenicke
implemented extended keys using popover component from Ubuntu Components |
77 |
exec_with_ssh "cd $CODE_DIR/ && " $SUDO " make install" |
6
by Thomas Moenicke
sync with latest trunk phablet maliit-plugins |
78 |
}
|
79 |
||
80 |
run() { |
|
81 |
exec_with_ssh $SUDO "/sbin/initctl stop maliit-server" |
|
10.2.24
by Thomas Moenicke
implemented extended keys using popover component from Ubuntu Components |
82 |
adb shell pkill $BINARY
|
83 |
adb shell pkill "webbrowser-app"
|
|
84 |
adb shell pkill "qmlscene"
|
|
85 |
||
10.3.1
by Thomas Moenicke
changing ubuntu-keyboard to fullscreen. Input trap is still calculated. |
86 |
# exec_with_ssh "$BINARY $RUN_OPTIONS"
|
6
by Thomas Moenicke
sync with latest trunk phablet maliit-plugins |
87 |
}
|
88 |
||
89 |
set -- `getopt -n$0 -u -a --longoptions="setup,help" "sh" "$@"` |
|
90 |
||
91 |
# FIXME: giving incorrect arguments does not call usage and exit
|
|
92 |
while [ $# -gt 0 ] |
|
93 |
do
|
|
94 |
case "$1" in |
|
95 |
-s|--setup) SETUP=true;; |
|
96 |
-h|--help) usage;; |
|
97 |
--) shift;break;; |
|
98 |
esac
|
|
99 |
shift
|
|
100 |
done
|
|
101 |
||
102 |
adb_root |
|
103 |
setup_adb_forwarding |
|
104 |
||
105 |
if $SETUP; then |
|
106 |
echo "Setting up environment for building shell.." |
|
107 |
install_ssh_key |
|
108 |
install_dependencies |
|
109 |
sync_code |
|
110 |
else
|
|
111 |
echo "Transferring code.." |
|
112 |
sync_code |
|
113 |
echo "Building.." |
|
114 |
build |
|
121.1.9
by Bill Filler
correctly load active-language on startup by refactoring and changing order as qml was getting loaded before activeLanguage set internally. Added debug |
115 |
# echo "Running.."
|
116 |
# run
|
|
6
by Thomas Moenicke
sync with latest trunk phablet maliit-plugins |
117 |
fi
|