Hello guys. I'm trying to make some modifications in my build.prop using magisk's systemless interface. In a module, I saw that resetprop can add lines in build.prop, but, I need to change a specific line in build.prop and resetprop in a module intercafe can't do that (or can, I don't know ). I was thinking in creating a script using su + resetprop to delete and include again, and I'll put in a .sh file inside /magisk/.core/service.d/ to run in every boot.
Code:
su
resetprop --delete [my build.prop line]
But I don't know to to include a line using this interface (script in terminal).
So, I need you, guys haha
Just put whatever resetprop commands you want inside a file, put that file in service.d and give it execution permissions (755). You don't need "su" in there... It's Magisk executing those scripts and it already has escalated privileges.
If it doesn't work, try putting the file in post-fs-data.d instead.
To do this with a module, simply put your commands inside the service.sh file (or post_fs_data.sh) in the common folder.
https://github.com/garethwza/TheFla...mmit/25fb6a451a4d5280c26dbd67f4c5dfad7a3f20fc how to do this with resetprop? resetprop is binary here. how to make it?
Didgeridoohan said:
Just put whatever resetprop commands you want inside a file, put that file in service.d and give it execution permissions (755). You don't need "su" in there... It's Magisk executing those scripts and it already has escalated privileges.
If it doesn't work, try putting the file in post-fs-data.d instead.
To do this with a module, simply put your commands inside the service.sh file (or post_fs_data.sh) in the common folder.
Click to expand...
Click to collapse
Related
Hi @Chainfire,
So, a while ago, I posted in the Liveboot thread inquiring as to how I'd go about incorporating liveboot into a ROM so that it could just run on first boot.
Your instructions were to chmod 0770 both the files and folders in su.d, and it should work:
If /system/su.d/0000liveboot.script exists (chmod 0644, not 0700 like other files in /system/su.d/ !), this script will be run instead of logcat and dmesg, and its output will be shown in white (stdout) and red (stderr).
Click to expand...
Click to collapse
However, I tried this, and never got it to work, and essentially moved on to other stuff for a while.
Today, I tried to revisit it, and while I was at it, replace my current init.d stuff with su.d.
So, I created the folder in /system which gets copied with t he rest of the ROM on install. I'm setting folder and file permissions to 0700, owner and group to root, SE context to ubject_r:system_file:s0, which, is exactly the same as what I'm seeing on 0000liveboot when I look at it's info.
This leaves two questions.
One, the above quote you say to set it to 0644, but liveboot itself sets it to 0700 when it installs it.
Two, what is the trick to getting other scripts to work? In your "How to SU" guide, you mention this:
From versions 2.22 onwards, after the policies have been patched and the daemon is ready to go, all executables in the /system/su.d/ directory are executed (chmod 0700 both the directoy and the scripts), followed by setprop supolicy.loaded 1. This is akin to /system/(etc/)init.d/, though execution of those scripts is both kernel-dependent and they may run before the SELinux are patches and/or su is available.
Click to expand...
Click to collapse
Setprop supolicy.loaded. Where am I supposed to do that? You say execution of those scripts is kernel-dependent - you're referring to init.d, yes? So, again, what am I missing?
This is 5.0.1 GPE for M8VZW. I have selinux set to permissive via boot image in init.rc, and verify that "getenforce" returns "permissive" from shell.
Any help you could lend would be greatly appreciated - which is also why I'm posting this as a thread...because su.d sounds like an awesome idea, and I bet more devs would like to start using this method over init.d.
Thank!
digitalhigh said:
One, the above quote you say to set it to 0644, but liveboot itself sets it to 0700 when it installs it.
Click to expand...
Click to collapse
liveboot sets the script that gets run by SuperSU to 0700. The script which I said to be set 0644 is a different script, and is not executed by SuperSU, but by liveboot.
Setprop supolicy.loaded. Where am I supposed to do that?
Click to expand...
Click to collapse
You don't. SuperSU sets this. Kernel developers can hook this event to run their own code.
You say execution of those scripts is kernel-dependent - you're referring to init.d, yes?
Click to expand...
Click to collapse
Yes, not all kernels support init.d, and init.d stuff generally runs before SuperSU patches policies, so there's no guarantees about any SELinux state.
So, again, what am I missing?
Click to expand...
Click to collapse
I don't know. Make sure you are running the latest version of SuperSU (2.46 at the time of writing). Make sure /system/su.d is chmod 0700. Make sure the scripts you want to run are also chmod 0700 and #!'d to a working shell executable. Keep in mind that the scripts are called one-by-one, in a blocking way. So if a script never exits, the next script isn't run.
Deleted
Say I have SU v2.62. I have 2 files in my /system/su.d folder. The first file doesn't have an exit, neither does the second. The second file DOES get executed as it sets selinux to permissive at boot as directed. First file is 0700 (text file), second is 0755 (a .sh file).
Now, I want to take an init.d setprop script and try it via su.d.
1) Do the other files need exit commands?
2) What should the third file (setprop file) be set to, 0755? A .sh or text file?
3) Are the other two set to the correct chmod?
Thank you for any input!
EDIT: Left it as text, and 0755. No exits, and it worked?
Using su.d to disable doze
Is it possible to use su.d in order to load a script that disables Android doze mode?
I'm trying to run this script:
Code:
#!/system/bin/sh
dumpsys deviceidle disable
Script file is located in root\su\su.d
Permissions are set to 0700.
However, script is not loaded automatically during the boot, because if I run the script manually in SManager I get a response Idle mode disabled, which means su.d script wasn't loaded.
Currenlty I use SManager to execute this doze disabling script automatically on every boot, but I wonder why wouldn't the same script work using su.d?
I use another su.d script that disables LED back-lights of hardware navigation buttons and the script works just fine.
I'm using SuperSU v2.82
Thanks for your input.
This mod has since been discontinued in favor of Adaway. Read on for information on how to use Unified Hosts with Adaway
What are Unified Host Files?
Unified host files combine many reputable sources into a single hosts file (with duplicates removed). Some examples include adaway, mvps, yoyo.org, and malware domain list (see Steven Black's page here for a complete list).
Adaway Installation for Magisk:
Adaway version 4.x now works properly with magisk systemless hosts. To enable it, just install the latest version from here (the main xda thread for it hasn't been updated for it yet). Then go to Preferences -> Enable systemless mode. This automatically enables the Systemless hosts option in magisk manager so no need to bother with that. Then use the app as normal.
How to Add Unified Hosts to Adaway:
In the adaway app, go to Preferences -> Redirection IP (NOT Allow Redirects). Change the value to 0.0.0.0. Read the readme on Steven Black's GitHub linked above for why.
Then go to Hosts Sources. Then add the url of the unified hosts you want (ONLY CHOOSE 1):
Master: https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
Master+FakeNews: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts
Master+Gambling: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling/hosts
Master+Porn: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts
Master+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/social/hosts
Master+FakeNews+Gambling: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling/hosts
Master+FakeNews+Porn: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-porn/hosts
Master+FakeNews+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-social/hosts
Master+Gambling+Porn: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn/hosts
Master+Gambling+Social https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-social/hosts
Master+Porn+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn-social/hosts
Master+Fakenews+Gambling+Porn (This is the one I use): https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn/hosts
Master+Fakenews+Gambling+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-social/hosts
Master+Fakenews+Porn+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-porn-social/hosts
Master+Gambling+Porn+Social: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn-social/hosts
Master+Fakenews+Gambling+Porn+social: https://raw.githubusercontent.com/S...lternates/fakenews-gambling-porn-social/hosts
You can then uncheck the host sources already added by default to adaway since they're included in unified hosts sources already
**Note that the 'Social' filter does exactly what you think: blocks social networks. So if you use any kind of social networking, DO NOT CHOOSE THIS ANY SOURCE WITH THIS IN IT**
Using a APN that uses a proxy server or a subsidiary provider and unable to get adblocking working? See here for a fix
Original Mod Information:
Description
Blocks ads by using Steven Black's Unified Hosts
Comes with a small utility based off of LarappsOfDongle's RP modular host module that allows you to choose which kind of host file you want (adware/malware, fakenews, gambling, porn, social, or any combination)
Installation
Go to Settings in Magisk Manager and enable 'Systemless Hosts'
Flash module
Open terminal and type:
Code:
su
hosts
Then follow the prompts to install the host file of your choice.
OR
- Open terminal and type:
Code:
su -c hosts arg1 arg2 arg3
- The script will apply your arguments all at once and close. Useful for automation purposes
- For example: `su -c hosts m wr b`
- Script will apply the master filter, then your regex whitelist, then your blacklist
Updating Hosts:
Just run the hosts file again in terminal and it'll overwrite the old one
Note: The script will now notify you to say if you need to update or not at the top of it
Disabling Host Mod:
Just toggle the enable systemless hosts option in magisk manager
Whitelist Instructions:
Create an empty file on sdcard card called "whitelist"
Either add exact lines you want remove to it -> Run hosts script and choose whitelist option
For example:
Code:
0.0.0.0 facebook.com
Will unblock facebook.com
Or add regex for lines you want removed -> Run hosts script and choose whitelist regex option
For example:
Code:
.*facebook.*
Will unblock all domains with "facebook" in them
Blacklist Instructions:
Create an empty file on sdcard card called "blacklist"
Add exact lines you want to remove it (do not include the 0.0.0.0 -> so for example: "facebook.com")
Run hosts script and choose blacklist option
For example:
Code:
google-analytics.com
Will block the google-analytics.com domain (it will add the entry "0.0.0.0 google-analytics.com" to the hosts file - note the lack of the 0's here. The script takes care of it automatically for the blacklist feature)
To Remove Whitelist:
Just run hosts script and reinstall host file of choice
Latest Magisk Version Compatibility:
15.x
Source
Can't Boot?
Try rebooting into the bootloader, then boot into system. Thanks @rignfool for the tip
Bonus!
I made a quick automate flow to update the hosts file. Just import it, add a shortcut to your home screen, and you can update it in one click
Just change the 2nd block to whatever options you want
@Didgeridoohan made a tasker profile here for any who use tasker: https://forum.xda-developers.com/showpost.php?p=73369050&postcount=451
Download
How does this differ from AdAway?
serubin323 said:
How does this differ from AdAway?
Click to expand...
Click to collapse
The unified hosts file combine many sources including AdAway, mvps, malware domains, and more. Check out steve black's page in the op for a full list.
Also, for some reason, adaway wouldn't detect the systemless hosts file for me so i had to set a custom path and symlink it
Updated module for latest magisk manager update (required changes to the readme). Doesn't change the functionality of the module at all so if you're in 1.1, there's no need to upgrade since these readme changes will only be reflected in magisk manager once this module is approved into the repo.
Damnit... Wrong thread...
OK...
Syntax...
su -c hosts ______
Please fill in the blank...
rignfool said:
Damnit... Wrong thread...
OK...
Syntax...
su -c hosts ______
Please fill in the blank...
Click to expand...
Click to collapse
Code:
su
Give root permissions
Code:
hosts
Program will prompt for input. For example, if you want malware/adware (master) + fakenews + gambling, you're input would be:
Code:
fg
The reason for not including the master (adware/malware) in the arguments is that it's already included by default in each host file. So the fakenews host file is actually master + fakenews. It's how steven set it up so I have no control over it (and who wouldn't want the malware block anyways)
Found a typo in the directions for the host file. Once again doesn't effect functionality at all but does eliminate confusion so uploaded fixed version (sorry)
Zackptg5 said:
Give root permissions
Program will prompt for input. For example, if you want malware/adware (master) + fakenews + gambling, you're input would be:
Click to expand...
Click to collapse
I'm looking to execute as a one line shell command with tasker...
So I'm using 'su -c' cuz SU detection in tasker with magisksu is broken...
Then hosts... But I want to run with an argument so I don't need to interact with the script... Just have it update the hosts file...
rignfool said:
I'm looking to execute as a one line shell command with tasker...
So I'm using 'su -c' cuz SU detection in tasker with magisksu is broken...
Then hosts... But I want to run with an argument so I don't need to interact with the script... Just have it update the hosts file...
Click to expand...
Click to collapse
I've never used tasker (use automate instead). Perhaps
su -c; hosts; sleep 1; fgps; sleep 2; q
Not sure if the sleep command works for tasker (linux thing) but if there's a way to have it wait a half a second or so before inputting the next command, and then waiting 2 seconds or so to quit after the hosts is applied (not sure on the time, just guessing).
Edit, just saw you didn't want to deal with the script. The 'hosts' command is the script. If you look my source for the hosts script, it lists each url for the file and what it does. So all of the terminal code for fgps would be:
Code:
su -c
cd /magisk/.core
wget -O hosts --no-check-certificate https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts
This will replace the systemless hosts file with the one you want. Note you will at least need the wget portion of the module (system/bin) since it's not included in most roms
v1.3 update: Noticed that the disable option was broken so I removed it since it's not needed (see OP for disable instructions)
Using ze551ml, after rebooting, module disappeared. I can't find hosts command anywhere.
danzel said:
Using ze551ml, after rebooting, module disappeared. I can't find hosts command anywhere.
Click to expand...
Click to collapse
Does magisk manager say root is enabled? There's been an ongoing issue where root will disappear and so all modules will disappear as well. This isn't a module issue but a magisk issue
Automating hosts update?
Hi Zack!
Love your module, thank you!
Is there a way I can update with FG running a shell command from Tasker?
When I try
Code:
echo fg|hosts
it does download the fg file, but then it infinitely loops and never quits, until I send a CTRL-C to the terminal.
Could you please make it so hosts accepts arguments from the command line, instead of a menu?
Thank you!
Yom said:
Hi Zack!
Love your module, thank you!
Is there a way I can update with FG running a shell command from Tasker?
When I try
Code:
echo fg|hosts
it does download the fg file, but then it infinitely loops and never quits, until I send a CTRL-C to the terminal.
Could you please make it so hosts accepts arguments from the command line, instead of a menu?
Thank you!
Click to expand...
Click to collapse
The menu is part of the command line. I don't have tasker however, maybe this post will help: https://forum.xda-developers.com/showpost.php?p=71117156&postcount=9
You can circumvent running the script completely and just wget your host of choice. In that post, I have a link to the source for the hosts file with all of the urls. For fg for example, it would be: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling/hosts
Yom said:
Hi Zack!
Love your module, thank you!
Is there a way I can update with FG running a shell command from Tasker?
When I try
Code:
echo fg|hosts
it does download the fg file, but then it infinitely loops and never quits, until I send a CTRL-C to the terminal.
Could you please make it so hosts accepts arguments from the command line, instead of a menu?
Thank you!
Click to expand...
Click to collapse
As @Zackptg5 says, to automate with Tasker it's easier to just circumvent the script altogether...
I have a Tasker profile set up to fetch the hosts file directly from Steven Blacks GitHub and save it to /magisk/.core/hosts. I couldn't get wget to work properly with Taskers Run Shell, so I used the HTTP Get instead to fetch it to /sdcard and then Run Shell to move it to /magisk/.core/hosts (and to remove it from /sdcard afterwards).
Is there a possibility of whitelists?
ChronoReverse said:
Is there a possibility of whitelists?
Click to expand...
Click to collapse
In theory, you shouldn't need a white list with these hosts files. I chose them because they are gone over with a fine tooth comb so you shouldn't have any issues. However, when I get on spring break, I could attempt to add a whitelist option to the script. I was thinking the easiest way to do this would be to read a text file (would be a blank one in the module folder by default but is editable the uses to add whatever) and remove any matches from the host file. Have any better ideas to implement this? I have no experience with GUI development and that would add unnecessary overhead anyways
Does this module work currently? I disabled adaway and enabled this but it's not blocking ads that adaway blocks.
Testcase: root check by Jrummy
Adaway blocks the in app ads. This module does not
EDIT: apparently I can't read... Lol. Followed the Op and now it works great!
Neat module. It's working great! Thanks for sharing it!
Yom said:
Hi Zack!
Love your module, thank you!
Is there a way I can update with FG running a shell command from Tasker?
When I try
Code:
echo fg|hosts
it does download the fg file, but then it infinitely loops and never quits, until I send a CTRL-C to the terminal.
Could you please make it so hosts accepts arguments from the command line, instead of a menu?
Thank you!
Click to expand...
Click to collapse
I have a profile set up to do this every 12 hours. If you still need it, I updated it to use your preferred settings and exported it. All you need to do is import it in Tasker (long-press Profiles header) and turn it on.
The question title can't be much longer but I basically need to execute a script only once when each of the following events happen:
Module is installed.
Module is uninstalled.
Module is enabled.
Module is disabled.
In other words:
When the user first installs my module, I need to execute a script just once.
If the user eventually disables the module, I need to execute the same script again just once.
If the user eventually re-enables the module, I need to execute the same script again just once.
When the user decides to uninstall my module, I need to execute a script just once.
That script is basically removing a particular app's dalvik cache (rm -rf /data/dalvik-cache/<(arm|arm64)>/<app_specific_folder>), and user data (rm -rf /data/data/<package_name>).
I need some pointers on how to do this properly for those 4 events mentioned above and in a way compatible with most devices (for the record, I'm only supporting Nougat and above, if that's relevant).
Installation is easy. Make a function with your script in config.sh and call that from update-binary. Also make sure to let the module install a boot script (post-fs-data.d or service.d, depends on what you want to do) that takes care of the rest for you.
Whenever a module is disabled, there'll be a file named disable in the module folder, so you can let the boot script check for that and then run whatever code you need for the "module disabled" scenario. If you also let that code add a check file to the module folder you can let the code only run once. If both the disable and check files are present, don't run the code...
If the module then is enabled again, the disable file will be deleted. In that case you'll only have the check file, which will mean you should then run the "module enabled" code (which should also delete the check file, of course).
Also let the boot script check for the module folder. If it isn't found it means the module has been uninstalled and you can safely run your "module uninstalled" scenario, do some cleanup, and then let the boot script uninstall itself.
That should work...
There are several modules that do something similar, my MagiskHide Props Config is one of them. Look around for more examples.
I see what you mean but I need to test my code with logging to make sure I'm doing things correctly. What's the best way for me to print to logcat from my Magisk module?
Use exec with xtrace.
Code:
exec 2>/path/to/log/file;
set -x;
It will redirect the command (execution) tree and their errors to the log_file.
Regards.
@JayminSuthar Sorry, I don't understand. Where should I place that code? And are you saying that all the commands (outputs and errors) on my module will be redirected to that file, no exceptions?
You should place this code in your script from where you want logging to start (mostly the beginning). This will print the command (execution) tree in the log file, and all errors (if any), It will not print the output, but the command executed itself.
The format of the logs should be like
Code:
+ >&2
+ echo 'Here logging starts, I'm stderr'
Here logging starts, I'm stderr
+ rm -f /some/non/existent/file
rm: Can't remove file: No such file or directory
Dear Members iam not a developer so i am looking for someone who can convert attached file into Magisk Module.. This TWRP zip contain vendor files for Sharp Aquos S3 (HH6) and iam using it to run Android One which is for device HH1..
If it is possible for anyone please.
I downloaded this file from 4PDA so i can not request them to convert as i don't know russian to communicate
You don't need to be a developer to create a Magisk module. You've got the module template right here: https://github.com/topjohnwu/magisk-module-installer
Simply take the vendor directory from the original zip and place it in the system directory of the module template. Then you can update the info in module.prop to something descriptive (so you know which module it is in the modules list later), zip up the template and flash it.
Great Thanks alot i will do it right away
Didgeridoohan said:
You don't need to be a developer to create a Magisk module. You've got the module template right here: https://github.com/topjohnwu/magisk-module-installer
Simply take the vendor directory from the original zip and place it in the system directory of the module template. Then you can update the info in module.prop to something descriptive (so you know which module it is in the modules list later), zip up the template and flash it.
Click to expand...
Click to collapse
Iam getting an error as below
Copying zip to temp_directory
Installing module.zip
Installation failed
Where I can see what is wrong, i simply copied vendor folder from original TWRP zip folder and pasted into system folder of module template as instructed
There are no logs in Magisk Manager > Logs
Didgeridoohan said:
You don't need to be a developer to create a Magisk module. You've got the module template right here: https://github.com/topjohnwu/magisk-module-installer
Simply take the vendor directory from the original zip and place it in the system directory of the module template. Then you can update the info in module.prop to something descriptive (so you know which module it is in the modules list later), zip up the template and flash it.
Click to expand...
Click to collapse
jameelmemon said:
Iam getting an error as below
Copying zip to temp_directory
Installing module.zip
Installation failed
Where I can see what is wrong, i simply copied vendor folder from original TWRP zip folder and pasted into system folder of module template as instructed
There are no logs in Magisk Manager > Logs
Click to expand...
Click to collapse
I'm gonna guess you didn't replace the dummy update-binary with the proper installation script. It's detailed in the documentation but I could probably have mentioned it... Here's the relevant part of the docs: https://topjohnwu.github.io/Magisk/guides.html#magisk-module-installer
Didgeridoohan said:
I'm gonna guess you didn't replace the dummy update-binary with the proper installation script. It's detailed in the documentation but I could probably have mentioned it... Here's the relevant part of the docs: https://topjohnwu.github.io/Magisk/guides.html#magisk-module-installer
Click to expand...
Click to collapse
After Following all instructions, module gets installed but it is not effective
After analyzing files that this module loads I think they doesn't work as they do not execute as they should, I maybe wrong here, but i think these scripts need to be split and placed / executed in different way.
here is code from vendor/etc/init/hw/init.sku.rc
on fs
setprop persist.radio.skt_iot 1
setprop persist.vendor.ims.no_stapa 1
setprop ro.product.first_api_level 27
setprop ro.product.vendor.brand SHARP
setprop ro.product.vendor.model FS8032
setprop ro.product.vendor.name FS8032_00A0
setprop ro.product.vendor.device HH6_sprout
setprop ro.product.vendor.manufacturer SHARP
on post-fs
setprop persist.sys.security_enable false
setprop persist.radio.multisim.config dsds
on fs
setprop ro.vendor.build.fingerprint SHARP/FS8032_00A0/HH6_sprout:9/PPR1.180610.011/FS8032S0314P:user/release-keys
there are 2 files init.fingerprint.gxfp5288_sd1.rc and init.fingerprint.gxfp3258_sd1.rc containing on post-fs-data which should be placed in common/post-fs-data.sh file, but i don't know about on fs or other parts.
whereas vendor/etc/init/hw/init.HH1.target.rc imports some existing scripts from vendor folder and executes code on boot, on pre-boot and on init
from prename of each file i guess they can be executed as init.d script if so how i can use a module to convert them as init.d scripts and load effectively
All the props (the setprop commands) can be placed in the module system.prop file (don't forget to also activate it in install.sh). The rest of the commands would have to be converted to the post-fs-data.sh and service.sh module scripts, depending on when they're needed (again, don't forget to activate them in install.sh). The service.sh script runs later in the boot process.
I can unfortunately not help you there though. Time is a way too valuable commodity...
Setprop i can do but can you please have a look into the files and explain to me how i would rewrite the script or point me to a tutorial would be great help
Didgeridoohan said:
All the props (the setprop commands) can be placed in the module system.prop file (don't forget to also activate it in install.sh). The rest of the commands would have to be converted to the post-fs-data.sh and service.sh module scripts, depending on when they're needed (again, don't forget to activate them in install.sh). The service.sh script runs later in the boot process.
I can unfortunately not help you there though. Time is a way too valuable commodity...
Click to expand...
Click to collapse
Hi! I need to modify build.prop in /vendor partition. As i understood system.prop can't affect it. So i decided to edit it with "sed" cmd. But i got stuck on boot script. It is executed in magisk logs, but there is no code executed (i added one copy+paste cmd to test).
How should i properly modify /vendor files?
Should i modify it in post-fs-data.sh or service.sh?
I'm noob in magisk module making
Bash:
# This script will be executed in post-fs-data mode
# More info in the main Magisk thread
MODDIR=${0%/*}
#testing and no result
cp /system/build.prop /storage/emulated/0/build.propes
cp /system/build.prop /sdcard/build.propes
#i want to do this
sed -i 's/ro.product.system.brand=Xiaomi/ro.product.system.brand=Google/g' ${$MODDIR}/system/build.prop
sed -i 's/ro.product.system.brand=Xiaomi/ro.product.system.brand=Google/g' ${$MODDIR}/vendor/build.prop
Why do you need to edit the actual build.prop file? Isn't it enough to use the resetprop tool (system.prop in the module).
Didgeridoohan said:
Why do you need to edit the actual build.prop file? Isn't it enough to use the resetprop tool (system.prop in the module).
Click to expand...
Click to collapse
I've tried to do this via system.prop, but got negative result. When i do replace modified files through recovery, i get positive result. Idk whats the problem, cuz i even tried to mount files in moddir/system/ folder. Seems android somehow detects any changes
So i have to copy files to module folder, modify, and replace them in original directory. Now the problem is in editing file, i successfully copied file but "sed" doesnt seem to work lol
What do you mean with "negative results"? Does the prop value not change? Have you tested with the getprop command (because you can't look in the prop file, it won't change when using the resetprop tool)?
Using a Magisk module to magic mount the prop files is likely not going to work since that will happen way too late for the files to be read by the system.
Didgeridoohan said:
What do you mean with "negative results"? Does the prop value not change? Have you tested with the getprop command (because you can't look in the prop file, it won't change when using the resetprop tool)?
Using a Magisk module to magic mount the prop files is likely not going to work since that will happen way too late for the files to be read by the system.
Click to expand...
Click to collapse
Negative result for me - app does not recognize me as another device. There is some protection in it that doesnt simply read system props. It read the build props in root directory. (last android security patch)
I just need to modify files in module directory and thats all. I have only this problem now.
No apps can read the build.prop files directly (unless they're root apps, of course)... Apps will be reading the values, not the file, which is why the resetprop tool works without changing the prop file.
If you really want to go for it though your sed command looks fine, except that I would use ${MODDIR}/system/vendor/build.prop since I don't think the ${MODDIR}/vendor symlink will be available when post-fs-data.sh is executed.
Not sure why you're copying the files to the internal storage and why you're naming them .propes, so can't say much about that.