Where should I put a file to replace a /cust/<filename> - Magisk

Hello!
I am trying to write a simple module to replace /cust/OPEN_COM/cust_OPEN_EU.prop file. LG stores its regional settings there. I cannot just edit the file because /cust folder is mounted in the read-only mode.
I've looked through some examples but all of them were made to replace files in /system folder.
Where should I put my file? Should I just create "/cust/OPEN_COM" folder structure in the module root folder?
Some additional information. I believe, that /cust mounting point refers to the /dev/block/sda15 partition.
Thank you very much for any advice!

Magisk modules can only replace files in /system or /vendor. If you want to replace/edit files somewhere else you'll need to use a custom installation or boot script to do what you want.

Didgeridoohan said:
Magisk modules can only replace files in /system or /vendor. If you want to replace/edit files somewhere else you'll need to use a custom installation or boot script to do what you want.
Click to expand...
Click to collapse
Thank you!
Is it possible to replace the file with init.d script and init.d enabler module? Should I remount /cust foler with rw option in this case?

CbIP said:
Thank you!
Is it possible to replace the file with init.d script and init.d enabler module? Should I remount /cust foler with rw option in this case?
Click to expand...
Click to collapse
You don't need init.d with Magisk. You've got post-fs-data.d and service.d where you can run boot scripts (depending on when you want them to run).
You'll have to remount rw to edit, and then you can mount back to ro when the script is done.

Related

Blocking ads

How do you block ads?
I used to use addfree from bigtincan.com, but it doesn't block all ads anymore.
The idea is to use hosts file to block ads servers.
Is there something better?
kriticar said:
How do you block ads?
I used to use addfree from bigtincan.com, but it doesn't block all ads anymore.
The idea is to use hosts file to block ads servers.
Is there something better?
Click to expand...
Click to collapse
AdAway is working fine for me.
The problem is, no full/complete root, i think.
You have to add the system folder by delete the imutable.
http://forum.xda-developers.com/showthread.php?p=54719981
- Adfree
- Adaway
Working fine
Sent from my HUAWEI P7-L10 using XDA Free mobile app
Tried this?
http://forum.xda-developers.com/showthread.php?p=32276021
u.hedt said:
AdAway is working fine for me.
Click to expand...
Click to collapse
I tried to use adaway but looks like the /system/etc/hosts file with rw,r,r permissions is not editable.
I tried to remount /system partition in rw mode (it is ro as default) but with no luck.
For remounting I used ES File explorer or terminal. Mount shows that partition is in rw mode, but it is kind of fake because I cannot edit the host file.
Does anyone else has a problem with /system partition?
87insane said:
The problem is, no full/complete root, i think.
You have to add the system folder by delete the imutable.
http://forum.xda-developers.com/showthread.php?p=54719981
- Adfree
- Adaway
Working fine
Sent from my HUAWEI P7-L10 using XDA Free mobile app
Click to expand...
Click to collapse
After carefully reading the post you have linked above I can confirm that procedure is working (thanks).
What I have done is basically, remounted /system rw, than removed immutable attribute from set_immutable.list, than I have opened set_immutable.list in editor, commented /system/etc, (maybe rebooted at this point, I am not sure), than I have removed immutable attribute from the /system/etc/hosts file.
Now I was able to change hosts file with adaway. After its competion, I have uncommented /system/etc in set_immutable.list file and reverted back immutable attributes on set_immutable.list and hosts file.
Sure, adaway will not be able to update the hosts file until I repeat the hole procedure, but I don't like an idea to open hosts file to everyone for now.
kriticar said:
After carefully reading the post you have linked above I can confirm that procedure is working (thanks).
What I have done is basically, remounted /system rw, than removed immutable attribute from set_immutable.list, than I have opened set_immutable.list in editor, commented /system/etc, (maybe rebooted at this point, I am not sure), than I have removed immutable attribute from the /system/etc/hosts file.
Now I was able to change hosts file with adaway. After its competion, I have uncommented /system/etc in set_immutable.list file and reverted back immutable attributes on set_immutable.list and hosts file.
Sure, adaway will not be able to update the hosts file until I repeat the hole procedure, but I don't like an idea to open hosts file to everyone for now.
Click to expand...
Click to collapse
Thanks!
I think you dont need to revert it.
Full root is full root. Everytime you or a program needs rights for system changes, super su will ask you that.
Because i've made many changes in my P7 like volume of headphones and softkeys visibility. I still have the system folder mounted.
Sorry for my bad english!
Sent from my HUAWEI P7-L10 using XDA Free mobile app
kriticar said:
After carefully reading the post you have linked above I can confirm that procedure is working (thanks).
What I have done is basically, remounted /system rw, than removed immutable attribute from set_immutable.list, than I have opened set_immutable.list in editor, commented /system/etc, (maybe rebooted at this point, I am not sure), than I have removed immutable attribute from the /system/etc/hosts file.
Now I was able to change hosts file with adaway. After its competion, I have uncommented /system/etc in set_immutable.list file and reverted back immutable attributes on set_immutable.list and hosts file.
Sure, adaway will not be able to update the hosts file until I repeat the hole procedure, but I don't like an idea to open hosts file to everyone for now.
Click to expand...
Click to collapse
I tried the same but was unsuccessful.
Basically, I cannot install Busybox cause my system partition is read only, so I cannot perform chattr. No way, I tried 7 or 8 different installers from the store.
I can set RW access through terminal or ADB or Root Explorer, but it's fake as no changes will survive the reboot.
I did not try to load the custom recovery, not sure if this is mandatory... I just want to remove immutable
I'm on L00 B608 EMUI 3.0
Thanks whoever can advise

Writing shell scripts

I wrote a shell script that I saved in the root directory of the sdcard, however, file permissions were 660 and I could not find a way to make it executable. 'chmod +x' did not work, nor could SolidExplorer change permissions. Googling suggested that if I copied it to e.g. /data I could then change permissions, file permissions were indeed 760 after copying but did not stick when copying the file back to the sdcard and reverted to 660.
I can execute the shell script on the sdcard running it as 'sh script' but I'd rather have it executable as is.
Is this not possible?
Thanks.
You can't modify permissions a la Linux style on a non Linux file system.
Either copy it to a Linux partition or format the sd card with a Linux file system.
So the sdcard is not a Linux-style filesystem and I tried copying it to /data which showed the permissions I wanted but were lost when I copied the file back to the sdcard.
Do you have a suggestion how I can do this on my tabs2?
Thank you.

How to modify system file with RootExplorer systemless?

I've installed magisk.
I need to modify /system/emui/base/xml/hw_clone_app_list.xml.
How to edit this file systemless with RootExplorer?
Just edit it, and it will be systemless ?
Or I should to modify the file in /sbin/.core/mirror/system/... ?
To modify it systemlessly you need to create a Magisk module that mounts your edited file over the original.
Instructions here:
https://github.com/topjohnwu/Magisk/blob/master/docs/modules.md
And in the module template:
https://github.com/topjohnwu/magisk-module-template
Didgeridoohan said:
To modify it systemlessly you need to create a Magisk module that mounts your edited file over the original.
Instructions here:
https://github.com/topjohnwu/Magisk/blob/master/docs/modules.md
And in the module template:
https://github.com/topjohnwu/magisk-module-template
Click to expand...
Click to collapse
OK, thanks.
So modify the file in /sbin/.core/mirror/system/ is not systemless?
dawnc said:
OK, thanks.
So modify the file in /sbin/.core/mirror/system/ is not systemless?
Click to expand...
Click to collapse
No worries, and no it's not.
dawnc said:
OK, thanks.
So modify the file in /sbin/.core/mirror/system/ is not systemless?
Click to expand...
Click to collapse
Hello,
You can create a magisk module that copy the specifiq file into your mod path, edit it using sed (for exemple), all theses steps could be done into post-fs-data stage, so at each phone boots.
Take the module template from the link of Didgeridoohan, and put necessary cmd lines into post-fs-data.sh file:good:
Why is it so hard to do such a system modification with Magisk... smh.

How to make a Magisk module replace files

Hi!
i don't know how to make a module so i want replace file in system/etc (file i want replace fonts.xml)
so can anyone help?!?
All the instructions you need are right here:
https://topjohnwu.github.io/Magisk/guides.html
Hi Sorry i try to read it (and look half internet) to understand how to simply replace a file with magisk. Maybe it has changed with version 24? Please link some source where it's easly explained how this task could be achieved.
Isn't this what you are looking for? https://topjohnwu.github.io/Magisk/guides.html#the-system-folder
The system folder
All files you want to replace/inject should be placed in this folder. This folder will be recursively merged into the real /system; that is: existing files in the real /system will be replaced by the one in the module’s system, and new files in the module’s system will be added to the real /system.
Click to expand...
Click to collapse

Can't change file-content under /system/etc with magisk.

I would like to change a configuration file under /system/etc or /etc. Neither of those locations are writeable and I can't make them writeable with a rw remount. The device is "rooted" with Magisk. How can this be done?
Possible explanation to your issue:
https://didgeridoohan.com/magisk/Magisk#hn_Cant_edit_system_files
Solution is to create a Magisk module that does it for you systemlessly. Details here:
https://topjohnwu.github.io/Magisk/guides.html
I used es file explorer pro. worked like a charm.
Personally I would recommend a different file explorer (like FX), but each to their own.
Depending on the device, from Android 10 it might actually be impossible to mount the system partitions rw. If it is possible (and we're talking about Android 9+ SAR devices now) you need to mount the root directory (/) rather than /system. But that's already outlined in the link posted above...

Categories

Resources