diff --git a/androdeb b/androdeb index 1859ee1..e957fe9 100755 --- a/androdeb +++ b/androdeb @@ -60,7 +60,7 @@ case $key in --kernel-headers-targz) KERNELHDRS=$2; shift || true; shift || true; ;; --tempdir) TDIR="$2"; shift || true; shift || true; ;; --build) DOWNLOAD=0; shift || true; ;; - --buildtar) BTAR=1; DOWNLOAD=0; TARDIR="$2"; shift || true; shift || true; ;; + --buildtar) BTAR=1; DOWNLOAD=0; TARDIR="$2"; SKIP_DEVICE=1; shift || true; shift || true; ;; --device|-s) ADB="$ADB -s $2"; shift || true; shift || true; ;; --ssh) REMOTE="ssh"; SSH_URI="$2"; shift || true; shift || true; ;; --sshpass) SSHPASS="sshpass -p$2"; shift || true; shift || true; ;; @@ -259,7 +259,7 @@ if [ $DOWNLOAD -eq 1 ]; then TARF=$TDIR_ABS/$FNAME_UZ fi -if [ ! -z "$FULL" ] && [ -z "$KERNELSRC" ] && [ -z "$KERNELHDRS" ] && [ -z "$BI" ]; then +if [ ! -z "$FULL" ] && [ -z "$KERNELSRC" ] && [ -z "$KERNELHDRS" ] && [ -z "$BI" ] && [ $DOWNLOAD -eq 1 ]; then c_info "Kernel headers are needed but none were provided. Downloading pre-built headers" download_headers fi @@ -324,6 +324,14 @@ sudo $spath/buildstrap $ARCH $DISTRO $TDIR $OUT_TMP \ $ex_files $INSTALL_BCC $SKIP_DEVICE rm $ex_files +# Extract a tar of the built, compiled and installed androdeb env +if [[ ! -z ${TARDIR+x} ]]; then + c_info "Creating tarball" + pushd $TARDIR + mv $TDIR/deb.tar.gz $FNAME_UZ + popd +fi + # If we only wanted to prepare a rootfs and don't have # a device connected, then just echo that and skip cleanup if [ $SKIP_DEVICE -eq 1 ]; then @@ -346,21 +354,6 @@ remote_copy $TDIR/deb.tar.gz /data/androdeb/ remote_copy $spath/addons/* /data/androdeb/ remote_shell /data/androdeb/device-unpack -# Extract a tar of the built, compiled and installed androdeb env -if [[ ! -z ${TARDIR+x} ]]; then - c_info "Creating tarball" - pushd $TARDIR - if [ $INSTALL_BCC -eq 0 ]; then - mv $TDIR/deb.tar.gz $FNAME_UZ - else - remote_shell /data/androdeb/build-debian-tar - remote_pull /data/androdeb/androdeb-fs.tgz $FNAME_UZ - remote_shell rm /data/androdeb/androdeb-fs.tgz; - fi - zip -r $FNAME $FNAME_UZ - popd -fi - do_cleanup all_done_banner diff --git a/buildstrap b/buildstrap index bdbc554..3b24fa2 100755 --- a/buildstrap +++ b/buildstrap @@ -59,6 +59,9 @@ fi # Add a default DNS server echo "nameserver 4.2.2.2" > $OUT_TMP/etc/resolv.conf +chroot $OUT_TMP apt update || true +chroot $OUT_TMP apt install -y trace-cmd xz-utils || true + # Clone BCC if needed if [ $INSTALL_BCC -eq 1 ]; then git clone https://github.com/iovisor/bcc.git $TDIR/debian/bcc-master @@ -69,8 +72,6 @@ fi # Should we really do this? chmod -R 0777 $TDIR/ -[ $SKIP_DEVICE -eq 0 ] || exit 0 - c_info "Compressing new filesystem to prepare to push to Android /data/androdeb/" tar -zcf $TDIR/deb.tar.gz -C $TDIR debian