From 28a4ea01d163da1becdecb535e6cec8f35a5ff81 Mon Sep 17 00:00:00 2001 From: jEzEk Date: Tue, 11 Jan 2022 18:27:34 +0100 Subject: [PATCH 01/10] Use "exec_device" function instead of "adb shell" command everywhere --- crossbuilder | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crossbuilder b/crossbuilder index a1f1fbc..b096a01 100755 --- a/crossbuilder +++ b/crossbuilder @@ -759,7 +759,7 @@ check_for_device_network() { NETWORK_UP=0 for i in `seq 1 5` do - if adb shell ping -c1 -w1 google.com | grep PING > /dev/null 2>&1 ; then + if exec_device "ping -c1 -w1 google.com" | grep PING > /dev/null 2>&1 ; then NETWORK_UP=1 break fi @@ -801,7 +801,7 @@ deploy_deb () { exec_device "printf 'deb file:/tmp/repo/ /\n' > /tmp/repo/sources.list" exec_device "cp /etc/apt/sources.list /tmp/repo/all.list" exec_device "cat /tmp/repo/sources.list >> /tmp/repo/all.list" - SERIES=$(adb shell lsb_release -cs | tr -d '\r') + SERIES=$(exec_device "lsb_release -cs" | tr -d '\r') exec_device "printf 'Package: *\nPin: release o=local\nPin-Priority: 2000\n\nPackage: *\nPin: release a=$SERIES*\nPin-Priority: 50' | SUDO_ASKPASS=/tmp/askpass.sh sudo -A tee /etc/apt/preferences.d/localrepo.pref" # exec_device SUDO_ASKPASS=/tmp/askpass.sh sudo -A apt-get update else @@ -995,10 +995,10 @@ DEVICE_PASSWORD_FILE=~/.config/crossbuilder/device_password DEVICE_STATE=`adb get-state || true` if [ "$DEVICE_STATE" = "device" ] ; then - DEVICE_ARCH=$(adb shell "dpkg --print-architecture" 2>&1| tr -d '\r') + DEVICE_ARCH=$(exec_device "dpkg --print-architecture" 2>&1 | tr -d '\r') if echo "$DEVICE_ARCH" | grep -vq "not found"; then TARGET_ARCH=$DEVICE_ARCH - TARGET_UBUNTU=$(adb shell "lsb_release --release --short" | tr -d '\r') + TARGET_UBUNTU=$(exec_device "lsb_release --release --short" | tr -d '\r') DEPLOY=true fi fi; From ea3367c054309a30f9d7118c2aa1b779228901f4 Mon Sep 17 00:00:00 2001 From: jEzEk Date: Wed, 12 Jan 2022 23:35:01 +0100 Subject: [PATCH 02/10] Detect real path of the script in case the script is a softlink --- crossbuilder | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crossbuilder b/crossbuilder index b096a01..c702b4c 100755 --- a/crossbuilder +++ b/crossbuilder @@ -138,7 +138,8 @@ variables () { fi USERDIR=/home/$USERNAME SOURCE_REPOSITORY=$USERDIR/source_repository - SCRIPT_DIR=`dirname $0` + SCRIPT_REALPATH=$(realpath "${0}") + SCRIPT_DIR=$(dirname "${SCRIPT_REALPATH}") CREATE_REPO_SCRIPT=create_repository.sh MOUNTED_DIRECTORY=$PWD MOUNT_POINT=$USERDIR/$PACKAGE From f3d50abd4ee615b07fcecb0d15958d91064f7885 Mon Sep 17 00:00:00 2001 From: jEzEk Date: Thu, 13 Jan 2022 18:25:19 +0100 Subject: [PATCH 03/10] Use "push_device" function instead of "adb push" command everywhere --- crossbuilder | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crossbuilder b/crossbuilder index c702b4c..9c5bdd0 100755 --- a/crossbuilder +++ b/crossbuilder @@ -86,6 +86,11 @@ exec_device () { adb shell "$@" } +push_device () { + #echo adb push "$@" + adb push "$@" +} + exec_container_root () { command="$@" #echo lxc exec $LXD_CONTAINER "$@" @@ -780,7 +785,7 @@ deploy_deb () { echo -e "${POSITIVE_COLOR}Transferring Debian packages to device.${NC}" # tranfer debian packages to device exec_device mkdir -p /tmp/repo - adb push $DEBS_TARBALL /tmp/repo/ + push_device $DEBS_TARBALL /tmp/repo/ exec_device "cd /tmp/repo && tar xvf /tmp/repo/$DEBS_TARBALL && rm -f /tmp/repo/$DEBS_TARBALL_ROOT*" # install debian packages on device @@ -797,7 +802,7 @@ deploy_deb () { # create local deb repository on device rm -f $CREATE_REPO_SCRIPT if ! adb pull /tmp/repo/$CREATE_REPO_SCRIPT 2> /dev/null ; then - adb push $SCRIPT_DIR/$CREATE_REPO_SCRIPT /tmp/repo/ + push_device $SCRIPT_DIR/$CREATE_REPO_SCRIPT /tmp/repo/ exec_device /tmp/repo/$CREATE_REPO_SCRIPT /tmp/repo exec_device "printf 'deb file:/tmp/repo/ /\n' > /tmp/repo/sources.list" exec_device "cp /etc/apt/sources.list /tmp/repo/all.list" @@ -868,7 +873,7 @@ deploy_to_device () { # execute post deploy if test -e $SOURCE_PATH_LOCAL/$POST_DEPLOY_SCRIPT ; then echo -e "${POSITIVE_COLOR}Execute project specific post deploy script ($POST_DEPLOY_SCRIPT).${NC}" - adb push $SOURCE_PATH_LOCAL/$POST_DEPLOY_SCRIPT /tmp + push_device $SOURCE_PATH_LOCAL/$POST_DEPLOY_SCRIPT /tmp exec_device sh /tmp/$(basename $POST_DEPLOY_SCRIPT) else echo -e "${POSITIVE_COLOR}If a script named $POST_DEPLOY_SCRIPT existed, it would be executed on device after every deploy.${NC}" From ca19bd326aa3c913b1c0603e301d50eacf34e940 Mon Sep 17 00:00:00 2001 From: jEzEk Date: Fri, 14 Jan 2022 17:35:13 +0100 Subject: [PATCH 04/10] Fix file deletion after adb pull --- crossbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crossbuilder b/crossbuilder index 9c5bdd0..e340d36 100755 --- a/crossbuilder +++ b/crossbuilder @@ -800,7 +800,6 @@ deploy_deb () { check_for_device_network echo -e "${POSITIVE_COLOR}Upgrading packages already installed on device with newly built ones.${NC}" # create local deb repository on device - rm -f $CREATE_REPO_SCRIPT if ! adb pull /tmp/repo/$CREATE_REPO_SCRIPT 2> /dev/null ; then push_device $SCRIPT_DIR/$CREATE_REPO_SCRIPT /tmp/repo/ exec_device /tmp/repo/$CREATE_REPO_SCRIPT /tmp/repo @@ -811,6 +810,7 @@ deploy_deb () { exec_device "printf 'Package: *\nPin: release o=local\nPin-Priority: 2000\n\nPackage: *\nPin: release a=$SERIES*\nPin-Priority: 50' | SUDO_ASKPASS=/tmp/askpass.sh sudo -A tee /etc/apt/preferences.d/localrepo.pref" # exec_device SUDO_ASKPASS=/tmp/askpass.sh sudo -A apt-get update else + rm -f $CREATE_REPO_SCRIPT exec_device /tmp/repo/$CREATE_REPO_SCRIPT /tmp/repo fi; From a9f042f1122e621bfebd7d140ad8e64812b5978d Mon Sep 17 00:00:00 2001 From: jEzEk Date: Fri, 14 Jan 2022 18:00:02 +0100 Subject: [PATCH 05/10] Add and use "check_file_exists_device" function instead of all "adb pull" with consequent file deletion --- crossbuilder | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crossbuilder b/crossbuilder index e340d36..39ec109 100755 --- a/crossbuilder +++ b/crossbuilder @@ -91,6 +91,15 @@ push_device () { adb push "$@" } +check_file_exists_device () { + if ! adb pull "$1" /tmp 2>&1 >/dev/null ; then + return 1 + fi + + rm -f "/tmp/$(basename $1)" + return 0 +} + exec_container_root () { command="$@" #echo lxc exec $LXD_CONTAINER "$@" @@ -800,7 +809,7 @@ deploy_deb () { check_for_device_network echo -e "${POSITIVE_COLOR}Upgrading packages already installed on device with newly built ones.${NC}" # create local deb repository on device - if ! adb pull /tmp/repo/$CREATE_REPO_SCRIPT 2> /dev/null ; then + if ! check_file_exists_device /tmp/repo/$CREATE_REPO_SCRIPT ; then push_device $SCRIPT_DIR/$CREATE_REPO_SCRIPT /tmp/repo/ exec_device /tmp/repo/$CREATE_REPO_SCRIPT /tmp/repo exec_device "printf 'deb file:/tmp/repo/ /\n' > /tmp/repo/sources.list" @@ -810,7 +819,6 @@ deploy_deb () { exec_device "printf 'Package: *\nPin: release o=local\nPin-Priority: 2000\n\nPackage: *\nPin: release a=$SERIES*\nPin-Priority: 50' | SUDO_ASKPASS=/tmp/askpass.sh sudo -A tee /etc/apt/preferences.d/localrepo.pref" # exec_device SUDO_ASKPASS=/tmp/askpass.sh sudo -A apt-get update else - rm -f $CREATE_REPO_SCRIPT exec_device /tmp/repo/$CREATE_REPO_SCRIPT /tmp/repo fi; @@ -854,8 +862,7 @@ deploy_to_device () { # check password is correct exec_device SUDO_ASKPASS=/tmp/askpass.sh sudo -A touch /tmp/password_ok - if adb pull /tmp/password_ok ; then - rm -f password_ok + if check_file_exists_device /tmp/password_ok ; then exec_device SUDO_ASKPASS=/tmp/askpass.sh sudo -A rm -f /tmp/password_ok else echo -e "${ERROR_COLOR}Device password incorrect. Use --password to pass the correct one or write it in $DEVICE_PASSWORD_FILE.${NC}" From 7e1fd887902454cf8ad6e00e759c9ab94e799552 Mon Sep 17 00:00:00 2001 From: jEzEk Date: Fri, 14 Jan 2022 18:20:42 +0100 Subject: [PATCH 06/10] Add and use "check_device_accessible" function instead of "adb get-state" --- crossbuilder | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/crossbuilder b/crossbuilder index 39ec109..fc97c3d 100755 --- a/crossbuilder +++ b/crossbuilder @@ -93,13 +93,23 @@ push_device () { check_file_exists_device () { if ! adb pull "$1" /tmp 2>&1 >/dev/null ; then + # Some pull error, so we can assume, that the file doesn't exist. return 1 fi - + # Remove the pulled file. rm -f "/tmp/$(basename $1)" return 0 } +check_device_accessible () { + local DEVICE_STATE=$(adb get-state 2>/dev/null || true) + if [ "$DEVICE_STATE" = "device" ] ; then + # Device found + return 0 + fi + return 1 +} + exec_container_root () { command="$@" #echo lxc exec $LXD_CONTAINER "$@" @@ -850,8 +860,7 @@ deploy_make_install () { } deploy_to_device () { - DEVICE_STATE=`adb get-state` - if [ "$DEVICE_STATE" != "device" ] ; then + if ! check_device_accessible ; then echo -e "${ERROR_COLOR}No device connected to deploy to.${NC}" exit 1 fi; @@ -1006,8 +1015,7 @@ DEVICE_PASSWORD=0000 DEVICE_PASSWORD_FILE=~/.config/crossbuilder/device_password [ -e "$DEVICE_PASSWORD_FILE" ] && DEVICE_PASSWORD=$(cat $DEVICE_PASSWORD_FILE) -DEVICE_STATE=`adb get-state || true` -if [ "$DEVICE_STATE" = "device" ] ; then +if check_device_accessible ; then DEVICE_ARCH=$(exec_device "dpkg --print-architecture" 2>&1 | tr -d '\r') if echo "$DEVICE_ARCH" | grep -vq "not found"; then TARGET_ARCH=$DEVICE_ARCH From 9eddcb76bb752c8bfca7a20340dbdcf43e1c3292 Mon Sep 17 00:00:00 2001 From: jEzEk Date: Sat, 15 Jan 2022 23:43:36 +0100 Subject: [PATCH 07/10] Refactor evaluating parameters before missing packages checks and make everything working as before --- crossbuilder | 147 ++++++++++++++++++++++++++------------------------- 1 file changed, 74 insertions(+), 73 deletions(-) diff --git a/crossbuilder b/crossbuilder index fc97c3d..dd8acda 100755 --- a/crossbuilder +++ b/crossbuilder @@ -929,6 +929,72 @@ detect_host_architecture() { fi } +while [ "$1" != "" ]; do + OPTION=`echo $1 | awk -F= '{print $1}'` + VALUE=`echo $1 | awk -F= '{print $2}'` + case $1 in + -*) + case $OPTION in + --packages) + PACKAGES_TO_DEPLOY=$VALUE + ;; + --architecture) + TARGET_ARCH=$VALUE + ;; + --ubuntu) + TARGET_UBUNTU=$VALUE + ;; + --lxd-image) + LXD_IMAGE=$VALUE + ;; + --password) + DEVICE_PASSWORD=$VALUE + ;; + --no-deb) + NO_DEB=1 + ;; + --deploy-path) + DEPLOY_PATH=$VALUE + ;; + --privileged) + FORCE_PRIVILEGED=1 + ;; + --ephemeral) + EPHEMERAL_CONTAINER=1 + EPHEMERAL_FLAG=--ephemeral + ;; + --parallel) + PARALLEL_BUILD=$VALUE + ;; + --help) + display_help + exit 0 + ;; + *) + display_help + echo "" + echo -e "${ERROR_COLOR}Error: unknown option: $OPTION${NC}" + exit 1 + ;; + esac + shift + ;; + *) + break + ;; + esac +done + +COMMAND=$1 +if [ -n "$COMMAND" ] ; then + shift +fi + +if [ "$COMMAND" = "help" ] ; then + display_help + exit 0 +fi + MISSING_PACKAGES= if ! which adb > /dev/null 2>&1 ; then if which apt > /dev/null 2>&1 ; then @@ -1006,94 +1072,29 @@ if [ -z $HOST_ARCH ] ; then exit 1 fi -TARGET_ARCH=armhf -TARGET_UBUNTU=16.04 - -PARALLEL_BUILD=$((`nproc` + 1)) +PARALLEL_BUILD=${PARALLEL_BUILD:-$((`nproc` + 1))} -DEVICE_PASSWORD=0000 DEVICE_PASSWORD_FILE=~/.config/crossbuilder/device_password -[ -e "$DEVICE_PASSWORD_FILE" ] && DEVICE_PASSWORD=$(cat $DEVICE_PASSWORD_FILE) +if [ -z "$DEVICE_PASSWORD" ] ; then + [ -e "$DEVICE_PASSWORD_FILE" ] && DEVICE_PASSWORD=$(cat $DEVICE_PASSWORD_FILE) || DEVICE_PASSWORD=0000 +fi if check_device_accessible ; then DEVICE_ARCH=$(exec_device "dpkg --print-architecture" 2>&1 | tr -d '\r') if echo "$DEVICE_ARCH" | grep -vq "not found"; then - TARGET_ARCH=$DEVICE_ARCH - TARGET_UBUNTU=$(exec_device "lsb_release --release --short" | tr -d '\r') + DETECTED_TARGET_ARCH=$DEVICE_ARCH + DETECTED_TARGET_UBUNTU=$(exec_device "lsb_release --release --short" | tr -d '\r') DEPLOY=true fi fi; -while [ "$1" != "" ]; do - OPTION=`echo $1 | awk -F= '{print $1}'` - VALUE=`echo $1 | awk -F= '{print $2}'` - case $1 in - -*) - case $OPTION in - --packages) - PACKAGES_TO_DEPLOY=$VALUE - ;; - --architecture) - TARGET_ARCH=$VALUE - ;; - --ubuntu) - TARGET_UBUNTU=$VALUE - ;; - --lxd-image) - LXD_IMAGE=$VALUE - ;; - --password) - DEVICE_PASSWORD=$VALUE - ;; - --no-deb) - NO_DEB=1 - ;; - --deploy-path) - DEPLOY_PATH=$VALUE - ;; - --privileged) - FORCE_PRIVILEGED=1 - ;; - --ephemeral) - EPHEMERAL_CONTAINER=1 - EPHEMERAL_FLAG=--ephemeral - ;; - --parallel) - PARALLEL_BUILD=$VALUE - ;; - --help) - display_help - exit 0 - ;; - *) - display_help - echo "" - echo -e "${ERROR_COLOR}error: unknown option: $OPTION${NC}" - exit 1 - ;; - esac - shift - ;; - *) - break - ;; - esac -done +TARGET_ARCH="${TARGET_ARCH:-${DETECTED_TARGET_ARCH:-armhf}}" +TARGET_UBUNTU="${TARGET_UBUNTU:-${DETECTED_TARGET_UBUNTU:-16.04}}" if [ -z "$LXD_IMAGE" ] ; then LXD_IMAGE=ubports-sdk:ubuntu-sdk-$TARGET_UBUNTU-$HOST_ARCH-$TARGET_ARCH-dev fi -COMMAND=$1 -if [ -n "$COMMAND" ] ; then - shift -fi - -if [ "$COMMAND" = "help" ] ; then - display_help - exit 0 -fi - check_command_parameter_count () { MIN_PARAMETERS=$1 MAX_PARAMETERS=$2 From f27805e8da50cfa291d3ab7d3f86a4f86d34e067 Mon Sep 17 00:00:00 2001 From: jEzEk Date: Mon, 17 Jan 2022 17:58:52 +0100 Subject: [PATCH 08/10] Possibility to deploy via ssh --- crossbuilder | 51 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/crossbuilder b/crossbuilder index dd8acda..fc3a127 100755 --- a/crossbuilder +++ b/crossbuilder @@ -78,20 +78,36 @@ display_help () { echo " --no-deb - Do not build Debian packages and uses rsync to deploy the build artifacts." echo " --deploy-path - When deploying with --no-deb (rsync), installation path for the build artifacts [defaults to /]." echo " --parallel - Set parallelism of the build. Defaults to the number of logical core + 1." + echo " --ssh - Use ssh with provided address instead of adb." } exec_device () { - #echo adb shell "$@" + if [ ! -z "$SSH_ADDRESS" ] ; then + ssh -o "ConnectTimeout=5" "$SSH_ADDRESS" "$@" || true + return + fi + adb shell "$@" } push_device () { - #echo adb push "$@" + if [ ! -z "$SSH_ADDRESS" ] ; then + local last="${!#}" + local argv=( "${@:1:$#-1}" ) + scp ${argv[@]} "$SSH_ADDRESS:$last" + return + fi + adb push "$@" } check_file_exists_device () { + if [ ! -z "$SSH_ADDRESS" ] ; then + ssh -o "ConnectTimeout=5" -q "$SSH_ADDRESS" '[ -e "'$1'" ]' + return + fi + if ! adb pull "$1" /tmp 2>&1 >/dev/null ; then # Some pull error, so we can assume, that the file doesn't exist. return 1 @@ -102,6 +118,11 @@ check_file_exists_device () { } check_device_accessible () { + if [ ! -z "$SSH_ADDRESS" ] ; then + ssh -o "ConnectTimeout=5" -q "$SSH_ADDRESS" "exit" + return + fi + local DEVICE_STATE=$(adb get-state 2>/dev/null || true) if [ "$DEVICE_STATE" = "device" ] ; then # Device found @@ -966,6 +987,9 @@ while [ "$1" != "" ]; do --parallel) PARALLEL_BUILD=$VALUE ;; + --ssh) + SSH_ADDRESS=$VALUE + ;; --help) display_help exit 0 @@ -996,13 +1020,24 @@ if [ "$COMMAND" = "help" ] ; then fi MISSING_PACKAGES= -if ! which adb > /dev/null 2>&1 ; then - if which apt > /dev/null 2>&1 ; then - MISSING_PACKAGES="android-tools-adb $MISSING_PACKAGES" - elif which pacman > /dev/null 2>&1 ; then - MISSING_PACKAGES="android-tools $MISSING_PACKAGES" +if [ -z "$SSH_ADDRESS" ] ; then + if ! which adb > /dev/null 2>&1 ; then + if which apt > /dev/null 2>&1 ; then + MISSING_PACKAGES="android-tools-adb $MISSING_PACKAGES" + elif which pacman > /dev/null 2>&1 ; then + MISSING_PACKAGES="android-tools $MISSING_PACKAGES" + fi + fi +else + if ! which ssh > /dev/null 2>&1 || ! which scp > /dev/null 2>&1 ; then + if which apt > /dev/null 2>&1 ; then + MISSING_PACKAGES="openssh-client $MISSING_PACKAGES" + elif which pacman > /dev/null 2>&1 ; then + MISSING_PACKAGES="openssh $MISSING_PACKAGES" + fi fi fi + if ! which jq > /dev/null; then MISSING_PACKAGES="jq $MISSING_PACKAGES" fi @@ -1086,7 +1121,7 @@ if check_device_accessible ; then DETECTED_TARGET_UBUNTU=$(exec_device "lsb_release --release --short" | tr -d '\r') DEPLOY=true fi -fi; +fi TARGET_ARCH="${TARGET_ARCH:-${DETECTED_TARGET_ARCH:-armhf}}" TARGET_UBUNTU="${TARGET_UBUNTU:-${DETECTED_TARGET_UBUNTU:-16.04}}" From 6c1dd3470a3a6b8bcd74e9a9aa1037c1a7923bcb Mon Sep 17 00:00:00 2001 From: jEzEk Date: Tue, 18 Jan 2022 18:13:57 +0100 Subject: [PATCH 09/10] Rsync to device directly instead of the sync_with_device script execution with --ssh and --no-deb parameter --- crossbuilder | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crossbuilder b/crossbuilder index fc3a127..7674fac 100755 --- a/crossbuilder +++ b/crossbuilder @@ -877,7 +877,13 @@ deploy_make_install () { DEPLOY_PATH="/" fi - sync_with_device $FOLDERS_TO_DEPLOY $DEPLOY_PATH + if [ ! -z "$SSH_ADDRESS" ]; then + # There is an ssh address already provided, skip sync_with_device script and just run the rsync. + rsync --rsync-path='SUDO_ASKPASS=/tmp/askpass.sh sudo -A rsync' -vae "ssh" $FOLDERS_TO_DEPLOY $SSH_ADDRESS:$DEPLOY_PATH + return + fi + + . "$SCRIPT_DIR/sync_with_device" $FOLDERS_TO_DEPLOY $DEPLOY_PATH } deploy_to_device () { From 4ea693c64f4bb9be3710b308a9fd0501e7614882 Mon Sep 17 00:00:00 2001 From: jEzEk Date: Tue, 18 Jan 2022 18:38:59 +0100 Subject: [PATCH 10/10] Add --ssh examle into README.md and make help description better --- README.md | 34 ++++++++++++++++++++++------------ crossbuilder | 8 ++++---- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 443f9fe..5a32757 100644 --- a/README.md +++ b/README.md @@ -6,25 +6,35 @@ Crossbuilder aims at making cross compiling code and deploying projects to devic Initially developed in: https://launchpad.net/crossbuilder To use it, clone the repository and just run it from there: - - cd crossbuilder - ./crossbuilder help +```bash +cd crossbuilder +./crossbuilder help +``` To build and deploy your project on the device connected to your computer all in one go: - - cd yourproject/ - crossbuilder +```bash +cd yourproject/ +crossbuilder +``` Change a line of code and type crossbuilder again to re-build and re-deploy. To go even faster, bypass building Debian packages with: - - crossbuilder --no-deb +```bash +crossbuilder --no-deb +``` For an even faster LXD setup, resetup LXD using ZFS: - - crossbuilder setup-lxd +```bash +crossbuilder setup-lxd +``` To enter the LXD container used to build: - - crossbuilder shell +```bash +crossbuilder shell +``` + +To use ssh instead of adb to deploy, use the ```--ssh``` option. If your device has ssh enabled on address let's say 192.168.0.5, use: +```bash +crossbuilder --ssh=phablet@192.168.0.5 +``` diff --git a/crossbuilder b/crossbuilder index 7674fac..c00dbca 100755 --- a/crossbuilder +++ b/crossbuilder @@ -74,11 +74,11 @@ display_help () { echo " --lxd-image - LXD image to use [defaults to the ones provided by the Ubuntu SDK (example: ubuntu-sdk-16.04-amd64-armhf-dev)." echo " --privileged - Use a privileged container (disabled by default)." echo " --ephemeral - Build using a short-lived container (disabled by default)." + echo " --ssh - Use ssh with provided address instead of adb to deploy to device." echo " --password - User password of the device to deploy to [defaults to 0000]." echo " --no-deb - Do not build Debian packages and uses rsync to deploy the build artifacts." echo " --deploy-path - When deploying with --no-deb (rsync), installation path for the build artifacts [defaults to /]." echo " --parallel - Set parallelism of the build. Defaults to the number of logical core + 1." - echo " --ssh - Use ssh with provided address instead of adb." } @@ -974,6 +974,9 @@ while [ "$1" != "" ]; do --lxd-image) LXD_IMAGE=$VALUE ;; + --ssh) + SSH_ADDRESS=$VALUE + ;; --password) DEVICE_PASSWORD=$VALUE ;; @@ -993,9 +996,6 @@ while [ "$1" != "" ]; do --parallel) PARALLEL_BUILD=$VALUE ;; - --ssh) - SSH_ADDRESS=$VALUE - ;; --help) display_help exit 0