8TARGET_IP=${TARGET_IP-127.0.0.1}
9TARGET_SSH_PORT=${TARGET_SSH_PORT-2222}
11RUN_OPTIONS=-qmljsdebugger=port:$TARGET_DEBUG_PORT
16SUDO="echo $PASSWORD | sudo -S"
17NUM_JOBS='$(( `grep -c ^processor /proc/cpuinfo` + 1 ))'
19CHROOT_PREFIX="/data/ubuntu"
22 echo "usage: run_on_device [OPTIONS]\n"
23 echo "Script to setup a build environment for the shell and sync build and run it on the device\n"
25 echo " -s, --setup Setup the build environment"
26 echo " -p, --pinlock Enable a PIN lock screen when running"
27 echo " -k, --keylock Enable a Keyboard lock screen when running"
30 echo " * Make sure to have the networking and PPAs setup on the device beforehand (phablet-deploy-networking && phablet-ppa-fetch)."
31 echo " * Execute that script from a directory containing a branch the shell code."
36 ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -t $USER@$TARGET_IP -p $TARGET_SSH_PORT sudo -u $USER -i bash -ic \"$@\"
43 adb shell chroot /data/ubuntu /usr/bin/env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin "$@"
53 ssh-keygen -R $TARGET_IP
54 HOME_DIR="${CHROOT_PREFIX}/home/phablet"
55 adb push ~/.ssh/id_rsa.pub $HOME_DIR/.ssh/authorized_keys
56 adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh
57 adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh/authorized_keys
58 adb shell chmod 700 $HOME_DIR/.ssh
59 adb shell chmod 600 $HOME_DIR/.ssh/authorized_keys
62setup_adb_forwarding() {
63 adb forward tcp:$TARGET_SSH_PORT tcp:22
64 adb forward tcp:$TARGET_DEBUG_PORT tcp:$TARGET_DEBUG_PORT
67install_dependencies() {
68 exec_with_adb apt-get update
69 exec_with_adb apt-get -y install openssh-server
70 exec_with_ssh $SUDO apt-get -y install build-essential rsync bzr ccache gdb ninja-build devscripts equivs
74 [ -e .bzr ] && bzr export --uncommitted --format=dir /tmp/$CODE_DIR
75 [ -e .git ] && git checkout-index -a -f --prefix=/tmp/$CODE_DIR/
76 rsync -crlOzv --delete --exclude builddir -e "ssh -p $TARGET_SSH_PORT -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" /tmp/$CODE_DIR/ $USER@$TARGET_IP:$CODE_DIR/
81 exec_with_ssh "[ $CODE_DIR/debian/control -nt unity8-build-deps*deb ] && $SUDO mk-build-deps --tool=\\\"apt-get -y --no-install-recommends\\\" --build-dep --install $CODE_DIR/debian/control"
82 exec_with_ssh PATH=/usr/lib/ccache:$PATH "cd $CODE_DIR/ && PATH=/usr/lib/ccache:$PATH ./build"
97 exec_with_ssh "stop unity8"
98 exec_with_ssh "cd $CODE_DIR/ && ./run $ARGS -- $RUN_OPTIONS"
99 exec_with_ssh "start unity8"
102set -- `getopt -n$0 -u -a --longoptions="setup,gdb,pinlock,keylock,help" "sgpkh" "$@"`
104# FIXME: giving incorrect arguments does not call usage and exit
108 -s|--setup) SETUP=true;;
110 -p|--pinlock) PINLOCK=true;;
111 -k|--keylock) KEYLOCK=true;;
120[ "${TARGET_IP}" = "127.0.0.1" ] && setup_adb_forwarding
122if [ "`adb shell 'grep -q Ubuntu /etc/lsb-release 2> /dev/null && echo -n FLIPPED'`" = "FLIPPED" ]; then
125 if [ "${TARGET_IP}" != "127.0.0.1" ]; then
126 echo "ERROR: Flipped image detected, adb over TCP/IP isn't supported, yet :/"
127 echo "Unset TARGET_IP and try again."
133 echo "Setting up environment for building shell.."
138 echo "Transferring code.."
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list