How can I run 3 lines of code after Boot (to mount a network share) - Android Q&A, Help & Troubleshooting

Hi,
I've got a Probox2 AndroidTV box on Marshmallow.
I would like to mount a remote NFS share into it's filesystem, so that the share is accessible to all apps (I've disabled mountspace in SuperSU).
I can do this via terminal or SSH using the following 3 lines
Code:
su busybox mkdir -p /mnt/nfs/roms
su busybox chmod 777 /mnt/nfs
su --mount-master -c busybox mount -o rw,nolock,hard,intr,vers=3 -t nfs x.x.x.x:/mnt/Roms /mnt/nfs/roms
This works well and my Apps can find the network shares.
However I would like this be mounted automatically at every boot...
I've tried ScriptManager with this as the script
Code:
#!/system//bin/sh
su busybox mkdir -p /mnt/nfs/roms
su busybox chmod 777 /mnt/nfs
su --mount-master -c busybox mount -o rw,nolock,hard,intr,vers=3 -t nfs x.x.x.x:/mnt/Roms /mnt/nfs/roms
The script doesn't work from script manager or cli. (I know nothing about scripting).
I'm unsure how to go about getting it run/work....
Please could someone explain to me how to get those lines to run after boot or how to fix the script...
Thanks

Related

busybox and custom roms

Hi,
since a few days I have my first andriod mobile the HTC Hero. I have rooted it and everything works fine.
However, I found several interesting images for the G1 (JesusFreke or CyanogenMOD and so on). I suppose that they will not run on the HTC Hero :-( (yet). Sombody know if there is someone working on it? A google search is not that easy because the most roms are based on the HTC Hero sence and so you can easy find 100 hits with hero but all roms are not for the hero itself.
Does somebody have busybox running on the hero? I searched for a while but found nothing Hero specific. My first try to use a exiting manual for G1 did not work without problems. The most manuals are old and suggest to use a custom rom which include busybox.
Maybe someone has a hint for me
I want to test debian but the istaller use cp and so on. So busybox is a good starting point.
Cheers
Visios
download the attachment (busybox taken from cyanogen's rom), extract busybox and copy it to sdcard, then (if you have root):
Code:
adb shell
su
mount -o remount,rw /dev/block/mtdblock3 /system
dd if=/sdcard/busybox of=/system/bin/busybox
chmod 4755 /system/bin/busybox
mount -o remount,ro /dev/block/mtdblock3 /system
enlightener said:
download the attachment (busybox taken from cyanogen's rom), extract busybox and copy it to sdcard, then (if you have root):
Code:
adb shell
su
mount -o remount,rw /dev/block/mtdblock3 /system
dd if=/sdcard/busybox of=/system/bin/busybox
chmod 4755 /system/bin/busybox
mount -o remount,ro /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
tx for your info and the extracted busybox bin. It worked without any problem.
Do you have tried to use busybox install and export the path ?
enlightener said:
download the attachment (busybox taken from cyanogen's rom), extract busybox and copy it to sdcard, then (if you have root):
Code:
adb shell
su
mount -o remount,rw /dev/block/mtdblock3 /system
dd if=/sdcard/busybox of=/system/bin/busybox
chmod 4755 /system/bin/busybox
mount -o remount,ro /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
when i type adb shell it says
adb permission denied..
Help please
Yeah, I could google it but I'll just ask here instead, busybox - what's it good for?
It provides a lot of the standard Linux/Unix utilities - such as cp, rm, df, ls, ps, grep, etc. The toolbox program provided in the HTC ROM is a "crippled" replacement for busybox and doesn't have some of the functionality. For example, Market Enabler doesn't work with the stock ROM because toolbox doesn't provide the grep utility.
BlueHawk said:
It provides a lot of the standard Linux/Unix utilities - such as cp, rm, df, ls, ps, grep, etc. The toolbox program provided in the HTC ROM is a "crippled" replacement for busybox and doesn't have some of the functionality. For example, Market Enabler doesn't work with the stock ROM because toolbox doesn't provide the grep utility.
Click to expand...
Click to collapse
Oh, I see. Well explained, sir!
Busybox 1.15.3 for android for anyone interrested:
Code:
[URL="http://www.mediafire.com/?wcknmnhtin0"]http://www.mediafire.com/?wcknmnhtin0[/URL]
Does anybody know what version of Busybox is in the original post?
And if I want to upgrade, should I just follow the instructions over again with the newer version?
enlightener said:
download the attachment (busybox taken from cyanogen's rom), extract busybox and copy it to sdcard, then (if you have root):
Code:
adb shell
su
mount -o remount,rw /dev/block/mtdblock3 /system
dd if=/sdcard/busybox of=/system/bin/busybox
chmod 4755 /system/bin/busybox
mount -o remount,ro /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
Sorry for the newb question but... where do I type this stuff?
jpmi23 said:
Sorry for the newb question but... where do I type this stuff?
Click to expand...
Click to collapse
on a command line on your pc. this is not the right place to start for you, get a guide on how to setup adb on your pc first.
Wow. "abd". That's a new term now isn't it.
Ok. I'll skip it. Just looking to control my Samsung Moment on my PC like I was able to with my WM phones.
I'll keep looking around. Thanks for the help.

[Q] HELP!! Installing Busybox for Thai fonts...

Hey guys,
I was following this instruction here:
http://nexusonehacks.net/android-hacks/droid-hack-how-to-install-thai-font-on-droid/
hoping to install Thai fonts to my X10i, but having trouble installing Busybox. I was told to put the busybox file into the root folder of my SDcard...is that /sdcard/...?
I did the following commands on Terminal Emulator:
Type each line and press the enter key.
$ su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# mkdir /data/busybox
# cat /sdcard/busybox > /data/busybox/busybox
# chmod 755 /data/busybox/busybox
# mkdir /data/local
# cd /data/busybox
# ./busybox –-install
# cp /sdcard/fonts/* /system/fonts
And when I got to the busybox install, it says something like directory not found.....So I'm wondering whether I put the Busybox file in the right location in the first place...
Can somebody help me out? Greatly appreciate it!!
Search the marketplace for the busybox installer, it does it automatically.
Oh really? I did download Titanium Backup and use it to install Busybox. Is it the same thing?
Once I get it installed, can I just use "cp" in Terminal Emulator? How do I use it?
Yeah, if you can use Titanium Backup, then you have busybox installed.
I'm not sure about that, maybe someone else can jump in and assist.
Yes, once you've installed Titanium Backup, and used it to install busybox, you are ready to go. I didn't have to separately install busybox when I loaded Thai fonts into my phone.
if you installed titanum backup just press menu >problems >download busybox and it will be installed for you

[Q] OPENVPN Wolfbreak CM 6.1.3 V5 problem

ok..so ive recently flash my X10i stock 2.1 eclair to Wolfbreak CM 6.1.3 v5
and im having problems regarding my Openvpn settings.
**cant check my config files
so what i did is to follow the old thread regarding the old openvpn settings for eclair and issue this following command on terminal emulator
mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system
busybox insmod /sdcard/openvpn/tun.ko
busybox cp /sdcard/openvpn/openvpn /system/xbin/openvpn
busybox cp /sdcard/openvpn/openvpn /system/xbin/tun.ko
chmod 700 /system/xbin/openvpn
mkdir /system/xbin/bb
busybox ln -s /system/bin/busybox /system/xbin/bb/ifconfig
busybox ln -s /system/bin/busybox /system/xbin/bb/route
busybox mount -o remount,rw /dev/block/mtdblock2 /system
busybox cp /sdcard/openvpn/chargemon /system/bin/chargemon
busybox cp /sdcard/openvpn/busybox /system/bin/busybox
reboot
Click to expand...
Click to collapse
then my X10i will reboot and will start acting up. Force close keeps on popping and the device will automatically restart.
ive used those command when i used 2.1 eclair before and everything is working fine.
if anyone could enlighten me about this will be a great help.
also if you need other info, you can pm me or reply to my post.
this is my old working settings when i used eclair.
1.rooting my phone
2.install busy box
3.install terminal emulator
4.install openvpn application
5.install openvpn settings
6. issue this command in terminal
mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system
busybox insmod /sdcard/openvpn/tun.ko
busybox cp /sdcard/openvpn/openvpn /system/xbin/openvpn
busybox cp /sdcard/openvpn/openvpn /system/xbin/tun.ko
chmod 700 /system/xbin/openvpn
mkdir /system/xbin/bb
busybox ln -s /system/bin/busybox /system/xbin/bb/ifconfig
busybox ln -s /system/bin/busybox /system/xbin/bb/route
busybox mount -o remount,rw /dev/block/mtdblock2 /system
busybox cp /sdcard/openvpn/chargemon /system/bin/chargemon
busybox cp /sdcard/openvpn/busybox /system/bin/busybox
reboot
Click to expand...
Click to collapse
7.open the config file and wait for it to connect.
but those above mention steps doesnt work anymore in 2.2 froyo cm 6.1.3 of wolfbreak
tried it and my phone starts acting up.
reflash again, this time openvpn settings is the only application i installed because as far as i know, wolfbreak custom rom is already been rooted and includes busy box and openvpn application but no luck..
help please.
Hi There!
I think you've followed my old thread so i've made this very same codes work on every Froyo Modded ROM... Wolfbreak already have the openvpn binary installed in /system/xbin so you'll have to do 1 extra step.
1.- Open Terminal Emulator and issue this comand
Code:
rm -r /system/xbin/openvpn
mkdir /system/xbin/bb
ln -s /system/bin/busybox /system/xbin/bb/ifconfig
ln -s /system/bin/busybox /system/xbin/bb/route
cp /sdcard/openvpn/tun.ko /system/lib/modules/tun.ko
chmod 644 /system/lib/modules/tun.ko
2.- Download OpenVPN installer from Market (Free)
3.- Click on Install and choose the following options and you'll see two screens:
3.1 - In the first one choose "/system/xbin"
3.2 - In the Second one choose "System/xbin/bb"
4.- Go to OpenVPN settings and go to Advanced>TUN module Settings>Path to tun module> This should be /system/lib/modules/tun.ko
5.- Choose your OpenVPN configuration and you'll be done.
Report back if this helps... At least i've test it in the following ROMS:
* Trip's MIUI Roms
* Wolf's CM Roms (all Variants)
* Zdizihu's Free X10
* Jerpelea's CM 7 GB Roms
thanks mate for the reply,
anyway, i somehow manage to fix the above mention problem and somehow got my config file to get connected using the above post.
but everytime it get connected, a lot of errors occur.
1.force closed.... .....
2.linux....error....... .....fork error...
i cant remember the whole error message because it only pops up for a bit.
tried to reflash twice but to no avail, same results hapen.
so i gave up and flash back to 2.1 kx10 aosp and everything is working again..

[GUIDE] Manual root for Official ED01

>>>>>>>> REQUIRES working adb shell <<<<<<<<<<<
1. Download this zip, and extract its contents to /sdcard/extracted/rootED01/ (Root Explorer, which is not required, will do this by default when you click Extract All)
2. For each of the two STEP.txt files (in the zip and copied below), open an 'adb shell' and paste its contents into your shell.
Includes:
+ instructions, with pasteable root and unroot
+ Superuser.apk
+ su
+ busybox
+ rage.bin
CREDITS:
* adrynalyne for his version of busybox.
* 743C for rageagainsthecage exploit binary.
* ChainsDD for Superuser.apk
* Eousphoros on droidforums for his very similar guide.
********
Most people will prefer to use Super OneClick root. I only wrote this guide in response to finding this, and hoping that I could indeed get terminal emulator to root.
Unfortunately, I could find no way to change the permissions of the copied rage.bin without using adb. If anyone can find a way around this for froyo, I would love to hear about it!
I decided to post this guide anyway. At least it's a manual root that works with the official ED01 froyo update. If there is interest, I will go into detail about installing ADB, etc.
rootED01.zip
MD5: e97913f3bed5283c89d5b755a66f28e5
SHA-1: ab87ad372d0f9ba9d1d5043175953e91bdef77f3
# >>>>>>>>>> STEP ONE <<<<<<<<<<<<<
# Note: This path must match the files you extracted!
export ROOT_TOOLS=/sdcard/extracted/rootED01
cd $ROOT_TOOLS
cat rage.bin >/data/local/tmp/rage.bin
cd /data/local/tmp
chmod 777 rage.bin
./rage.bin
echo "Rage.bin will be done applying root. Reopen shell in 10 seconds."
# >>>>>>>>> STEP TWO <<<<<<<<<<<
# Do not procede with this step until you see a # in newly opened shell.
# Note: This path must match the files you extracted!
export ROOT_TOOLS=/sdcard/extracted/rootED01
# mount /system for writing & copy su & busybox
mount -o rw,remount /dev/block/stl9 /system
cd $ROOT_TOOLS/xbin
cat su >/system/xbin/su
cat busybox >/system/xbin/busybox
cd /system/xbin
chmod 4755 su
chmod 4755 busybox
#install Superuser
cd $ROOT_TOOLS/app/
cat ./Superuser.apk >/system/app/Superuser.apk
reboot now
# >>>>>>>>>> UNROOT <<<<<<<<<<<<
# get root
su
# mount /system for writing
mount -o rw,remount /dev/block/stl9 /system
#delete su & busybox
rm /system/xbin/su
rm /system/xbin/busybox
# delete Superuser.apk
rm /system/app/Superuser.apk
# delete other clutter
rm /data/local/tmp/rage.bin
# Once you reboot, the last of your root will be gone
mount -o ro,remount /dev/block/stl9 /system

WORK AROUND - Scripting help for Android and my DX2!

All right... I guess it's time to "ask the experts". My linux background has not been very much help here... ARGH!
Okay, I have two script that I have written that are supposed to mount /system as RO and RW respectively. Very simple:
To mount rw:
Code:
#!/system/bin/sh
mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system
To mount ro:
Code:
#!/system/bin/sh
mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system
I manually ran the mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system command and adb pushed them to /system/xbin as mountro and mountrw and chmod both to 755.
In ADB I try to execute:
Code:
/system/xbin/mountrw
and get an error stating:
Code:
/system/xbin/mountrw: not found
I even try:
Code:
/system/bin/sh /system/xbin/mountrw
and I get this error:
Code:
mount: No such file or directory
Okay, so I figured out that it is having a problem trying to find the mount command, so I modify the script to:
Code:
#!/system/bin/sh
/system/bin/mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system
I then re-run this:
Code:
/system/bin/sh /system/xbin/mountrw
and I'm still getting this friggin' error message!
Code:
mount: No such file or directory
When I run it through Script Manager I get the same error:
Code:
mount: No such file or directory
This should just friggin' work damn it! (Sorry, very frustrated.)
Also, it would be nice NOT to have to type the path to the script. I can run ZepplinRox V6_SuperCharger script from the ADB command line just by typing from the directory I have it in:
Code:
sh V6_SuperCharger_for_Android-update9_RC3.2.sh
No absolute path, no ./ path... WTF? ARGH!
Okay, I KNOW this is friggin' possible just by the fact that I can run Zep's script in ADB...
So, any takers? Thanks in advanced...
Friggin' Ciao.
[EDIT]
Okay, I figured out a work around for this... I probably should not work on this after working at work all day... But, that is another story...
I have heavily modified the script files I have created. They are still called mountrw and mountro and the contents are as follows:
mountrw:
Code:
#!/system/bin/sh
# This mounts the /system file system as Read Write in order to modify or add
# files to the /system file system.
busybox mount -o remount,rw / 2>/dev/null
busybox mount -o remount,rw rootfs 2>/dev/null
busybox mount -o remount,rw /system 2>/dev/null
mountro:
Code:
#!/system/bin/sh
# This mounts the /system file system as Read Only which is the default when
# Android is booted.
busybox mount -o remount,ro / 2>/dev/null
busybox mount -o remount,ro rootfs 2>/dev/null
busybox mount -o remount,ro /system 2>/dev/null
So, after poking around in ZepplinRox's V6_SuperCharger script, I found those values repeated several times, so that helped point me in the right direction. The next problem I had was getting the scripts to "run from anywhere". I still haven't figured that one out yet, and the VERY MESSY solution to that is to put the two scripts in /. I know, I know, I know... that is the most dangerous place to put it.
So, when I first log into the ADB shell all I have to type is
Code:
sh mountrw
and when I'm done, type
Code:
sh mountro
So, As the work around, this works. I really don't recommend anyone else doing this because of the data security risks that you open your phone up to... Yes, I'm aware of them and that is why I am asking now for some help in having the ability to run a script globally, from anywhere in the android file structure. I don't mind typing the "sh" in front of the script since I sometimes must do that in linux. I have noticed that the $PATH of Android doesn't allow scripts to be executed unless you type the absolute path to the script, or are in the same directory as the script.
Okay, so again to ask: Is there any way to execute a script without having to type the absolute path to it? Thanks!
Ciao! (MUCH calmer now then when I first wrote this post...)
[/EDIT]
I don't use adb much at all.
Usually I move stuff around with root explorer and use terminal emulator a lot.
I assume you ran everything as superuser as I sometimes forget to type su first
Maybe the sh command work on the supercharger script because it has the .sh extention.
You can try typing "bash mountrw" since that works when I install the script to /system/xbin/V6
But after reading your post I looked and saw I forgot about permissions so I did chmod 755 and now this works...
su
V6
heh..
I don't have tp type "bash V6" anymore
zeppelinrox said:
I don't use adb much at all.
Usually I move stuff around with root explorer and use terminal emulator a lot.
I assume you ran everything as superuser as I sometimes forget to type su first
Maybe the sh command work on the supercharger script because it has the .sh extention.
You can try typing "bash mountrw" since that works when I install the script to /system/xbin/V6
But after reading your post I looked and saw I forgot about permissions so I did chmod 755 and now this works...
su
V6
heh..
I don't have tp type "bash V6" anymore
Click to expand...
Click to collapse
Yes, I ran everything as su. (I'm a linux admin guy, so su and sudo is next to natural for me...)
Okay, so you put the mountrw script in /system/xbin/V6/ ??
Also, it is an sh script. I identify that in the first line of
Code:
#!/system/bin/sh
I have changed it to bash and same problem. Oh well. I think I can live with the scripts at /
Thanks though!
Ciao!

Categories

Resources