How to keep env variable when SuperSu-ing? - RAZR i Android Development

I have a problem with SuperSU as well as Superuser app on my Razr i. The Razr i has its default LD_LIBRARY_PATH set like this:
LD_LIBRARY_PATH=/vendor/lib:/system/lib:/system/lib/arm
But when I have a su-App, it only sees this one
LD_LIBRARY_PATH=/vendor/lib:/system/lib
resulting in non-working apps because of missing libraries ("Openvpn Settings" in this case). The same happens when I'm sending a "su" on adb shell. I'm wondering now how I could set the default library path now...normally it should be possible to either call "su" with some special parameters to handle over the variables or to somewhere set those default values (they must come from somewhere). But at least the apps seem to not offer that?

BerniG said:
I have a problem with SuperSU as well as Superuser app on my Razr i. The Razr i has its default LD_LIBRARY_PATH set like this:
LD_LIBRARY_PATH=/vendor/lib:/system/lib:/system/lib/arm
But when I have a su-App, it only sees this one
LD_LIBRARY_PATH=/vendor/lib:/system/lib
resulting in non-working apps because of missing libraries ("Openvpn Settings" in this case). The same happens when I'm sending a "su" on adb shell. I'm wondering now how I could set the default library path now...normally it should be possible to either call "su" with some special parameters to handle over the variables or to somewhere set those default values (they must come from somewhere). But at least the apps seem to not offer that?
Click to expand...
Click to collapse
Try this (it usually works in Linux):
- Install Android Terminal Emulator
- Open it and type "su - "
- Allow via SuperSu or Superuser the Android Terminal Emulator to become root
- Edit .bashrc or .bash_profile with desired LD_LIBRARY_PATH you need.
- Save it
- Done!!

Related

[Q] Need help writing a script for temporary MVNO support on MIUI

Hey folks!
As some probably might have noticed, Galnet's awesome Miui ROM doesn't support MVNO providers. Fortunately some clever guy (thank you very much aziztcf) has found a solution that allows MVNO users like me to use the data connection without having to tick the data roaming checkbox.
Also the R icon is being hidden by this temporary fix. The only problem is that the "fix" only lasts until you restart your phone or enter flightmode. This means a lot of typing.
So aziztcf said a script might be ideal so you don't have to enter adb or your terminal emulator app every startup.
However I am stuck there as I never wrote a script before.
My question. Can anybody point me in the right direction? This is with what i came up so far.
The idea is to change the gsm.sim.operator.numeric/alpha to match the actual provider ones. So in my case i want it to be 23201 and A1, also I want to change the .isroaming to false and alter the beginning of the IMSI to match the original provider.
I placed this "script" in etc/init.d but it isn't working.
#!/system/bin/sh
#
#getprop
#setprop gsm.sim.operator.numeric 23201
#setprop gsm.sim.operator.alpha "A1"
#setprop gsm.operator.isroaming false
#setprop ril.IMSI 23201xxxxxxxxxx
thanks in advance guys!
Good luck!
really? is that everything you have? -.- anybody else?
perfectlysquare said:
really? is that everything you have? -.- anybody else?
Click to expand...
Click to collapse
I have created a file named roam (without extension) with this:
Code:
#!/system/bin/sh
su
setprop gsm.sim.operator.numeric 21407
setprop gsm.sim.operator.alpha "movistar"
setprop gsm.operator.isroaming false
setprop ril.IMSI 21407xxxxxxxxx
then i execute using "sh roam" and then when i close the terminal emulator, it works. but now, I'm using the APN of movistar, not the APN from my operator. I dont know if this is the solution for the MVNOs...
For execute this script every time you reboot, you can put the script in /etc/init.d/roam. ¿?
(sorry for my english)
Solution?
perfectlysquare said:
Hey folks!
As some probably might have noticed, Galnet's awesome Miui ROM doesn't support MVNO providers. Fortunately some clever guy (thank you very much aziztcf) has found a solution that allows MVNO users like me to use the data connection without having to tick the data roaming checkbox.
Also the R icon is being hidden by this temporary fix. The only problem is that the "fix" only lasts until you restart your phone or enter flightmode. This means a lot of typing.
So aziztcf said a script might be ideal so you don't have to enter adb or your terminal emulator app every startup.
However I am stuck there as I never wrote a script before.
My question. Can anybody point me in the right direction? This is with what i came up so far.
The idea is to change the gsm.sim.operator.numeric/alpha to match the actual provider ones. So in my case i want it to be 23201 and A1, also I want to change the .isroaming to false and alter the beginning of the IMSI to match the original provider.
I placed this "script" in etc/init.d but it isn't working.
#!/system/bin/sh
#
#getprop
#setprop gsm.sim.operator.numeric 23201
#setprop gsm.sim.operator.alpha "A1"
#setprop gsm.operator.isroaming false
#setprop ril.IMSI 23201xxxxxxxxxx
thanks in advance guys!
Click to expand...
Click to collapse
I think I have found a solution. (I have the same problem) - You need Root for this to work!
Here's what I did:
1.) Installed Busybox from PlayStore (open downloaded app and hit Install-Button within App)
2.) Installed SManager from PlayStore
3.) With SManager created a script named "netinit.sh" in system/bin
4.) Wrote the script (manually within SManager Editor!!! - didn't work when I pasted the lines into the file.):
#!/system/bin/sh
setprop gsm.sim.operator.alpha "A1"
setprop gsm.operator.isroaming false
getprop | grep operator
5.) With Smanager set the script to execute on boot and notify.
6.) With Smanager set the Permissions on the script to allow all access. (Found in Properties of script)
7.) Did a reboot and waited for the script notification BEFORE I unlocked the SIM.
8.) Voilá!
Hope, it works for you too!
Regards,
YogiwanKenobi said:
I think I have found a solution. (I have the same problem) - You need Root for this to work!
Here's what I did:
1.) Installed Busybox from PlayStore (open downloaded app and hit Install-Button within App)
2.) Installed SManager from PlayStore
3.) With SManager created a script named "netinit.sh" in system/bin
4.) Wrote the script (manually within SManager Editor!!! - didn't work when I pasted the lines into the file.):
#!/system/bin/sh
setprop gsm.sim.operator.alpha "A1"
setprop gsm.operator.isroaming false
getprop | grep operator
5.) With Smanager set the script to execute on boot and notify.
6.) With Smanager set the Permissions on the script to allow all access. (Found in Properties of script)
7.) Did a reboot and waited for the script notification BEFORE I unlocked the SIM.
8.) Voilá!
Hope, it works for you too!
Regards,
Click to expand...
Click to collapse
I follow this steps on miui v5, I don t know what I am doing wrong but it does not work...
razorinc said:
I follow this steps on miui v5, I don t know what I am doing wrong but it does not work...
Click to expand...
Click to collapse
Hi,
Does the script start?
Do you get an error in the console, when you manually run the script?
KR
Yogi
After I make a script I restart the phone, but launcher freezes...

Adblock Plus on Nook ST: link to last working version & proxy settings guide

The latest versions of Adblock Plus don't work with the Nook. Although they can be installed, they will force-close upon initial start-up (silently if looking just at the UI but with a lot of stuff going on behind the curtains if you read the logcat). I've just reported it as a bug, and it got assigned the nice number #2000 but I expect it will be resolved by marking the APK as unsuitable for the Eclair API level.
So, if you want to use Adblock Plus, the last working version seems to be Adblock Plus 1.1.4.287. It's a development build, as I couldn't find an archive of old stable releases. Download it and install with:
Code:
adb install adblockplusandroid-1.1.4.287.apk
To make Adblock Plus work with the Nook, you need to set a HTTP proxy to address 127.0.0.1 (localhost) port 2020. There are two ways to do it:
This will open a dialog where you can input the above data:
Code:
adb shell am start -n com.android.settings/com.android.settings.ProxySelector
This is totally automatic but a reboot might be required:
Code:
adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure (name, value) VALUES('http_proxy', '127.0.0.1:2020');"
Adblock Plus does an even better job in conjuction with AdAway, available here. In this case, the last version appears to work just fine.
Please note that you don't have to use ADB, you can also do all this directly from your Nook if you have Terminal Emulator installed.
Steps for installing directly from your Nook:
1. Install Adblock Plus by tapping on it in a file explorer, tapping "Install" and tapping "Done".
2. Set an HTTP proxy to localhost 127.0.0.1 and port 2020 by opening up Terminal Emulator and executing this:
Code:
su
am start -n com.android.settings/.ProxySelector
Then, in the "Hostname" text box, enter 127.0.0.1, and in the "Port" text box, enter "2020". Then tap "Save".
Done! ABP will now work properly.
Is it possible to hide notification message or icon?
kazikas said:
Is it possible to hide notification message or icon?
Click to expand...
Click to collapse
Somewhat OT, but yes, you can do that by making the notifications .png files in framework-res.apk plain black.
PM me for detailed instructions.

[Q] How to change device name?

Hi,
I'm rooted and have recently tried changing the device name of my Nexus 6 via terminal using:
Code:
setprop net.hostname <new-hostname>
This works as expected, however the change isn't persistent and doesn't seem to survive a reboot.
Does anybody know how I can make the change stick?
even play store apps can't change it
Script it. Init.d, su.d, tasker, script manager.

[Magisk][Module][Deprecated] Unified Hosts Adblocker

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.

[REQUEST] Is there any module to change the hostname (name of the device)?

Hello, Magisk fans and devs.
The title is pretty self-explanatory. There are some ROMs that allow to customize the hostname of the device (the one that looks like "android-2120ee3b45...") to a more friendly one.
I know there are some apps that allow also this but it'd be nice to find a Magisk module that does that in a simpler way (and without the need to run the name changer app every time the device is rebooted).
Sincerely, thanks!
A module just for that feels a little like overkill... Use the resetprop tool and a boot script to change net.hostname to your desired value.
Add the following to an empty file in /magisk/.core/service.d.
Code:
#!/system/bin/sh
resetprop net.hostname [I]<new value>[/I]
Set the file's permissions to 755 (rwxr-xr-x) and restart.
That will change the hostname to your desired value on each reboot of your device.

Categories

Resources