My same BASH script is working in Fedora/CentOS.
But I am testing one Android eee pad transformer.
Where i have terminal access and i wrote a small test script. But its not working, how can i fix it? what am i doing wrong?
/data/data/berserker.android.apps.sshdroid/home $ cat test.sh
#!/bin/bash
var=`ifconfig -a`;
echo $var;
/data/data/berserker.android.apps.sshdroid/home $ chmod +x test.sh
/data/data/berserker.android.apps.sshdroid/home $ ./test.sh
sh: ./test.sh: not found
/data/data/berserker.android.apps.sshdroid/home $ uname -a
Linux localhost 2.6.36.3-00004-g069b8b5 #1 SMP PREEMPT Wed May 11 22:14:22 CST 2011 armv7l GNU/Linux
/data/data/berserker.android.apps.sshdroid/home $ bash ./test.sh
sh: bash: Permission denied
/data/data/berserker.android.apps.sshdroid/home $ ls -l /bin/bash
ls: /bin/bash: No such file or directory
/data/data/berserker.android.apps.sshdroid/home $ find / -name "bash"
find: /config: Permission denied
lots more.......
find: /proc/595/task/598/fd: Permission denied
......
find: /data: Permission denied
find: /root: Permission denied
Follow up:
This is my script now which works:
#!/bin/sh
echo "hello wassup, run me simply as './test.sh'";
or
#!/bin/bash
echo "hello wassup, run me using 'sh ./test.sh'";
in Android the shell is located in /system/bin/sh not /bin/sh like it is on most Unix-like systems. So even if you change #!/bin/bash to #!/bin/sh it will still not work. you'll have to use #!/system/bin/sh
Android is not a GNU/Linux distribution so you can't expect that all scripts that run on GNU/Linux to also work on Android.
May be it will work when calling interpreter with a script?
$ bash ./test.sh
I saw, that although it is specified #!/bin/bash error was posted by sh - may be it do wrong.
UPD
$ sh ./test.sh
Most Android devices don't have a bash interpreter installed. If you really need to run the script across Linux and Android, you could try using BusyBox but that will require rooting your device (and potentially voiding your warranty). Even then though, I don't know if the ifconfig utility is included in BusyBox.
I would strongly recommend using the Android SDK to write an app to do whatever your trying to accomplish.
As was stated, the Android OS (up to and including 4.0) does not include the BASH interpreter (just shell). While BusyBox is a great tool, I believe it's only a single executable that combines stripped-down-functionality-for-size versions of common UNIX utilities, but doesn't actually include the BASH interpreter.
For an Android compiled version of the BASH interpreter, refer to this Forum thread:
http://forum.xda-developers.com/showthread.php?t=537827
You can install Busybox, which provides you with many utilities such as awk, file, etc... and Terminal Emulator.
Create a shell file with #!/system/bin/sh as the first line (shebang)
Now place the completed script under /system/xbin or /system/bin and run it from the Terminal Emulator
The information is an excerpt from this article : HOW TO RUN SHELL SCRIPTS ON ANDROID DEVICES
Related
With python 3.6.4:
In a fresh Termux installation I do accordnung to https://wiki.termux.com/wiki/Arch
pkg install wget
wget https://raw.githubusercontent.com/sdrausty/TermuxArch/master/setupTermuxArch.sh
bash setupTermuxArch.sh
After that in ArchLinux:
$ pacman -S python python-pip
(success)
$ pip install simplejson (or any other package)
And always get:
running install_egg_info
running egg_info
writing simplejson.egg-info/PKG-INFO
writing dependency_links to simplejson.egg-info/dependency_links.txt
writing top-level names to simplejson.egg-info/top_level.txt
reading manifest file 'simplejson.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'simplejson.egg-info/SOURCES.txt'
Copying simplejson.egg-info to /root/.local/lib/python3.6/site-packages/simplejson-3.13.2-py3.6.egg-info
error: [Errno 13] Permission denied: '/root/.local/lib/python3.6/site-packages/simplejson-3.13.2-py3.6.egg-info/PKG-INFO'
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-r_x__623/simplejson/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-4dfnzavt-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-r_x__623/simplejson/
Also --user or pyvenv don't help at all. Any suggestions, what am I doing wrong?
Please note:
Android device is not rooted
The ArchLinux user is root (default)
Permissions look good. I can copy files manually to the destination directory just ok.
UPDATE: With python 2.7.14 everything works well.
I'm trying to build an empty new project project for Android target from Qt Creator, but I'm getting this error:
12:51:05: Packaging error: Command "C:/adt/sdk/platform-tools/adb.exe -s emulator-5554 pull /system/bin/app_process C:/Workspace/NewProjects/build-untitled18-Android_for_x86_GCC_4_9_Qt_5_4_2-Debug/app_process" failed.Exit code: 1
Screenshot:
And the full log, in case needed.
How do I fix that error?
After reading the answer to a related question:
As mentioned before, Android 5.0 has /system/bin/app_process as a symlink to /system/bin/app_process32. Since a symlink cannot be pulled with adb pull, the ndk-gdb script will not be able to work as-is.
I just logged into the android emulator VM and replaced the symlink with a copy of the file:
C:\Users\sasho>adb shell
root#generic_x86:/ # mount -o rw,remount /system
root#generic_x86:/ # cd /system/bin
root#generic_x86:/system/bin # rm app_process
root#generic_x86:/system/bin # cp app_process32 app_process
And it worked after that!
Currently working with the linphone-android integration. I have installed some packages during installation of Cygwin.
When I try some of the commands like ls, rm, cd, wget, tar and etc.. are working fine. But few commands like shell, clean are not working. It gives error command not found.
So, my question is,
Is there any way to get list of working commands for Cygwin?
Is there any way to install packages for these commands rather than installing them manually?
In my opinion the most elegant solution is to use the compgen command:
compgen -c lists all the available commands
compgen -a lists all the available aliases
You can also try a more brute approach:
Get all the paths from cygwin using echo $PATH and then for each folder execute ls -h <folder_name>
For installing a package the best way is to install first the equavalent of apt-get: apt-cyg from https://github.com/transcode-open/apt-cyg and put it in /usr/local/bin:
wget raw.github.com/transcode-open/apt-cyg/master/apt-cyg<br>
chmod +x apt-cyg<br>
mv apt-cyg /usr/local/bin<br>
You can also try running the setup executable used to install cygwin setup.exe -q -n -N -d -R c:\cygwin -s http://mirror_site_to_use -l c:\local_package_folder for a local package or setup.exe -q -P package_name to let the setup download the package
I just built AOSP 6.0 for hammerhead and attempted to flash it. My phone froze at the Google logo and refused to boot. I'm assuming I need to use the proprietary binaries found here https://developers.google.com/android/nexus/drivers
How would I extract these and put them in to my build? Thanks.
Be certain to download the Nexus 5 binaries that match the version of AOSP that you're building. For example, if you're building the most recent version of AOSP, when you initialized your repo you entered this command:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r72
Take that last branch code (everything after '-b') android-6.0.1_r72 and search for it over here:
https://source.android.com/source/build-numbers.html#source-code-tags-and-builds
It matches build M4B30X
Now, take that build code M4B30X and search for it over here:
https://developers.google.com/android/nexus/drivers
Download the corresponding binaries:
$ cd ~/Downloads
$ wget https://dl.google.com/dl/android/aosp/broadcom-hammerhead-m4b30x-7c7b231f.tgz
$ wget https://dl.google.com/dl/android/aosp/lge-hammerhead-m4b30x-74fa3aa5.tgz $ wget https://dl.google.com/dl/android/aosp/qcom-hammerhead-m4b30x-158606cf.tgz
Verify the integrity of each download:
$ echo "01a03cf36b20ee2460d108c1d199f4b012b084368cddfbff1e40ff8270b54d6f broadcom-hammerhead-m4b30x-7c7b231f.tgz" | sha256sum -c
$ echo "a533f4c82d430181b97ab2321acf10ab1e2b126de7bb15437c969331541af7cb lge-hammerhead-m4b30x-74fa3aa5.tgz" | sha256sum -c
$ echo "9a2760bda79e3be7bbe7203c05273c80b0d043d9aaf15be20361e35b16ef8905 qcom-hammerhead-m4b30x-158606cf.tgz" | sha256sum -c
Extract each gzip file:
$ tar xzvf broadcom-hammerhead-m4b30x-7c7b231f.tgz
$ tar xzvf lge-hammerhead-m4b30x-74fa3aa5.tgz
$ tar xzvf qcom-hammerhead-m4b30x-158606cf.tgz
Execute the resulting self-extracting files from the source tree's root folder(~/AOSP)
$ cd ~/AOSP
$ ~/Downloads/extract-broadcom-hammerhead.sh
$ ~/Downloads/extract-lge-hammerhead.sh
$ ~/Downloads/extract-qcom-hammerhead.sh
After executing each file hit the Enter key once and then hit
the Space bar until you reach the end of each document.
At the end of each document type:
I ACCEPT
and hit the Enter key.
To accommodate the new binaries you must initiate a full rebuild, so set the
environment:
$ ./ build/envsetup.sh
$ lunch aosp_hammerhead-userdebug
And make the synthetic target 'clobber' in order to clean:
$ make clobber
Now rebuild:
(If you're running a Core2Duo)
$ make -j4
(Or, if you're running something bigger)
$ make -j16
Uncompress the downloaded files, you will get bash files. Put all these files in the root directory of your AOSP project and execute them. You will have to accept the licenses and the binaries will be extracted in the right directory.
After this step. In the AOSP root directory, execute :
make clobber
It will clean the current build (out/**). It is needed for the make to notice the changes regarding the AOSP build official procedure.
Then you can compile again the sources.
make -j4
(or j8/j16 regarding your CPU threads number)
I'm trying to download Whatsapp on my laptop. I am using Ubuntu desktop software. I've installed Android Emulator from http://dl.google.com/android/android-sdk_r16-linux.tgz
I unzipped the file, opened the folder, Android-sdk-linux, opened Tools and now I'm supposed to execute the file Android, and I'm not sure how to do that. Can anyone give me any help?
Ok, so this is what I thought I was supposed to do:
shell#shell:~$ cd Desktop
shell#shell:~/Desktop$ ./android.sh
bash: ./android.sh: No such file or directory
but then that happens...
Make the file executable first with
chmod +x filename.sh
Then start the script with
./filename.sh
or
/full/path/to/filename.sh
sh filename.sh
OR
bash filename.sh
Use the following command to install the WhatsApp on Ubuntu:
wget https://www.thefanclub.co.za/sites/all/modules/pubdlcnt/pubdlcnt.php?file=https://www.thefanclub.co.za/sites/default/files/public/downloads/whatsapp-webapp_1.0_all.deb&nid=200 && sudo dpkg -i whatsapp-webapp_1.0_all.deb
Then enter the password and open WhatsApp using the application key.
by default permission for any shell script is "-rw-rw-r--" first we need to change the permissions using the "chmod command" then we can run the shell script in the same way in which we run the C executable code.
To debug the shell script we need to run the shell script with the "bash -x" option as follow : $ bash -x ./