[Q] Problem mounting partition through a script - Android Q&A, Help & Troubleshooting

Hello everybody.
First, I have searched a lot and I haven't found any solution of my problem, but sorry if this is already answered and I didn't found it.
I own a Meizu MX4 running 4.4.2 with FlymeOS with locked bootloader and a recovery that only allows to install official roms.
So I am making a big Mod that is flasheable through FlashGordon, but now I'm facing a problem and I don´t know to solve.
In the main updater_script I want to run other script that erase some files in this path:
/custom/3rd-party
So I have to mount RW the path /custom
I have tried this comands, and I have executed throught a terminal and always says: rm failed for /custom/3rd-party, Read only file system.
Code:
#!/system/bin/sh
mount -o remount,rw /custom
rm -rf /custom/3rd-party
#
Code:
#!/system/bin/sh
busybox mount -0 remount,rw /custom
rm -rf /custom/3rd-party
#
Code:
#!/system/bin/sh
mount ext4 /dev/block/platform/mtk-msdc.0/by-name/custom /custom relatime rw wait commit=1,noauto_da_alloc
rm -rf /custom/3rd-party
#
Code:
#!/system/bin/sh
mount -o remount,rw -t ext4/dev/block/platform/mtk-msdc.0/by-name/custom
rm -rf /custom/3rd-party
#
Sorry for my english
What do you think?
Thanks in advance :good:

Related

[DEV] Universal Chargemon

Owain suprise !
Code:
#!/system/bin/busybox sh
#
# Universal Chargemon By D4rKn3sSyS
V1=`cat /system/build.prop | grep 'ro.custommodinstalled=1'`
echo "$V1" > /system/rom.bin
if [ -s /system/rom.bin ]; then
#for cyanogenmod
/system/bin/charger
cat /dev/input/event0 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
# nobodyAtall - Fix
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
sync
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
# Mount /system to /minicm/system
/sbin/mount_system
sleep 1
chroot /minicm /init
else
#for stock
cat /dev/input/event0 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck ]
then
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
chroot / /init
fi
# Continue booting
exit
fi
But, something it's wrong, please someone help me, it starts and all that things, but then, deletes /data. I dont understand really good this file, so maybe someone can help me end this
Cheers, D4.
Perhaps its this line in the file?
Code:
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
[B] rmdir /system /data /cache /mnt[/B]
ruifung said:
Perhaps its this line in the file?
Code:
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
[B] rmdir /system /data /cache /mnt[/B]
Click to expand...
Click to collapse
That was my first idea but see this
Code:
# Mount /system to /minicm/system
/sbin/mount_system
sleep 1
chroot /minicm /init
All is moved first to /minicm, and anyway, on original chargemon, that lines are used.
by delete /data do you mean remove the /data folder or deleting everything inside? Cause they aint many refrences to /data in that script...
Edit: you are chrooting to /minicm? since all folders in the rootfs is gone after a reboot, don't you need to create the /data mount point?
D4rKn3sSyS said:
That was my first idea but see this
Code:
# Mount /system to /minicm/system
/sbin/mount_system
sleep 1
chroot /minicm /init
All is moved first to /minicm, and anyway, on original chargemon, that lines are used.
Click to expand...
Click to collapse
chroot makes /minicm appear as /
that means mount your data to /minicm/data
ruifung said:
by delete /data do you mean remove the /data folder or deleting everything inside? Cause they aint many refrences to /data in that script...
Click to expand...
Click to collapse
That should delete data and everything inside, but you know, it's weird cause with original chargemon nothing happens ...
slade87 said:
chroot makes /minicm appear as /
Click to expand...
Click to collapse
So, what's the problem with that script, it's the rmdir thing?
the rmdir should not effect the /data as the chroot is after the rmdir but all changes to the root filesystem is lost on reboot right? in that case, wouldn't you need to create data under /minicm?
ruifung said:
the rmdir should not effect the /data as the chroot is after the rmdir but all changes to the root filesystem is lost on reboot right? in that case, wouldn't you need to create data under /minicm?
Click to expand...
Click to collapse
in fact rmdir is after chroot, that's why I dont understand, I think it was bad, but it's original CM6 chargemon
Code:
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
# Mount /system to /minicm/system
/sbin/mount_system
sleep 1
chroot /minicm /init
i don't know where slade put the xrecovery but in my cm7 rom it is in /recovery
instead of in /system/bin
this way the user can update busybox if slade got it in /recovery an universal chargemon cannot be made!
OR!
he need to move it in CM6 also to /recovery
also why do you want an universal chargemon?
owain94 said:
i don't know where slade put the xrecovery but in my cm7 rom it is in /recovery
instead of in /system/bin
this way the user can update busybox if slade got it in /recovery an universal chargemon cannot be made!
OR!
he need to move it in CM6 also to /recovery
also why do you want an universal chargemon?
Click to expand...
Click to collapse
Universal xRecovery apk installer , and yes, my installer will install it on /system/bin/xrecovery.tar, or maybe we can move it on all roms ?, even on stock
PD: Report on your msn owain!
getting a little confused, the first chroot is "chroot / /init"
followed by "chroot /minicm /init" somewhere in the middle
and finally at the end of the file "chroot / /init"
getting confused, chrooting to /minicm and then chrooting back to /
D4rKn3sSyS said:
Universal xRecovery apk installer , and yes, my installer will install it on /system/bin/xrecovery.tar, or maybe we can move it on all roms ?, even on stock
PD: Report on your msn owain!
Click to expand...
Click to collapse
you only need xrecovery installer on stock??
custom roms got it preinstalled
PD: not at home
owain94 said:
you only need xrecovery installer on stock??
custom roms got it preinstalled
PD: not at home
Click to expand...
Click to collapse
Not my xRecovery skin , anyway, what's wrong ?
BTW: Slade's cm6 recovery its on /system/bin
EDIT: I Think problem it's that chargemon execute first cm chargemon, and then stock... and that ****s the device, so problem should be @ more external if, do you guys see some syntax error ?
you would need to mount rw before you can do this
Code:
echo "$V1" > /system/rom.bin
slade87 said:
you would need to mount rw before you can do this
Code:
echo "$V1" > /system/rom.bin
Click to expand...
Click to collapse
Right, forgot that, allways will use stock chargemon
Edit: Yeah was that, thanks slade, now im gonna test on stock
D4rKn3sSyS said:
Right, forgot that, allways will use stock chargemon
Edit: Yeah was that, thanks slade, now im gonna test on stock
Click to expand...
Click to collapse
also check you if else,
maybe its easier to divide into 4 if statements then use the if-else tree structure
Code:
#!/system/bin/busybox sh
#
# Universal Chargemon By D4rKn3sSyS
V6=`cat /system/build.prop | grep 'ro.build.version.release=2.2.1'`
echo "$V6" > /system/romcm6.bin
V7=`cat /system/build.prop | grep 'ro.build.version.release=2.3.3'`
echo "$V7" > /system/romcm7.bin
if [ -e /data/local/tmp/sdcardOS1 ]
then
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/sdcardos1-ramdisk.tar
# unmounting
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
# mount sd
dosfsck -y /dev/block/mmcblk0p1
sleep 5
mount -t vfat -o rw,noatime,nodiratime /dev/block/mmcblk0p1 /sd
sleep5
# mount ext2 images
losetup /dev/block/loop1 /sd/dualboot/system1.img
sleep 5
losetup /dev/block/loop2 /sd/dualboot/data1.img
sleep 5
losetup /dev/block/loop3 /sd/dualboot/cache1.img
sleep 5
e2fsck -y /dev/block/loop1
e2fsck -y /dev/block/loop2
e2fsck -y /dev/block/loop3
mount -t ext2 -o rw,noatime,nodiratime /dev/block/loop1 /system
sleep 5
mount -t ext2 -o rw,noatime,nodiratime,nosuid,nodev /dev/block/loop2 /data
sleep 5
mount -t ext2 -o rw,noatime,nodiratime,nosuid,nodev /dev/block/loop3 /cache
exit
fi
# chroot
chroot / /init
# skip rest
exit
if [ -s /system/romcm6.bin ]; then
#for cyanogenmod
cat /dev/input/event0 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
/system/bin/charger
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
# nobodyAtall - Fix
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
sync
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
# Mount /system to /minicm/system
/sbin/mount_system
sleep 1
chroot /minicm /init
exit
if [ -s /system/romcm7.bin ]; then
cat /dev/input/event0 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
/system/bin/charger
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
# nobodyAtall - Fix
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
sync
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
# Mount /system to /minicm/system
/sbin/mount_system
sleep 1
chroot /minicm /init
exit
else
#for stock
cat /dev/input/event0 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck ]
then
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
chroot / /init
fi
/system/bin/charger
# Continue booting
exit
fi
debug it first thisis from my mobile phone so im almost sure i did a couple things wrong
slade87 said:
also check you if else,
maybe its easier to divide into 4 if statements then use the if-else tree structure
Click to expand...
Click to collapse
Why 4 if statements ?, only needed 2, 1 for stock, 1 for any Cm, i think three structure it's the best idea
owain94 said:
Code:
#!/system/bin/busybox sh
#
# Universal Chargemon By D4rKn3sSyS
V6=`cat /system/build.prop | grep 'ro.build.version.release=2.2.1'`
echo "$V6" > /system/romcm6.bin
V7=`cat /system/build.prop | grep 'ro.build.version.release=2.3.3'`
echo "$V7" > /system/romcm7.bin
if [ -e /data/local/tmp/sdcardOS1 ]
then
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/sdcardos1-ramdisk.tar
# unmounting
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
# mount sd
dosfsck -y /dev/block/mmcblk0p1
sleep 5
mount -t vfat -o rw,noatime,nodiratime /dev/block/mmcblk0p1 /sd
sleep5
# mount ext2 images
losetup /dev/block/loop1 /sd/dualboot/system1.img
sleep 5
losetup /dev/block/loop2 /sd/dualboot/data1.img
sleep 5
losetup /dev/block/loop3 /sd/dualboot/cache1.img
sleep 5
e2fsck -y /dev/block/loop1
e2fsck -y /dev/block/loop2
e2fsck -y /dev/block/loop3
mount -t ext2 -o rw,noatime,nodiratime /dev/block/loop1 /system
sleep 5
mount -t ext2 -o rw,noatime,nodiratime,nosuid,nodev /dev/block/loop2 /data
sleep 5
mount -t ext2 -o rw,noatime,nodiratime,nosuid,nodev /dev/block/loop3 /cache
exit
fi
# chroot
chroot / /init
# skip rest
exit
if [ -s /system/romcm6.bin ]; then
#for cyanogenmod
cat /dev/input/event0 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
/system/bin/charger
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
# nobodyAtall - Fix
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
sync
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
# Mount /system to /minicm/system
/sbin/mount_system
sleep 1
chroot /minicm /init
exit
if [ -s /system/romcm7.bin ]; then
cat /dev/input/event0 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
# nobodyAtall - Fix
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
sync
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
# Mount /system to /minicm/system
/sbin/mount_system
sleep 1
chroot /minicm /init
exit
else
#for stock
cat /dev/input/event0 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck ]
then
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
chroot / /init
fi
# Continue booting
exit
fi
debug it first thisis from my mobile phone so im almost sure i did a couple things wrong
Click to expand...
Click to collapse
looks good owain, but why are you running fsck? it usually don't mount without force option if fs is corrupt.
D4rKn3sSyS said:
Why 4 if statements ?, only needed 2, 1 for stock, 1 for any Cm, i think three structure it's the best idea
Click to expand...
Click to collapse
sorry my bad

[Q] Simple File Copy Script

Hello everyone, I'm trying to figure out how to write a script to copy three .mp3 files from three different locations all to /system/media/audio/ringtones. So far, I'm in a bit over my head and I was wondering if anyone here could help me please?
Thanks in advance!
Mac of York said:
Hello everyone, I'm trying to figure out how to write a script to copy three .mp3 files from three different locations all to /system/media/audio/ringtones. So far, I'm in a bit over my head and I was wondering if anyone here could help me please?
Thanks in advance!
Click to expand...
Click to collapse
Well bud, honestly, it's not even worth all the writing it would take to compile a script for such an easy task via and file explorer that supports root functions. Simply copy n paste all into one folder, mount your /system -r/w and then the good ol multi-select button, copy to clipboard, browse up to /system/media/ringtones or /system/audio (whichever your phone model stores your system sounds/ui crap in), then after pasted to destination folder simply remount -r/o, reboot phone, voila!
jtmarich1985 said:
Well bud, honestly, it's not even worth all the writing it would take to compile a script for such an easy task via and file explorer that supports root functions. Simply copy n paste all into one folder, mount your /system -r/w and then the good ol multi-select button, copy to clipboard, browse up to /system/media/ringtones or /system/audio (whichever your phone model stores your system sounds/ui crap in), then after pasted to destination folder simply remount -r/o, reboot phone, voila!
Click to expand...
Click to collapse
Haha, thanks -- that's what I usually do but if it's too complicated it's not worth it.
Open a new text file, and write this:
Code:
#!/system/bin/sh
mount -o rw,remount /system
cp location1/file.mp3 /system/media/audio/ringtones/file.mp3
cp location2/file2.mp3 /system/media/audio/ringtones/file2.mp3
cp location3/file3.mp3 /system/media/audio/ringtones/file3.mp3
mount -o ro,remount /system
Save it (the extension doesn't matter) and that's it. You can run it using script manager, or the terminal emulator (in this case you need to get root permissions first, using the su command).
Also you can add some messages (to get a nicer script, you know ), this way:
Code:
#!/system/bin/sh
echo "Mounting /system as RW..."
mount -o rw,remount /system
echo "Copying files..."
cp location1/file.mp3 /system/media/audio/ringtones/file.mp3
cp location2/file2.mp3 /system/media/audio/ringtones/file2.mp3
cp location3/file3.mp3 /system/media/audio/ringtones/file3.mp3
echo "Done. Mounting /system as RO again..."
mount -o ro,remount /system
echo "All done. Have a nice day =)"
Please be careful while using scripts, otherwise you'll brick some devices :silly:
RoberGalarga said:
Open a new text file, and write this:
Code:
#!/system/bin/sh
mount -o rw,remount /system
cp location1/file.mp3 /system/media/audio/ringtones/file.mp3
cp location2/file2.mp3 /system/media/audio/ringtones/file2.mp3
cp location3/file3.mp3 /system/media/audio/ringtones/file3.mp3
mount -o ro,remount /system
Save it (the extension doesn't matter) and that's it. You can run it using script manager, or the terminal emulator (in this case you need to get root permissions first, using the su command).
Also you can add some messages (to get a nicer script, you know ), this way:
Code:
#!/system/bin/sh
echo "Mounting /system as RW..."
mount -o rw,remount /system
echo "Copying files..."
cp location1/file.mp3 /system/media/audio/ringtones/file.mp3
cp location2/file2.mp3 /system/media/audio/ringtones/file2.mp3
cp location3/file3.mp3 /system/media/audio/ringtones/file3.mp3
echo "Done. Mounting /system as RO again..."
mount -o ro,remount /system
echo "All done. Have a nice day =)"
Please be careful while using scripts, otherwise you'll brick some devices :silly:
Click to expand...
Click to collapse
Awesome, thanks. I'd give you a thanks but I'm all thanked out today.
RoberGalarga said:
Open a new text file, and write this:
Code:
#!/system/bin/sh
mount -o rw,remount /system
cp location1/file.mp3 /system/media/audio/ringtones/file.mp3
cp location2/file2.mp3 /system/media/audio/ringtones/file2.mp3
cp location3/file3.mp3 /system/media/audio/ringtones/file3.mp3
mount -o ro,remount /system
Save it (the extension doesn't matter) and that's it. You can run it using script manager, or the terminal emulator (in this case you need to get root permissions first, using the su command).
Also you can add some messages (to get a nicer script, you know ), this way:
Code:
#!/system/bin/sh
echo "Mounting /system as RW..."
mount -o rw,remount /system
echo "Copying files..."
cp location1/file.mp3 /system/media/audio/ringtones/file.mp3
cp location2/file2.mp3 /system/media/audio/ringtones/file2.mp3
cp location3/file3.mp3 /system/media/audio/ringtones/file3.mp3
echo "Done. Mounting /system as RO again..."
mount -o ro,remount /system
echo "All done. Have a nice day =)"
Please be careful while using scripts, otherwise you'll brick some devices :silly:
Click to expand...
Click to collapse
This is exactly what I wanted and it works beautifully! Thank you so much!
If I put script like thisone (classic copy-paste) in /system/etc/init.d, is it possible to configure that runing on ewery boot? And how?
Thanks.
Haven't tried this yet for fear of bricking, can someone help to see it this will work? I'm just trying to have a script to be placed on the homescreen so I can easily disable/enable the mediascanner/screenshot function. By the way, cp copies files, and cp -r actually moves (cut-paste) files, right?
#!/system/bin/sh
echo "Mounting /system as RW..."
mount -o rw,remount /system
echo "Movingfiles..."
cp -r /system/prv-app/MediaProvider.apk /system/prv-app/newfolder/MediaProvider.apk
echo "Done. Mounting /system as RO again..."
mount -o ro,remount /system
#!/system/bin/sh
echo "Mounting /system as RW..."
mount -o rw,remount /system
echo "Moving files..."
cp -r /system/prv-app/newfolder/MediaProvider.apk /system/prv-app/MediaProvider.apk
echo "Done. Mounting /system as RO again..."
mount -o ro,remount /system
Is it possible to do the same but with a folder+ content and not just a file?
Best thought to testing scripts, would be to add an android emulator to your computer. The one I use is nox. Its great for testing scripts and a variety of other things as well. Nox is an android based application, made jjust like a phone. All the features and extensions that your normal everyday android has, this emulator has as well.

[DEV][PORT] Port CM9 for LockedBootloaders [W.I.P]

Hello guys, im working to boot any CM9 Rom in stock kernel with Bootloader Locked
The Fix, requires a number of changes in the Ramdizk, this Ramdizk is obtained through the kernel, the ramdizk is that the system starts.
This file consists of the following
Ramdizk .... obtained from the kernel
chargemon .... modified to start the ramdizk
charger ... for charging the phone
sh .... responsible for early in the phone
Chargemon
Code:
#!/system/xbin/sh
# Chargemon script for Xperia NEO by Xperiafan
# Boot to CWM
cat /dev/input/event2 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -e /cache/recovery/boot ]
then
rm /cache/recovery/boot
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount eMMCs
umount -l /dev/block/mmcblock0p10
umount -l /dev/block/mmcblock0p11
umount -l /dev/block/mmcblock0p12
# Mount recovery
cd /
rm -r /sbin /sdcard
rm -f etc init* uevent* default*
if [ -f /system/bin/recovery.tar ]
then
tar -xf /system/bin/recovery.tar
fi
# Umount /system
umount -l /dev/block/mmcblk0p10
# chroot
chroot / /init
fi
# Ramdizk
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount eMMCs
umount -l /dev/block/mmcblock0p10
umount -l /dev/block/mmcblock0p11
umount -l /dev/block/mmcblock0p12
# Mount ramdisk
cd /
rm -r /sbin /sdcard
rm -f etc init* uevent* default*
tar -xf /system/bin/ramdisk.tar
# Fix permissions
mount -o remount,rw rootfs /
umount -l /system
umount -l /data
umount -l /cache
umount -l /mnt/sdcard
umount -l /sdcard
rm -r /mnt/sdcard
mkdir /tmp
# chroot
chroot / /init
To use these files, you need to put them in the following path
Ramdizk system/bin
Chargemon system/bin
Charger system/bin
sh system/xbin
I have not got this phone, please appreciate your comments, you need to put these files on those routes the rom, and erase the file boot.img​
Downloads
Ramdizk Beta Here
Chargemon Done Here
Charger Done Here
SH Done Here
We need custom wifi modules, right?
Sent from my MT15i using xda app-developers app
Its nice that we'll be having CyanogenMod for locked bootloaders.
Keep up the good work dev!
Anyone having locked bl
Tried his efforts?
Sent from my MT11i using xda premium
I tried it, but i doesnt boot, just stuck at sony logo... I will try to manually extract the ramdisk from the latest get.cm and it seems we will have aosp roms on locked bootloader
Sent from my MT15i using xda app-developers app
I will try to make a build what at least boots succesfully
Sent from my MT15i using xda app-developers app
it would be nice if anyone try to make this work i realised that we have mtdblocks not mmcblocks ... lets see if i can get it to work
Im work in this.... But first im make a new ramdizk for xperia u and later for neo and others
Sent from my ST25i using xda app-developers app

Problem restore script

Hi, have problem with restore script. This script is for init.d. First boot with restore app and app data. Have problem with restore app data. If run script for restore app data then restore only from one tar.gz file, no from all. Where problem? Thanks
App restore:
#!/system/bin/sh
su
mount -o remount,rw /system
mount -o remount,rw /data
for filename in /system/app2/*.apk;
do
busybox install $filename /data/app;
done
busybox rm -rf /system/app2
busybox rm -rf /system/etc/init.d/90app​
App data restore:
#!/sbin/busybox sh
sleep 45
su
mount -o remount,rw /system
mount -o remount,rw /data
for filenamezip in /system/appdata/*.zip;
do
busybox chown -R root /data/data/${filenamezip%.zip}/*
busybox chmod -R 777 /data/data/${filenamezip%.zip}/*
busybox rm -rf /data/data/${filenamezip%.zip}
done
for izip in /system/appdata/*.zip;
do
busybox unzip -o $izip -d /;
done
for filenametar in /system/appdata/*.tar.gz;
do
busybox chown -R root /data/data/${filenametar%.tar.gz}/*
busybox chmod -R 777 /data/data/${filenametar%.tar.gz}/*
sleep 1
busybox rm -rf /data/data/${filenametar%.tar.gz}
done
for itar in /system/appdata/*.tar.gz;
do
busybox tar -xzf $itar -C /;
done
sleep 5
busybox rm -rf /system/appdata
busybox rm -rf /system/etc/init.d/95appdata
reboot​
For manual backup:
su
mount -o remount,rw /system
mount -o remount,rw /data
BACKUPDIR=/system/appdata
DATADIR=/data/data
echo
# create BACKUPDIR if necessary and modify ownership/permissions
if [ -d $BACKUPDIR ]; then
rm -rf $BACKUPDIR
mkdir $BACKUPDIR
else
mkdir $BACKUPDIR
fi
chown root $BACKUPDIR
chmod 777 $BACKUPDIR
# make
for name in $DATADIR/*; do
tar -cpvzf $BACKUPDIR/${name#/data/data/}.tar.gz $name
done;
# modify ownership/permissions of all archives
chown root $BACKUPDIR/*
chmod 777 $BACKUPDIR/*
echo​
Sorry my bad english
Any solution please?
Hi. Please help my with this problem.

Broken cache (17mb or less) fix script (samsung I9000)

Hi all,
I've been looking around to solve my /cache problem of it being only 17MB.
Found a temporary fix but that needed to be implemented or executed every boot up.
And since I am to lazy or stupid to remember that every boot I search for another solution ...
Combined a script from someone else with some stuf I found somewhere else...
Descriptions are in the code....
This code works on my samsung I9000 with Full Advance Rom final 6.0.1:good::good:
Code:
#!/system/bin/sh
# stratosk - 27/07/2011
# Modified by Dutchpatriot 26/06/2017
# Works on Full advance Rom with I9000
# Change params
# Check your partitions name /cache
# Need to be root via ADB or root via device
# with the command : mount
# This fix is only needed when /cache has arround 17mb!!!
# run this command as root in ADB shell as root
# To be able to execute this you need to change file system from read-only to rewritable
# as root exec this command: mount -o rw,remount /system
# Paste this text in a file called cachefix.sh
# command : vi cachefix.sh
# If you like me, and arn't that good with vi
# I will attach a cachefix.sh to this post as
# cachefix.txt rename it to cachefix.sh
# give the cachefix.sh the right permissions
# chmod 777 cachefix.sh
# Run this once!
# sh /LOCATION_OF_SCRIPT/cachefix.sh
# or
# ./LOCATION_OF_SCRIPT/cachefix.sh
#
# when ran once the /data/local
# and all went well has a
# cache.img file
# This is now mounted as /cache
# command to see or verfy: mount
# /cache is now as big as you made it under
# CREATE A FILE 500mb
# Every time you reboot the 99Tcachefix script in /etc/init.d/ will be executed!
#
# adb root
# adb shell
# remount / and /system writable
mount -o rw,remount /
mount -o rw,remount /system
# EDIT the right old cache partitio /dev/block/mtdblock3 to fit yours!!!
# Makes script in /etc/init.d named 99Tcachefix so it will be executed on boot
echo "#!/system/bin/sh \n umount /dev/block/mtdblock3 \n losetup /dev/block/loop7 /data/local/cache.img \n mount -t ext4 /dev/block/loop7 /cache \n chown system.cache /cache \n chmod 770 /cache" >> /system/etc/init.d/99Tcachefix
# assign the right permissions to be executed as root but not edited
#There is a very neat trick in every Linux which will allow you to do so. It is called the SetUI bit.
#Keep in mind that you will need to have the permissions locked down tight in this file for this to be secure.
#Make the file owned by root and group root:
#sudo chown root.root <my script>
#Now set the SetUID bit, make it executable for all and writable only by root:
#sudo chmod 4755 <my script>
# Keep in mind if this script will allow any input or editing of files, this will also be done as root.
# source https://askubuntu.com/questions/167847/how-to-run-bash-script-as-root-with-no-password
# Leave as is!
chown root.root /system/etc/init.d/99Tcachefix
chmod 4755 /system/etc/init.d/99Tcachefix
# Check if dir is there else Create Dir LEAVE AS IS
if [ -d "/data/local" ]; then
echo "directory /data/local already there!"
echo "Showing dir /data/local"
sleep 3
ls "/data/local"
sleep 2
else
# create dir
mkdir /data/local
echo "Directory /data/local created"
fi
# create a file 500mb (change if you like count=XXXXXX)
dd if=/dev/zero of=/data/local/cache.img bs=1024 count=500000
# create ext4 filesystem LEAVE AS IS!!
mke2fs -F -T ext4 /data/local/cache.img
# my cache partition is called /dev/block/mtdblock3 see whats yours is called and
# change this to yours!!!
umount /dev/block/mtdblock3
# mount LEAVE AS IS!!!
losetup /dev/block/loop7 /data/local/cache.img
mount -t ext4 /dev/block/loop7 /cache
chown system.cache /cache
chmod 770 /cache
# Remount / and /system as read-only again
mount -o ro,remount /system
mount -o ro,remount /
sleep 3
echo "Now after reboot this (cache) partition will be back!"
sleep 10
echo "All done, if there where no errors you can now delete cachefix.sh"
echo "If your new /cache partition is mounted with the given size than all is good"
echo "These are the configurations now"
# exec df command to show config now
df
sleep 10
exit
With this your /cache will be changed to whatever values you give in the code...
For safety remove the cachefix.sh afterwards...
Added cachefix.txt, download and rename to cachefix.sh
Greets,
Dutchpatriot

Categories

Resources