Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions androdeb
Original file line number Diff line number Diff line change
Expand Up @@ -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; ;;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
5 changes: 3 additions & 2 deletions buildstrap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down