blob: 79fcd668e26d8548685a0920dcd9ae57e829c25d [file] [log] [blame]
Joel Fernandes6c1ca312018-03-30 17:13:15 -07001#!/bin/bash -e
Joel Fernandesefe6c4c2018-04-01 21:24:02 -07002#
Joel Fernandes1ed30d72018-05-18 14:08:20 -07003# (c) Joel Fernandes <joel@joelfernandes.org>
Joel Fernandesefe6c4c2018-04-01 21:24:02 -07004
Joel Fernandes5ac823f2018-07-08 14:04:31 -07005VERSION=v0.99e
Joel Fernandesa67be0b2018-04-01 13:40:34 -07006
Joel Fernandes464193e2018-04-02 23:54:49 -07007spath="$(dirname "$(readlink -f "$0")")"
8# spath=$( cd "$(dirname "$0")" ; pwd -P )
Joel Fernandes4fb97ea2018-03-31 11:15:19 -07009curdir=$( pwd -P )
Joel Fernandes4e19ccd2018-07-08 17:23:07 -070010source $spath/utils/support
Joel Fernandesca8fb552018-04-01 13:48:16 -070011source $spath/utils/banners
Joel Fernandes83676b12018-03-30 23:33:47 -070012
Joel Fernandes6c1ca312018-03-30 17:13:15 -070013# Set default vars
Joel Fernandesf0c54092018-04-01 19:05:10 -070014DISTRO=buster; ARCH=arm64
Joel Fernandes02939a32018-04-02 22:18:10 -070015ADB="adb"
Joel Fernandesfdc52002018-07-08 18:49:20 -070016SKIP_DEVICE=0 # Skip device preparation
Joel Fernandesffcbfe42018-07-08 19:08:02 -070017INSTALL_BCC=0 # Decide if BCC is to be installed
Joel Fernandesf0c54092018-04-01 19:05:10 -070018
19# Default packages
Joel Fernandes (Google)4f711082018-05-29 16:23:15 -070020DEFAULT_PACKAGES+="bash
21ca-certificates"
22
Joel Fernandes (Google)4b216fd2018-05-29 12:33:27 -070023EXTRA_FILES="none"
Joel Fernandes6c1ca312018-03-30 17:13:15 -070024
Joel Fernandesab5f9282018-04-05 22:53:23 -070025config_full_build() {
Joel Fernandes (Google)d7f21f12018-05-27 20:19:51 -070026 for f in $(ls $spath/packages); do source $spath/packages/$f; done;
Joel Fernandesab5f9282018-04-05 22:53:23 -070027}
28
Joel Fernandes6c1ca312018-03-30 17:13:15 -070029# Parse command line parameters
Joel Fernandes5b4be9c2018-03-30 23:58:27 -070030if [ $# -lt 1 ]; then usage; fi; POSITIONAL=()
Joel Fernandes4fb97ea2018-03-31 11:15:19 -070031while [[ $# -gt 0 ]]; do key="$1";
Joel Fernandesccb993f2018-07-02 19:59:04 -070032
33# If its shell mode, any future args become shell's args
34if [ "x$ASHELL" == "x1" ]; then
35 if [ -z "$SHELL_ARGS" ]; then
36 SHELL_ARGS=$key
37 else
38 SHELL_ARGS="$SHELL_ARGS $key"
39 fi
40 shift || true; continue
41fi
42
Joel Fernandes6c1ca312018-03-30 17:13:15 -070043case $key in
Joel Fernandes (Google)448a1742018-05-29 12:23:18 -070044 prepare) PREPARE=1; shift || true; ;;
Joel Fernandese2a04662018-03-31 19:33:23 -070045 shell) ASHELL=1; shift || true; ;;
Joel Fernandesb4c80a62018-04-02 22:37:22 -070046 remove) REMOVE=1; shift || true; ;;
Erick Reyese25caea2018-06-19 15:42:59 -070047 git-pull) GIT_PULL=1; shift || true; ;;
48 pull) PULL=1; shift || true; break ;;
Erick Reyes5104a6c2018-06-27 15:31:58 -070049 push) PUSH=1; shift || true; break ;;
Joel Fernandes (Google)08d1a072018-05-28 13:29:03 -070050 --arch) ARCH=$2; shift || true; shift || true; ;;
Joel Fernandes9f00bf42018-04-01 10:36:33 -070051 --archive) TARF=$2; shift || true; shift || true; ;;
Joel Fernandes4fb97ea2018-03-31 11:15:19 -070052 --tracers) source $spath/packages/tracers; shift || true; ;;
53 --compilers) source $spath/packages/compilers; shift || true; ;;
54 --editors) source $spath/packages/editors; shift || true; ;;
55 --scheduler) source $spath/packages/scheduler; shift || true; ;;
Joel Fernandesab5f9282018-04-05 22:53:23 -070056 --fullbuild) config_full_build; shift || true; ;;
Joel Fernandesa67be0b2018-04-01 13:40:34 -070057 --download) DOWNLOAD=1; shift || true; ;;
Joel Fernandes100c4682018-04-01 20:09:57 -070058 --bcc) source $spath/packages/bcc; shift || true; ;;
Joel Fernandes5b4be9c2018-03-30 23:58:27 -070059 --kernelsrc) KERNELSRC="$2"; shift || true; shift || true; ;;
Joel Fernandes (Google)1171d2d2018-05-30 17:22:09 -070060 --skip-install) SKIP_INSTALL=1; shift || true; ;;
Joel Fernandes1ed30d72018-05-18 14:08:20 -070061 --kernel-headers-targz) KERNELHDRS=$2; shift || true; shift || true; ;;
Joel Fernandese2a04662018-03-31 19:33:23 -070062 --tempdir) TDIR="$2"; shift || true; shift || true; ;;
Joel Fernandes97958e12018-03-31 23:51:44 -070063 --buildtar) TARDIR="$2"; shift || true; shift || true; ;;
Joel Fernandes02939a32018-04-02 22:18:10 -070064 --device|-s) ADB="$ADB -s $2"; shift || true; shift || true; ;;
Joel Fernandesfdc52002018-07-08 18:49:20 -070065 --build-image) BI=1; BUILD_IMAGEF=$2; SKIP_DEVICE=1; shift || true; shift || true; ;;
Joel Fernandesca8fb552018-04-01 13:48:16 -070066 --debug) set -x; shift || true; ;;
Joel Fernandes112243b2018-07-08 17:42:48 -070067 *) c_error "Unknown option ($1)"; usage; ;;
Joel Fernandes6c1ca312018-03-30 17:13:15 -070068esac
69done
70
Joel Fernandesdd102af2018-07-08 19:38:42 -070071[ -z $ASHELL ] && box_out "androdeb: $VERSION"
72
Erick Reyese25caea2018-06-19 15:42:59 -070073if [ ! -z "$GIT_PULL" ]; then
Joel Fernandes112243b2018-07-08 17:42:48 -070074 c_info "Updating androdeb by git pull"
Joel Fernandes16371152018-04-05 22:50:36 -070075 cd $spath
76 git pull
Joel Fernandes112243b2018-07-08 17:42:48 -070077 c_info "Done."
Joel Fernandes16371152018-04-05 22:50:36 -070078 exit 0
79fi
80
Erick Reyese25caea2018-06-19 15:42:59 -070081if [ ! -z "$PULL" ]; then
82 if [ $1 == "-a" ]; then
83 PRESERVE="-a"
Joel Fernandes112243b2018-07-08 17:42:48 -070084 c_info "Preserving filestamps and mode"
Erick Reyese25caea2018-06-19 15:42:59 -070085 shift || true
86 fi
Erick Reyes5104a6c2018-06-27 15:31:58 -070087 file_count=`count_sources $@`
Erick Reyese25caea2018-06-19 15:42:59 -070088 i=0
89 while [ $i -lt $file_count ]; do
90 files["$i"]=/data/androdeb/debian/$1
91 shift || true
92 i=$((i + 1))
93 done
94 $ADB pull $PRESERVE "${files[@]}" "$@"
95 exit 0
96fi
97
Erick Reyes5104a6c2018-06-27 15:31:58 -070098if [ ! -z "$PUSH" ]; then
Erick Reyes5104a6c2018-06-27 15:31:58 -070099 file_count=`count_sources $@`
100 i=0
101 while [ $i -lt $file_count ]; do
102 files["$i"]=$1
103 shift || true
104 i=$((i + 1))
105 done
106 dest=/data/androdeb/debian/$1
107 $ADB push $sync "${files[@]}" $dest
108 exit 0
109fi
110
Joel Fernandes9649a262018-07-02 20:49:41 -0700111if [ -z "$ASHELL" ] && [ -z "$REMOVE" ] && [ -z "$PACKAGES" ]; then
Joel Fernandes112243b2018-07-08 17:42:48 -0700112 c_info "No packages specified, so I'm going to build/install all packages (--fullbuild)"
Joel Fernandes (Google)9c3ae932018-05-28 14:34:48 -0700113 config_full_build
114fi
115
Joel Fernandes97958e12018-03-31 23:51:44 -0700116if [[ ! -z ${TARDIR+x} ]] && [[ ! -d $TARDIR ]]; then die 7 "Tar dir specified doesn't exist"; fi
Joel Fernandes92057762018-03-31 23:38:43 -0700117
Joel Fernandesfdc52002018-07-08 18:49:20 -0700118if [ -z $BI ]; then
Joel Fernandesdd102af2018-07-08 19:38:42 -0700119 [ -z $ASHELL ] && c_info "Looking for device.."
Joel Fernandesc26696d2018-07-08 18:28:12 -0700120 do_adb_root "$ADB"
Joel Fernandesaf07ec72018-04-02 22:01:19 -0700121
Joel Fernandesc26696d2018-07-08 18:28:12 -0700122 if [ $? -ne 0 ]; then
123 c_error "adb root failed, make sure:"
124 c_error " * If multiple devices connected, provide --device <serialno> (or -s <serialno>)"
125 c_error " * Try to run \"adb root\" manually and see if it works. Typically this needs a userdebug build."
126 c_error ""
127 c_error "Note: adb can be typically obtained using the android-tools-adb or the adb"
128 c_error "packages on your distro, or by installing the Android SDK."
129 die 3 "Exiting."
130 fi
Joel Fernandesfdc52002018-07-08 18:49:20 -0700131else
132 [ ! -z $BUILD_IMAGEF ] || die 8 "--build-image passed but no image file provided"
Joel Fernandes (Google)9c3ae932018-05-28 14:34:48 -0700133fi
Joel Fernandes72656c52018-03-31 20:35:33 -0700134
Joel Fernandesb4c80a62018-04-02 22:37:22 -0700135if [ ! -z "$REMOVE" ]; then
136 die_if_no_androdeb "Nothing to remove."
Joel Fernandes (Google)7c8b1082018-06-25 12:29:10 -0700137 $ADB shell /data/androdeb/device-umount-all || true;
Joel Fernandesb4c80a62018-04-02 22:37:22 -0700138 $ADB shell rm -rf /data/androdeb; exit 0; fi
139
Joel Fernandes83676b12018-03-30 23:33:47 -0700140##########################################################
Joel Fernandese2a04662018-03-31 19:33:23 -0700141# SHELL
Joel Fernandes83676b12018-03-30 23:33:47 -0700142##########################################################
Joel Fernandese381ac72018-03-31 21:46:36 -0700143if [ ! -z ${ASHELL+x} ]; then
Joel Fernandes02939a32018-04-02 22:18:10 -0700144 set +e; $ADB shell ls /data/androdeb/debian/.bashrc > /dev/null 2>&1
Joel Fernandesc9646812018-03-31 19:45:46 -0700145 if [ $? -ne 0 ]; then
146 die 2 "Device doesn't have an androdeb environment, run \"./androdeb prepare\" first";
147 fi; set -e
148
Joel Fernandesccb993f2018-07-02 19:59:04 -0700149 if [ ! -z ${SHELL_ARGS+x} ]; then
150 # Explanation of quotes:
151 # Outer quote is so that androdeb's bash passes the SHELL_ARGS as a single
152 # argument to $ADB shell. Inner quotes is so that run-command can receive all
153 # the args even though they may be separated by spaces. \m/
154 $ADB shell -t /data/androdeb/run-command "\"$SHELL_ARGS\""
155 else
156 $ADB shell -t /data/androdeb/run
157 fi
158
Joel Fernandese2a04662018-03-31 19:33:23 -0700159 exit 0
160fi
161
162##########################################################
163# PREPARE
164##########################################################
Joel Fernandesf0c54092018-04-01 19:05:10 -0700165
166function do_cleanup() {
167 rm -rf $TDIR/*; if [ $MKTEMP -eq 1 ]; then rm -rf $TDIR; fi
168}
169
170function push_unpack_headers() {
Joel Fernandesb4c80a62018-04-02 22:37:22 -0700171 die_if_no_androdeb "Couldn't update headers."
Joel Fernandesf0c54092018-04-01 19:05:10 -0700172
Joel Fernandesf95f2b22018-07-08 17:54:47 -0700173 c_info "Storing kernel headers into androdeb /kernel-headers/"
Joel Fernandes02939a32018-04-02 22:18:10 -0700174 $ADB shell rm -rf /data/androdeb/debian/kernel-headers/
175 $ADB shell mkdir /data/androdeb/debian/kernel-headers/
Joel Fernandesf95f2b22018-07-08 17:54:47 -0700176 run_quiet $ADB push $TDIR_ABS/kh.tgz /data/androdeb/
Joel Fernandes02939a32018-04-02 22:18:10 -0700177 $ADB shell tar -xvf /data/androdeb/kh.tgz -C /data/androdeb/debian/kernel-headers/ > /dev/null
178 $ADB shell rm /data/androdeb/kh.tgz
Joel Fernandesf0c54092018-04-01 19:05:10 -0700179}
180
Joel Fernandes1ed30d72018-05-18 14:08:20 -0700181function push_unpack_tarred_headers() {
182 die_if_no_androdeb "Couldn't update headers."
183
184 $ADB shell rm -rf /data/androdeb/debian/kernel-headers/
185 $ADB shell mkdir /data/androdeb/debian/kernel-headers/
Joel Fernandesf95f2b22018-07-08 17:54:47 -0700186
187 c_info "Pushing headers tar onto device"
188 run_quiet $ADB push $1 /data/androdeb/
189
Joel Fernandes112243b2018-07-08 17:42:48 -0700190 c_info "Storing kernel headers into androdeb root directory"
Joel Fernandes1ed30d72018-05-18 14:08:20 -0700191 $ADB shell tar -xvf /data/androdeb/$(basename $1) -C /data/androdeb/debian/ > /dev/null
192
193 $ADB shell rm /data/androdeb/$(basename $1)
194}
195
Joel Fernandes72065112018-04-01 20:02:53 -0700196function all_done_banner() {
Joel Fernandes112243b2018-07-08 17:42:48 -0700197 c_info "All done! Run \"androdeb shell\" to enter environment"
Joel Fernandes72065112018-04-01 20:02:53 -0700198}
199
Joel Fernandes72656c52018-03-31 20:35:33 -0700200# Prepare is the last command checked
Joel Fernandes9f00bf42018-04-01 10:36:33 -0700201if [ -z "$PREPARE" ]; then usage; fi
Joel Fernandes72656c52018-03-31 20:35:33 -0700202
Joel Fernandes1ed30d72018-05-18 14:08:20 -0700203if [ ! -z "$TARF" ] && [ ! -f $TARF ] && [ -z "$DOWNLOAD" ]; then die 5 "archive provided doesn't exist"; fi
Joel Fernandes9f00bf42018-04-01 10:36:33 -0700204
Joel Fernandes1ed30d72018-05-18 14:08:20 -0700205if [ ! -z "$KERNELSRC" ] && [ ! -d $KERNELSRC ]; then die 6 "Kernel source directory provided doesn't exist"; fi
206
207if [ ! -z "$KERNELHDRS" ] && [ ! -f $KERNELHDRS ]; then die 7 "Kernel headers tar.gz doesn't exist"; fi
Joel Fernandese2a04662018-03-31 19:33:23 -0700208
Joel Fernandesca8fb552018-04-01 13:48:16 -0700209print_prepare_banner
210
Joel Fernandes6c1ca312018-03-30 17:13:15 -0700211# Where do we want to store temporary files
Joel Fernandese2a04662018-03-31 19:33:23 -0700212MKTEMP=0; if [[ -z ${TDIR+x} ]] || [[ ! -d "${TDIR}" ]]; then
213 TDIR=`mktemp -d`; MKTEMP=1; fi
Joel Fernandese381ac72018-03-31 21:46:36 -0700214rm -rf $TDIR/*
215TDIR_ABS=$( cd "$TDIR" ; pwd -P )
Joel Fernandes6c1ca312018-03-30 17:13:15 -0700216
Joel Fernandesa67be0b2018-04-01 13:40:34 -0700217if [ ! -z "$DOWNLOAD" ]; then
Joel Fernandes112243b2018-07-08 17:42:48 -0700218 c_info "Downloading Androdeb from the web..."; c_info ""
Joel Fernandes (Google)9e670aa2018-06-25 13:39:34 -0700219 # Github dropped tar gz support! ##?#??#! Now we've to zip everything.
220 curl -L https://github.com/joelagnel/androdeb/releases/download/$VERSION/androdeb-fs.tgz.zip --output $TDIR_ABS/androdeb-fs.tgz.zip;
221 unzip -e $TDIR_ABS/androdeb-fs.tgz.zip -d $TDIR_ABS/
Joel Fernandesa67be0b2018-04-01 13:40:34 -0700222 TARF=$TDIR_ABS/androdeb-fs.tgz; fi
223
Joel Fernandese2a04662018-03-31 19:33:23 -0700224OUT_TMP=$TDIR/debian; rm -rf $OUT_TMP; mkdir -p $OUT_TMP
Joel Fernandesf0c54092018-04-01 19:05:10 -0700225
Joel Fernandes1ed30d72018-05-18 14:08:20 -0700226# Unpack the supplied kernel headers tar.gz directly into androdeb root
227if [ ! -z "$KERNELHDRS" ]; then
Joel Fernandes112243b2018-07-08 17:42:48 -0700228 c_info "Building updating kernel headers from supplied tar.gz ($KERNELHDRS)"
Joel Fernandes1ed30d72018-05-18 14:08:20 -0700229
230 # Is header tar gz update the only thing left to do?
Joel Fernandes (Google)1171d2d2018-05-30 17:22:09 -0700231 if [[ ! -z "$SKIP_INSTALL" ]]; then
Joel Fernandes112243b2018-07-08 17:42:48 -0700232 c_info "Skipping install"
Joel Fernandes1ed30d72018-05-18 14:08:20 -0700233 push_unpack_tarred_headers $KERNELHDRS; do_cleanup; all_done_banner; exit 0; fi
234
235 tar -xvf $KERNELHDRS -C $OUT_TMP/ > /dev/null
236fi
237
Joel Fernandesf0c54092018-04-01 19:05:10 -0700238# Package kernel headers
239if [ ! -z "$KERNELSRC" ]; then
Joel Fernandes112243b2018-07-08 17:42:48 -0700240 c_info "Building and updating kernel headers from kernel source dir ($KERNELSRC)"
Joel Fernandes72065112018-04-01 20:02:53 -0700241 $spath/bcc/build-kheaders-targz.sh ${KERNELSRC} $TDIR_ABS/kh.tgz > /dev/null
242
Joel Fernandesf0c54092018-04-01 19:05:10 -0700243 # Is header update the only thing left to do?
Joel Fernandes (Google)1171d2d2018-05-30 17:22:09 -0700244 if [[ ! -z "$SKIP_INSTALL" ]]; then
Joel Fernandes112243b2018-07-08 17:42:48 -0700245 c_info "Skipping install"
Joel Fernandes72065112018-04-01 20:02:53 -0700246 push_unpack_headers; do_cleanup; all_done_banner; exit 0; fi
Joel Fernandesf0c54092018-04-01 19:05:10 -0700247
Joel Fernandese381ac72018-03-31 21:46:36 -0700248 mkdir $OUT_TMP/kernel-headers
Joel Fernandes72065112018-04-01 20:02:53 -0700249 tar -xvf $TDIR_ABS/kh.tgz -C $OUT_TMP/kernel-headers/ > /dev/null
Joel Fernandese381ac72018-03-31 21:46:36 -0700250fi
Joel Fernandes4fb97ea2018-03-31 11:15:19 -0700251
Joel Fernandesf0c54092018-04-01 19:05:10 -0700252# Build FS from existing tar, very simple.
Joel Fernandes9f00bf42018-04-01 10:36:33 -0700253if [ ! -z "$TARF" ]; then
Joel Fernandes112243b2018-07-08 17:42:48 -0700254 c_info "Using archive at $TARF for filesystem preparation"
Joel Fernandes02939a32018-04-02 22:18:10 -0700255 $ADB shell mkdir -p /data/androdeb/
Joel Fernandesf95f2b22018-07-08 17:54:47 -0700256
257 c_info "Pushing filesystem to device.."
258 run_quiet $ADB push $TARF /data/androdeb/deb.tar.gz
259
260 c_info "Pushing addons to device.."
261 run_quiet $ADB push $spath/addons/* /data/androdeb/
262
263 c_info "Unpacking filesystem in device.."
264 run_quiet $ADB shell /data/androdeb/device-unpack
Joel Fernandes9f00bf42018-04-01 10:36:33 -0700265
Joel Fernandes1ed30d72018-05-18 14:08:20 -0700266 if [ ! -z "$KERNELHDRS" ]; then push_unpack_tarred_headers $KERNELHDRS; fi
Joel Fernandesf0c54092018-04-01 19:05:10 -0700267 if [ ! -z "$KERNELSRC" ]; then push_unpack_headers; fi
268
Joel Fernandes72065112018-04-01 20:02:53 -0700269 do_cleanup; all_done_banner; exit 0
Joel Fernandesf0c54092018-04-01 19:05:10 -0700270fi
271
272PACKAGES+="$DEFAULT_PACKAGES"
Joel Fernandes112243b2018-07-08 17:42:48 -0700273c_info "Using temporary directory: $TDIR"
Joel Fernandes4fb97ea2018-03-31 11:15:19 -0700274
Joel Fernandes112243b2018-07-08 17:42:48 -0700275if [[ $EUID -ne 0 ]]; then c_info "The next stage runs as sudo, please enter password if asked."; fi
Joel Fernandes4fb97ea2018-03-31 11:15:19 -0700276
Joel Fernandes (Google)57b3fd22018-05-29 16:27:03 -0700277ex_files=$(mktemp); echo $EXTRA_FILES > $ex_files
278
Joel Fernandes (Google)4f711082018-05-29 16:23:15 -0700279sudo $spath/buildstrap $ARCH $DISTRO $TDIR $OUT_TMP \
280 "$(make_csv "$PACKAGES")"\
Joel Fernandesfdc52002018-07-08 18:49:20 -0700281 $ex_files $INSTALL_BCC $SKIP_DEVICE
Joel Fernandes (Google)57b3fd22018-05-29 16:27:03 -0700282rm $ex_files
Joel Fernandes (Google)9c3ae932018-05-28 14:34:48 -0700283
284# If we only wanted to prepare a rootfs and don't have
285# a device connected, then just echo that and skip cleanup
Joel Fernandesfdc52002018-07-08 18:49:20 -0700286if [ $SKIP_DEVICE -eq 1 ]; then
287 c_info "Device preparation is being skipped for the selected options"
Joel Fernandesba7214e2018-07-08 18:15:49 -0700288 c_info "any builds that need to happen on device may be cloned but not built."
Joel Fernandes47ef2152018-07-08 19:13:51 -0700289
290 if [ ! -z $BI ]; then
291 sudo $spath/buildimage $OUT_TMP $(dirname $BUILD_IMAGEF)/$(basename $BUILD_IMAGEF)
292 sudo chmod a+rw $(dirname $BUILD_IMAGEF)/$(basename $BUILD_IMAGEF)
Joel Fernandes9a38e602018-07-08 19:26:32 -0700293 c_info "Your .img has been built! Enjoy!"
Joel Fernandes47ef2152018-07-08 19:13:51 -0700294 fi
Joel Fernandesba7214e2018-07-08 18:15:49 -0700295
296 do_cleanup
Joel Fernandes9a38e602018-07-08 19:26:32 -0700297 exit 0
Joel Fernandes (Google)9c3ae932018-05-28 14:34:48 -0700298fi
Joel Fernandes4dd60862018-03-31 13:27:16 -0700299
300# Push tar to device and start unpack
Joel Fernandes02939a32018-04-02 22:18:10 -0700301$ADB shell mkdir -p /data/androdeb/
302$ADB push $TDIR/deb.tar.gz /data/androdeb/
303$ADB push $spath/addons/* /data/androdeb/
304$ADB shell /data/androdeb/device-unpack
Joel Fernandesb61d27d2018-03-31 11:59:45 -0700305
Joel Fernandes6f1c70f2018-03-31 20:26:26 -0700306# Build BCC and install bcc on device if needed
Joel Fernandesffcbfe42018-07-08 19:08:02 -0700307if [ $INSTALL_BCC -eq 0 ]; then
308 $ADB shell /data/androdeb/run-command /bcc-master/build-bcc.sh;
309fi
Joel Fernandes4fb97ea2018-03-31 11:15:19 -0700310
Joel Fernandesf0c54092018-04-01 19:05:10 -0700311do_cleanup
Joel Fernandese381ac72018-03-31 21:46:36 -0700312
Joel Fernandes97958e12018-03-31 23:51:44 -0700313# Extract a tar of the built, compiled and installed androdeb env
314if [[ ! -z ${TARDIR+x} ]]; then
Joel Fernandes112243b2018-07-08 17:42:48 -0700315 c_info "Creating and pulling tarball of androdeb env from device"
Joel Fernandes02939a32018-04-02 22:18:10 -0700316 $ADB shell /data/androdeb/build-debian-tar
317 $ADB pull /data/androdeb/androdeb-fs.tgz $TARDIR/
318 $ADB shell rm /data/androdeb/androdeb-fs.tgz; fi
Joel Fernandes97958e12018-03-31 23:51:44 -0700319
Joel Fernandes72065112018-04-01 20:02:53 -0700320all_done_banner