Merge pull request #7 from ErickReyesR/master
androdeb: add push command
diff --git a/androdeb b/androdeb
index a52f641..f4e613d 100755
--- a/androdeb
+++ b/androdeb
@@ -33,6 +33,7 @@
remove) REMOVE=1; shift || true; ;;
git-pull) GIT_PULL=1; shift || true; ;;
pull) PULL=1; shift || true; break ;;
+ push) PUSH=1; shift || true; break ;;
--arch) ARCH=$2; shift || true; shift || true; ;;
--archive) TARF=$2; shift || true; shift || true; ;;
--tracers) source $spath/packages/tracers; shift || true; ;;
@@ -68,10 +69,7 @@
echo "Preserving filestamps and mode"
shift || true
fi
- file_count=$#
- if [ $file_count -gt 1 ]; then
- file_count=$((file_count - 1))
- fi
+ file_count=`count_sources $@`
i=0
while [ $i -lt $file_count ]; do
files["$i"]=/data/androdeb/debian/$1
@@ -82,6 +80,19 @@
exit 0
fi
+if [ ! -z "$PUSH" ]; then
+ file_count=`count_sources $@`
+ i=0
+ while [ $i -lt $file_count ]; do
+ files["$i"]=$1
+ shift || true
+ i=$((i + 1))
+ done
+ dest=/data/androdeb/debian/$1
+ $ADB push $sync "${files[@]}" $dest
+ exit 0
+fi
+
if [ -z "$ASHELL" ] && [ -z "$PACKAGES" ]; then
echo "No packages specified, so I'm going to build/install all packages (--fullbuild)"
config_full_build
diff --git a/utils/android b/utils/android
index 7ad11be..d7db55f 100755
--- a/utils/android
+++ b/utils/android
@@ -51,3 +51,14 @@
if [ $? -ne 0 ]; then die 8 "Existing androdeb env not found on device. $1"; fi
set -e
}
+
+# Helper function to count number of source arguments in a list
+# when more than one argument is supplied, it is assumed the last argument
+# is a destination
+count_sources() {
+ local source_count=$#
+ if [ $source_count -gt 1 ]; then
+ source_count=$((source_count - 1))
+ fi
+ echo "$source_count"
+}
\ No newline at end of file
diff --git a/utils/banners b/utils/banners
index e4b65a8..1127a65 100755
--- a/utils/banners
+++ b/utils/banners
@@ -10,7 +10,8 @@
echo " shell Enter the androdeb shell environment and get to work!"
echo " remove Remove androdeb from the device"
echo " git-pull Git pull androdeb to update it on your host"
- echo " pull Retrieve files from the androdeb filesystem in the device"
+ echo " pull Copy files from the androdeb filesystem in the device"
+ echo " push Copy files to the androdeb filesystem in the device"
echo ""
echo " prepare Prepare the device (when running for the first time)"
echo " --tracers Enable tracing packages (perf and trace-cmd)"