[Q] executing root shell commands in app gives me a SU permissions rejected - Nexus One Themes and Apps

im trying to download files from a server(works) make a new directory for them to go in (works) than im trying to put these new files in the system partition by remounting the /system as readwrite(not working) than write the files to the system partition
can someone please help ive tried hours of trouble shooting
Code:
final Runtime runtime = Runtime.getRuntime();
try {
runtime.exec("su");
runtime.exec("mkdir /sdcard/newdir");
runtime.exec("wget -P /sdcard/newdir websiteurl.com/file");
runtime.exec("wget -P /sdcard/newdir websiteurl.com/file");
runtime.exec("wget -P /sdcard/newdir websiteurl.com/file");
runtime.exec("busybox mount -o rw,remount /system");
runtime.exec("mv -f /mnt/sdcard/newdir/file /system/dir");
runtime.exec("mv -f /mnt/sdcard/newdir/file /system/dir");
runtime.exec("mv -f /mnt/sdcard/newdir/file /system/dir");
runtime.exec("busybox mount -o ro,remount /system");
}
catch (IOException e) {
e.printStackTrace();
}

Related

Setup Ubuntu Maveric with 3G Image It Works Running 2 Operating systems simultaneousl

UPDATE: 01/13/11 Scrap Most of this,
got a 3G working image works 10tmes better than anything i have seen.
UPDATE go here:http://forum.xda-developers.com/showthread.php?t=912544
have networking with hamachi, ssh works coolstuff:
trying to put it together (steps to create, and emulate on your computer, an image to get worken on your phone,) it works for the epic also which i have to say i prefer because of the slide-out, ya no wat. as soon as possible 2 DAYS TOPS
To Install Ubuntu Maveric on your Phone:
Of course you must have a rooted phone, since your rom must use a kernel with Loop support, I have only tested this on CyanogenMod Nightly build 199
make sure you have busybox installed
To create the image You have to start with a computer running Ubuntu or setup Virtual Box on a Windows computer,
or go here http://w3.impa.br/~gabrield/data/ubuntu-arm-development-rootfs.tar.bz2 to download the prebuilt one ( i havnt tested it)
1: Open Terminal in Ubuntu
2: Enter:
sudo apt-get install rootstock. After installing Rootstock, again in ubuntu terminal,
​Enter,
3: sudo rootstock --fqdn ubuntu --login ubuntu --password ubuntu --imagesize 2G --notarball .
​You can change login and password to your desire and ​also change imagesize 1G 2G and soforth
Your ubuntu-arm.img will be created in about 15 min or so. Take that arm.img and use Ark to crush it down to under 200meg if you would like or and or change name to ubuntu.img.
Using file manager, Create a folder (on your phone) /sdcard/ubuntu
and transfer ubuntu.img to your sdcard folder, ubuntu.
Copy the following text including the (#) and paste into notepad++
(get it http://notepad-plus-plus.org/download) or in linux gedit or Eqvlnt.
Save as sdcard/ubuntu/bootubuntu (no extension)nothing more.
#modprobe ext2
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu
fi
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
mknod /dev/loop1 b 7 0
losetup /dev/block/loop1 /sdcard/ubuntu/ubuntu.img
mount -t ext2 /dev/block/loop1 /data/local/ubuntu
#mount -o loop,noatime -t ext2 $kit/ubuntu.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "READY TO ROCK AND ROLL BABY! "
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/loop1
AND DO THE SAME FOR THE NEXT 4 FILES AND NAME THEM CORRECTLY AND USE THE RIGHT TEXT EDITOR
This next file is called sdcard/ubuntu/unionfs (remember no file ext.)
busybox insmod unionfs
mount -t unionfs -o dirs=$mnt/etc=rw:/etc=ro unionfs /etc
mount -o remount,rw /
ln -s $mnt/lib /
for x in \
bin boot home media mnt \
opt selinux srv usr var
do
ln -s $mnt/$x /
done
rmdir /root
ln -s $mnt/root /
mount -o remount,ro /
mount -t unionfs -o dirs=$mnt/sbin=rw:/sbin=ro unionfs /sbin
mount -t unionfs -o dirs=$mnt/dev=rw:/dev=rw unionfs /dev
mount -t devpts devpts /dev/pts
This next file is called sdcard/ubuntu/fsrw (remember no file ext.)
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
echo "Filesytem remounted as read/write"
This next file is called sdcard/ubuntu/mountonly (remember no file ext.)
# Based on Saurik's remount.sh - modified by Mark Walker of http://www.androidfanatic.com
# Email [email protected]
modprobe ext2
clear
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/debian
export bin=/data/local/bin
export mnt=/data/local/mnt
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
busybox insmod ext2
clear
echo " "
mount -o loop,noatime $kit/debian.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
echo "Custom Linux IMG Mounter V1.0 - by Mark Walker"
echo "WEB: http://www.androidfanatic.com"
echo "EML: [email protected]"
sleep 1
echo "AutoMounter started"
sleep 1
echo "REBOOT PHONE TO PROPERLY DISMOUNT"
echo " "
# chroot $mnt /bin/bash
This next file is called sdcard/ubuntu/ubuntu.sh (this one has .sh for file ext)
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
modprobe ext2
clear
rm -f /data/local/bin/fsrw
rm -f /data/local/bin/bootubuntu
rm -f /data/local/bin/unionfs
rm -f /data/local/bin/installer.sh
rm -f /data/local/bin/mountonly
mkdir /data/local/mnt
clear
rm /system/bin/fsrw
rm /system/bin/bootubuntu
rm /system/bin/unionfs
rm -/system/bin/mountonly
cp -f fsrw /system/bin
cp -f bootubuntu /system/bin
cp -f unionfs /system/bin
cp -f mountonly /system/bin
cd /sdcard/ubuntu
chmod 4777 *
cd /system/bin/
chmod 4777 *
cd /
clear
echo " "
echo "Ubuntu Chroot Bootloader v0.1"
echo "Ubuntu Bootloader is now installed!"
echo "This process does NOT damage Android OS!"
echo " "
echo "Original Installer by Charan Singh"
echo "Modified for Ubuntu Chroot by Max Lee at NexusOneHacks.net"
echo " "
echo "To enter the Debian Linux console just type 'bootubuntu'"
bootubuntu
After you have,
bootubuntu
fsrw
mountonly
unionfs
ubuntu.sh
ubuntu.img
in your /sdcard/ubuntu folder
Open adb shell
Enter:
su
cd /sdcard/ubuntu
sh ./ubuntu.sh
apt-get update
apt-get install tightvncserver
apt-get install lxde
export USER=root
vncserver :0 -geometry 1024x800
cat > front
export USER=root
cd /
rm -r -f /tmp
mkdir /tmp
cd /
vncserver :0 -geometry 1024x800
(cntrl D, cntrl D then Enter)
cat front /root/.bashrc > temp
cp temp /root/.bashrc
Get Android VNC for you phone (market)
open app
enter 5900 for port
enter password you setup for vncserver
set graphics for 24 bit
Connect
let the fun begin
Next update: How to network with Hamachi
It does work
ill give this a try tommorow..
Gonna, maybe, dive in.
Fire up an ubuntu image and then connect to it with vnc... I think I'll wait for the movie to come out and save the battery life. Hey wait, thats an idea. We could make a video of someone using ubuntu, and then play it on our phone so it feels like ubuntu. Might even do better on the battery life / "useful" factor.
(I've seen this method before, so keep in mind I am poking fun at the people who would want to do this and not you for sharing this with us.)
flexgrip said:
Fire up an ubuntu image and then connect to it with vnc... I think I'll wait for the movie to come out and save the battery life. Hey wait, thats an idea. We could make a video of someone using ubuntu, and then play it on our phone so it feels like ubuntu. Might even do better on the battery life / "useful" factor.
(I've seen this method before, so keep in mind I am poking fun at the people who would want to do this and not you for sharing this with us.)
Click to expand...
Click to collapse
What is your superior method?
I believe he's referring to the idea of running Ubuntu on a phone in general. I have trouble seeing the usefulness, but it's very interesting. Thanks for the post, OP.
Sent from my PC36100 using XDA App
TheMagicalSock said:
I believe he's referring to the idea of running Ubuntu on a phone in general. I have trouble seeing the usefulness, but it's very interesting. Thanks for the post, OP.
Sent from my PC36100 using XDA App
Click to expand...
Click to collapse
If that's the case, then I gave him too much credit. This is a fantastic How-To.
I put this to anyone:
UPDATE:
FIXED WILL POST FIX SOON (had to use MAKEDEV)
THIS IS GREAT YAHOOOO
Hi i was hoping you could help me with this problem:
I am using (on a dedicated ubuntu computer with Maverick edition)"https://wiki.ubuntu.com/ARM/RootfsFromScratch" example to create a qemu image using "sudo rootstock --fqdn ubuntu --login ubuntu --password ubuntu --seed nano --notarball --imagesize 3G".
I have also used the "sudo project-rootstock/rootstock --fqdn ubuntu --login ubuntu --password ubuntu --seed nano --notarball --imagesize 3G"
and: "sudo ./rootstock --fqdn ubuntu --login ubuntu --password ubuntu --seed nano --notarball --imagesize 3G" way.
They all work great. I am able to load the image with qemu, got ssh setup and working alls great in life.
The problem lies HERE.......
I am using these images (mostly for fun), to setup ubuntu onto my Evo and Epic smartphones using this method: "http://forum.xda-developers.com/showthread.php?t=881401" to chroot the image.
ITS AWSOME IT WORKS AND LOTS OF FUN!
well sorry for screaming but it really excites me this open source Ubuntu Stuff. (i am a win user, but I found a new toy)
Using the prebuilt image everything works excellent (except for the small image size 2G) that is why i need to use my 3G built image.
My problem: My built image works flawlessly as well, with one exception, (that i have noticed) is, inside ubuntu (on my phone chrooted with android) the terminals do not have a prompt# only black, square curser, and will not except input. I have to use the terminal program inside android to apt-get and such.
I have noticed with my build images, using apt-get during install, i see "Can not write log, openpty() failed (/dev/pts not mounted?)"
error. My reserch says terminals wont work if system cannot write to /dev/pts.
The prebuilt image does not have this issue.
What is the differance with the prebuilt that is offered here "wget -c http://w3.impa.br/~gabrield/data/ubuntu-arm-development-rootfs.tar.bz2", and the images I create using the steps outlined in the article.
Is there modifications prior to or after creation, or is this someting different altogether.
I really have been pulling the little bit of hair i have left out of my head for a week now
HELP.!!!
p.s. I have tried all builds etc; karmic,lucid same results
Try mounting dev/pts says it is mounted but busy
To Homefix :
Did you try "sudo apt-get install ..." ?
To change bash prompt did you try "export PS1=#" ?
What is an output of "id" command? If you get anything other than root, add that user to root group, or just "su" maybe?
Can someone please post some pics or a video of this working?
generalExpert said:
Can someone please post some pics or a video of this working?
Click to expand...
Click to collapse
Its the same as having Ubuntu on your desktop monitor only smaller
Wouldn't unity work better on a phone
Sent from my PC36100 using XDA App

[CM7] Remove files on boot and change LCD Density using init.d

Talk in the CM7 threads has revealed that many people remove apps from CM7 before flashing/after flashing/using an update zip. This thread has a quick and easy method to remove apps (and other things) from CM7 on boot using an init.d script.
This method requires s-off (as the system is mounted as rw) and requires a little knowledge of android, however I will produce a 1 time only flash zip if people need it.
The following script is used and I will explain it below and what to modify;
If using Windows, don't use Notepad. I suggest Notepad++
/system/etc/init.d/50rm
Code:
#!/system/bin/sh
#mount system rw
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system;
#apps to delete
#send installed apps to /data/packages
pm list packages -f > /data/packages
for i in CarHomeLauncher LiveWallpapers LiveWallpapersPicker Protips;
do
if [ -e /system/app/$i.apk ];
then
rm -f /system/app/$i.apk;
grep $i.apk /data/packages > /data/pname;
pname2=$(sed 's/\(.*=\)\(.*\)/\2/' /data/pname);
pm uninstall $pname2;
fi;
done;
rm -f /data/packages
rm -f /data/pname
#delete camera_click sound
if [ -e /system/media/audio/ui/camera_click.ogg ];
then
rm -f /system/media/audio/ui/camera_click.ogg;
fi;
#mount system ro
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system;
Save the script as /system/etc/init.d/50rm (adb push 50rm /system/etc/init.d/50rm) and change permissions to 750 (adb shell chmod 750 /system/etc/init.d/50rm).
Next, so that this script is kept through flashes of new CM7 versions, we add it to the custom_backup_list.txt found in /system/etc/ (if you don't have one, create one).
/system/etc/custom_backup_list.txt
Code:
etc/init.d/50rm
There are two situations to show how things can be deleted:
1)#apps to delete
The line to change here is the for i in ... line (10) where there is a list of app names to uninstall.
Change names to what you want to be deleted from /system/app. Do not include .apk in the name.
2)#delete camera click sound
This is an example of how to delete other files that are wanted to be deleted. As an example, I have put the camera click sound. The full directory of the file will be needed.
What the script does:
The script will check if these files are there and then delete them. With the system apps, I have put in a script that should uninstall the files using the package manager (which I think is working, but am currently testing it because I'm not sure package manager can be run whilst booting, but post-boot my pm list packages -f reveals none of the packages)
Requests:
If anyone has a better, more efficient way of using the pm to uninstall the apps, please mention it. I am a novice when it comes to shell scripting and can only go by what I have done so far.
Changelog:
25/04/2011 - initial release
26/04/2011 - changed some strings
Script - http://bit.ly/golKIb (right click - save link as - check there is no file extension) - adb push 50rm /system/etc/init.d/50rm; adb shell chmod 750 /system/etc/init.d/50rm
How to use the custom_backup_list.txt in more ways - (by freerunner @ CM Forums)
Any problems, post here or add me to gtalk
subscribed, thanks mate.
i'll look into this when i get the time
Could anyone write a procedure that checks /system/build.prop, finds the line "ro.sf.lcd_density=240" and swapps it for "ro.sf.lcd_density=210"?
JDima said:
Could anyone write a procedure that checks /system/build.prop, finds the line "ro.sf.lcd_density=240" and swapps it for "ro.sf.lcd_density=210"?
Click to expand...
Click to collapse
Already done that. Once again, its not the cleanest way of doing things, but its as much as I know.
Change LCD Density on Boot
Code:
#!/system/bin/sh
#change lcd_density and reboot if new install
density=$(grep ro.sf.lcd_density=240 /system/build.prop);
if [ $density = "ro.sf.lcd_density=240" ];
then
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system;
sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=210/g' /system/build.prop;
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system;
reboot;
fi;
What the script does:
Checks the LCD Density and if it is 240, it will change it to 210 (or whatever value people want by changing ro.sf.lcd_density=210 to the denisty they want). It then reboots immediately (whilst still on splash screen) so that the new density is loaded when you boot the phone.
Why is this needed when there are apps on the market?:
Many of the apps on the market need to be re-run on new rom flashes or are not permanent. This can be made permanent by adding to the custom_backup_list.txt and will be done every new flash in CM7.
Is this way better than deleting apps/sounds before flashing, or is it just alternative?
Personally I find it more easy to delete apps and other stuff via adb when the rom is instaled.
expl0de said:
Is this way better than deleting apps/sounds before flashing, or is it just alternative?
Personally I find it more easy to delete apps and other stuff via adb when the rom is instaled.
Click to expand...
Click to collapse
Its an alternative way that does it for you. All you have to do is put the script on your phone, add it to the custom_backup_list.txt and let the script work for you.
iinga, thanks!
Why? Because https://market.android.com/details?id=lv.n3o.lcddensity (for example) doesn't seem to work after reboot, and it has slightly different behavior (check out the keyboard for instance). The build.prop method is the "cleanest" one.
JDima said:
iinga, thanks!
Why? Because https://market.android.com/details?id=lv.n3o.lcddensity (for example) doesn't seem to work after reboot, and it has slightly different behavior (check out the keyboard for instance). The build.prop method is the "cleanest" one.
Click to expand...
Click to collapse
Agreed, which is why I wrote that script in the first place
Problem. The script does exactly nothing.
Code:
--------- beginning of /dev/log/main
I/cm ( 79): Welcome to Android 2.3.3 / CyanogenMod-7.0.2.1-Desire
I/cm ( 80): _
I/cm ( 81): __ __ _ ___ _ _ __ ___ __ _ _ _ _ __ __))
I/cm ( 82): ((_ \(/'((_( ((\( ((_)((_( (('((\( ((`1( ((_)((_(
I/cm ( 83): )) _))
I/cm ( 84):
I/mountsd ( 98): Checking filesystems..
I//system/xbin/run-parts( 74): e2fsck 1.41.10 (10-Feb-2009)
I//system/xbin/run-parts( 74): /dev/block/mmcblk0p2: recovering journal
I//system/xbin/run-parts( 74): /dev/block/mmcblk0p2: clean, 133/438272 files, 260021/875449 blocks
I/logwrapper( 104): busybox terminated by exit(0)
I/logwrapper( 109): busybox terminated by exit(0)
I/logwrapper( 111): busybox terminated by exit(0)
I/mountsd ( 113): /sd-ext successfully mounted
I/busybox ( 127): S2E: Initialization...
I/busybox ( 127): S2E: /sd-ext/app mount as /data/app
I/busybox ( 127): S2E: /sd-ext/app-private mount as /data/app-private
I/busybox ( 127): S2E: /sd-ext/download mount as /cache/download
I/busybox ( 127): S2E: Done!
I/logwrapper( 127): busybox terminated by exit(0)
[B]I//system/xbin/run-parts( 74): run-parts: /system/etc/init.d/50rm exited with code 111[/B]
I/logwrapper( 74): /system/xbin/run-parts terminated by exit(1)
The permissions are correct.
Here's my 50rm:
Code:
#!/system/bin/sh
#mount system rw
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system;
if [ -e /system/media/audio/ui/camera_click.ogg ];
then
rm -f /system/media/audio/ui/camera_click.ogg;
fi;
#change lcd_density and reboot if new install
density=$(grep ro.sf.lcd_density=240 /system/build.prop);
if [ $density = "ro.sf.lcd_density=240" ];
then
sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=210/g' /system/build.prop;
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system;
reboot;
fi;
#mount system ro
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system;
JDima said:
Code:
#!/system/bin/sh
#mount system rw
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system;
if [ -e /system/media/audio/ui/camera_click.ogg ];
then
rm -f /system/media/audio/ui/camera_click.ogg;
fi;
#change lcd_density and reboot if new install
density=$(grep ro.sf.lcd_density=240 /system/build.prop);
if [ $density = "ro.sf.lcd_density=240" ];
then
sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=210/g' /system/build.prop;
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system;
reboot;
fi;
#mount system ro
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system;
Click to expand...
Click to collapse
Try removing the "mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system;" in the lcd density if section (before reboot).
iinga said:
Try removing the "mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system;" in the lcd density if section (before reboot).
Click to expand...
Click to collapse
Predictably, it didn't help.
No way would mounting /system as RO be performed twice - because the script terminates after any of them one way or another.
JDima said:
Predictably, it didn't help.
No way would mounting /system as RO be performed twice - because the script terminates after any of them one way or another.
Click to expand...
Click to collapse
I know it wouldn't perform twice, however I was wondering why it fails to run the script.
It has been working for me, but now trying to work out what is different is difficult.
iinga said:
It has been working for me, but now trying to work out what is different is difficult.
Click to expand...
Click to collapse
Could you post the whole script you're using yourself (if it includes changing density)?
JDima said:
Could you post the whole script you're using yourself (if it includes changing density)?
Click to expand...
Click to collapse
Code:
#!/system/bin/sh
#mount system rw
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system;
#change lcd_density and reboot if new install
density=$(grep ro.sf.lcd_density=240 /system/build.prop);
if [ $density = "ro.sf.lcd_density=240" ];
then
sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=220/g' /system/build.prop;
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system;
reboot;
fi;
#apps to delete
pm list packages -f > /system/packages
for i in CarHomeLauncher LiveWallpapers LiveWallpapersPicker Protips DSPManager GenieWidget FileManager;
do
if [ -e /system/app/$i.apk ];
then
rm -f /system/app/$i.apk;
grep $i.apk /system/packages > /system/pname;
pname2=$(sed 's/\(.*=\)\(.*\)/\2/' /system/pname);
pm uninstall $pname2;
fi;
done;
rm /system/packages;
rm /system/pname;
#delete camera_click sound
if [ -e /system/media/audio/ui/camera_click.ogg ];
then
rm -f /system/media/audio/ui/camera_click.ogg;
fi;
#mount system ro
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system;
http://www.iinga.net/desire/50rmlcd
Nope. Same thing with your script. I even tried granting the script maximum permissions - useless.
Can anyone else verify the script actually works?
JDima said:
Nope. Same thing with your script. I even tried granting the script maximum permissions - useless.
Can anyone else verify the script actually works?
Click to expand...
Click to collapse
Are you s-off?
iinga said:
Are you s-off?
Click to expand...
Click to collapse
Off course
A detailed reproduction of my steps:
1) Place 50rm into /system/etc/init.d via Root Explorer (shouldn't make any difference)
2) Change permissions on 50rm.
3) Doublecheck the permissions.
4) Create and configure custom_backup_list.txt
5) Reflash the same ROM (I'm using custom MTD - however, that also shouldn't change anything)
6) Verify visually that the script didn't work.
7) Verify that 50rm is in place with correct permissions.
8) Reboot and adb logcat...
JDima said:
Off course
A detailed reproduction of my steps:
1) Place 50rm into /system/etc/init.d via Root Explorer (shouldn't make any difference)
2) Change permissions on 50rm.
3) Doublecheck the permissions.
4) Create and configure custom_backup_list.txt
5) Reflash the same ROM (I'm using custom MTD - however, that also shouldn't change anything)
6) Verify visually that the script didn't work.
7) Verify that 50rm is in place with correct permissions.
8) Reboot and adb logcat...
Click to expand...
Click to collapse
I just did step 5 and my phone goes to splash screen, reboots from splash screen, fully boots in density 220.
Code:
adb shell grep ro.sf.lcd_density /system/build.prop
ro.sf.lcd_density=220
How did you create your script? When I just created it using notepad for windows, I get the Exit Code 111 and no LCD Density change.
Creating with notepad ++, script runs fine and LCD density gets changed correctly.
iinga said:
How did you create your script? When I just created it using notepad for windows, I get the Exit Code 111 and no LCD Density change.
Creating with notepad ++, script runs fine and LCD density gets changed correctly.
Click to expand...
Click to collapse
Dammit...
Thanks, mate, it worked

[Q] [19003]crating symbolic link help

hi to all mod
here is code
$ su
su
# su mv /sdcard/gameloft /sdcard/external_sd/gameloft
su mv /sdcard/gameloft /sdcard/external_sd/gameloft
Permission denied
# su 1n -s /sdcard/external_sd/gameloft /sdcard/gameloft
su 1n -s /sdcard/external_sd/gameloft /sdcard/gameloft
Permission denied
#
pls help me(or)crate stuf like folder mapping tool
thank you
if you have to move directory i think that you have to do: mv -v -t source dest
cause -t is used for specified that you want move a dir and -v to show what the command are doing....
for the ln command use this format: ln -s /my/existing/directory thisismylink
...and i see that you wrote "1n" and not "ln" but maybe is a paste error
Bye

Entware (Optware replacement) for android

I want to introduce a new android project - Entware. It can be considered as an Optware replacement.
Entware (arm version for cortex-a9 or higher) was first done for routers
_cannot post url ((((
Later it was tested on NASes
_cannot post url ((((
It is based on another project Qnapware, that is based on Entware (mipsel version).
Today I've tested Entware.arm on android (routed RK3188 TV stick) and it works.
I'm rather new to android. So my instuctions given below may not always be correct. I was installing Entware.arm connecting to android host using SshDroid.
1. I need a writeble /opt folder. I've done the following
Code:
/system/bin/mount -o rw,remount /
mkdir /opt
/system/bin/mount -o ro,remount /
I have a ext2 formated external sd card (symlinks are needed). I have made a directory and mount binded it to opt
Code:
mkdir /mnt/external_sd/entware.arm
mount -o bind /mnt/external_sd/entware.arm /opt
I do not know why android does not have shell in /bin
So let's make one
Code:
/system/bin/mount -o rw,remount /
mkdir /bin
ln -s /system/bin/sh /bin/sh
/system/bin/mount -o ro,remount /
Now I'll need a local root profile with the content to execute global Entware profile:
Code:
[email protected]:/data/data/berserker.android.apps.sshdroid/home # pwd
/data/data/berserker.android.apps.sshdroid/home
[email protected]:/data/data/berserker.android.apps.sshdroid/home # cat .profile
#!/system/bin/sh
. /opt/etc/profile
The preparation is finished. Now let install Entware
Code:
wget h__p_//qnapware.zyxmon.org/binaries-armv7/installer/entware_install_arm.sh
chmod +x ./entware_install_arm.sh
./entware_install_arm.sh
After the installation - logout and login again (to execute /opt/etc/profile) and install packages
Code:
opkg install mc
If something in my instructions does not fit android philosophy - please inform me.
Addition:
To make Entware changes permanent we needs startup script. Something like
Code:
#!/system/bin/sh
sleep 3
/system/bin/mount -o rw,remount /
sleep 1
/system/bin/chmod 777 /mnt/external_sd
/system/bin/mkdir /opt
/system/bin/mkdir /bin
ln -s /system/bin/sh /bin/sh
/system/bin/mount -o ro,remount /
sleep 3
/system/bin/mount -t ext2 -o rw /dev/block/mmcblk0p1 /mnt/external_sd
/system/bin/mount -o bind /mnt/external_sd/entware.arm /opt
sleep 2
/opt/etc/init.d/rc.unslung start
This script creates /bin /opt folders creates symlink /bin/sh, binds /opt to Entware folder location and starts Entware services.
zyxmon said:
I want to introduce a new android project - Entware. It can be considered as an Optware replacement.
Entware (arm version for cortex-a9 or higher) was first done for routers
_cannot post url ((((
Later it was tested on NASes
_cannot post url ((((
It is based on another project Qnapware, that is based on Entware (mipsel version).
Today I've tested Entware.arm on android (routed RK3188 TV stick) and it works.
I'm rather new to android. So my instuctions given below may not always be correct. I was installing Entware.arm connecting to android host using SshDroid.
1. I need a writeble /opt folder. I've done the following
Code:
/system/bin/mount -o rw,remount /
mkdir /opt
/system/bin/mount -o ro,remount /
I have and ext2 formated external sd card (symlinks are needed). I have made a directory and moun binded it to opt
Code:
mkdir /mnt/external_sd/entware.arm
mount -o bind /mnt/external_sd/entware.arm /opt
I do not know why android does not have shell in /bin
So let's make one
Code:
/system/bin/mount -o rw,remount /
mkdir /bin
ln -s /system/bin/sh /bin/sh
/system/bin/mount -o ro,remount /
Now I'll need a local root profile with the content to execute gloabal Entware profile:
Code:
[email protected]:/data/data/berserker.android.apps.sshdroid/home # pwd
/data/data/berserker.android.apps.sshdroid/home
[email protected]:/data/data/berserker.android.apps.sshdroid/home # cat .profile
#!/system/bin/sh
. /opt/etc/profile
The preparation is finished. Now install Entware
Code:
wget h__p_//qnapware.zyxmon.org/binaries-armv7/installer/entware_install_arm.sh
chmod +x ./entware_install_arm.sh
./entware_install_arm.sh
After the installation - logout and login again (to execute /opt/etc/profile) and install packages
Code:
opkg install mc
If something in my instructions does not fit android philosophy - please inform me.
Addition:
To make Entware changes permanent on needs sturtup script. Something like
Code:
#!/system/bin/sh
sleep 3
/system/bin/mount -o rw,remount /
sleep 1
/system/bin/chmod 777 /mnt/external_sd
/system/bin/mkdir /opt
/system/bin/mkdir /bin
ln -s /system/bin/sh /bin/sh
/system/bin/mount -o ro,remount /
sleep 3
/system/bin/mount -t ext2 -o rw /dev/block/mmcblk0p1 /mnt/external_sd
/system/bin/mount -o bind /mnt/external_sd/entware.arm /opt
sleep 2
/opt/etc/init.d/rc.unslung start
This script creates /bin /opt folders creates symlink /bin/sh, binds /opt to Entware folder location and starts Entware services.
Click to expand...
Click to collapse
Interesting.
Is this for smart phones???
GokulNC said:
Interesting.
Is this for smart phones???
Click to expand...
Click to collapse
Entware will work on armv7l/cortex-a9 or compatible CPU. It does not matter, weather it is smart phone, tablet, router or NAS.
Working well on this end, except for the fact that it has no concept of Android users and groups. For example, ls -l from busybox returns things like user "1000" group "1000", and bash with a PS1 including \u returns "I have no name!". Thoughts?

Edit files in /sys folder

device: Galaxy S7 Exynos, systemless SuperSu, CF-Autoroot, Nougat 7.0
Hi,
I've tried a lot of things now, but I'am failing at editing a file in android /sys folder. I want to change a variable for battery charging in /sys/class/power_supply/battery/batt_tune_float_voltage. In a terminal I've performed following
Code:
1|herolte:/sys/class/power_supply/battery # cat batt_tune_float_voltage
43500
herolte:/sys/class/power_supply/battery # chmod 777 batt_tune_float_voltage
herolte:/sys/class/power_supply/battery # echo 42000 > batt_tune_float_voltage
1|herolte:/sys/class/power_supply/battery # cat batt_tune_float_voltage
43500
I even cannot mount battery_tune_float_voltage
Code:
1|herolte:/sys/class/power_supply/battery # mount -o rw,remount /sys
herolte:/sys/class/power_supply/battery # mount -o rw,remount batt_tune_float_voltage
mount: 'batt_tune_float_voltage' not in /proc/mounts
Does anyone know what the problem here is?! I would be really glad if someone could explain me if i've missed something or why this does not work.
Anyway: As I'am understanding so far, the App Battery Charge Limit here on xda uses following code for editing file /sys/class/power_supply/battery/batt_slate_mode
Code Link
Code:
val switchCommands = arrayOf("mount -o rw,remount $file", "echo \"$newState\" > $file")
if (alwaysWrite) {
suShell.addCommand(switchCommands)
} else {
suShell.addCommand("cat $file", 0) { _, _, output ->
if (output[0] != newState) {
setChangePending()
suShell.addCommand(switchCommands)
}
}
}
}

Categories

Resources