0

Usual shar archives fail to extact in adb shell due to problems with lock directory and temporary files for HERE documents. Zip archives are also not an option.

How do I make an archive that can be easily extracted to /data/local/tmp/ out of the box on unrooted Android without busybox?

0

You can install busybox pretty easily on an unrooted Android phone. Steps:

  • Grab the file busybox-android from the eponymous github project.
  • Get it onto your device via scp, adb push, Android File Transfer, etc. Put it somewhere public that you'll have access to from a Terminal Emulator session. Just call it busybox.
  • Start a Terminal Emulator session. Make a directory ~/bin and copy the busybox file from the public place you put it to that new directory.
    • Since the cp command is not available in a Terminal Emulator session (!) do it this way: cat $PATH_TO_BUSYBOX/busybox > ~/bin/busybox
  • Now cd ~/bin and create a symbolic link: ln -s busybox tar.

So now create a tarball using tar czv $FILENAME $ROOT_OF_FILES_TO_ARCHIVE, kick it over to your device, and extract using tar xzv $FILENAME.

tar is also available by default to ssh sessions served by SSHDroid (because SSHDroid provides busybox). You might need to register it? Don't remember if that stuff works on the free version.

  • Is there a tool to create self-extracting archives for Android, to be able to unwrap complex structure (e.g. Valgrind) in /data/local/tmp/ in one move, without preparation step? – Vi0 Mar 11 '15 at 21:10
  • If there is, it would likely use the POSIX toolkit provided by busybox. – intuited Mar 12 '15 at 6:31
  • It can be shellscript+busybox+datafile bundled in one file. – Vi0 Mar 12 '15 at 10:41
  • Hmm. How would you extract the busybox from the bundle without the POSIX toolkit? – intuited Mar 12 '15 at 14:27
  • The bundle can start with #!/system/bin/sh, which will somehow extract busybox from it, then call busybox tar -xf. – Vi0 Mar 12 '15 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.