FORUMS

[MOD] Universal Init.d Injector v3.1 [Deprecated]

3,974 posts
Thanks Meter: 6,589
 
By Zackptg5, Recognized Developer on 21st October 2017, 02:54 AM
Post Reply Email Thread
This is a flashable zip that enables init.d scripts to run depending on the root method you have installed.
To uninstall, just flash the zip again and it'll restore everything to how it was before

If magisk:
Boot scripts will be installed that will run all exectuable scripts in init.d as post-fs-data except any that end in '-ls' which will be run as late start. Also note that if you're trying to create the init.d folder, the original directory when using magisk is actually /sbin/.core/mirror/system/etc. It goes without saying that this could break safetynet (honestly though, just copy your script to /sbin/.core/img/.core/service.d or post-fs-data.d instead and set permissions to 0755 rather than creating an init.d directory - using the in-house magisk solution is always the better option. Magisk users have almost no reason to create an init.d directory)

The rest of this is for non-magisk/supersu installs
Otherwise: the boot img and part of the system will be modified to enable init.d support.
What it does:
  • Search for sysinit in any rc file. If found and seclabel is intact and equal to target seclabel for my init rc script, then that seclabel will be set to permissive in sepolicy if needbe instead of using my solution
  • If sysinit with seclabel isn't found, a custom rc file and system/bin/script file will be installed and sepolicy will be patched accordingly to add init.d support. Init.d scripts will be run the same way as with magisk installs above
  • Adds magiskpolicy to sbin. It's more up to date and complete than setools so why not?
If there is an error on unpacking your boot image, check the binary inclusion section here to see if your device needs one: https://github.com/osm0sis/AnyKernel3#-binary-inclusion
If it does, place it in addon/AnyKernel3/tools/arm (or x86 - whichever your architecture is - probably arm)

I am not responsible for any oddities that happen to your device because of this, use common sense. For example, if you know your device has a weird boot img, check first.

BACKUP BOOT AND SYSTEM PARTITIONS BEFORE FLASHING

Compatibility: Any device magisk is compatible with

Confirmed working (boot img method):
Nexus 5x
Verizon LG G2
Oneplus 3/3T
Oneplus 5T
Nexus 9
Redmi Note
Zuk Edge
Axon 7 (A2017U)
Nexus 5
SM-N900T
SM-T350
LeEco Pro 3

Confirm your device works and I'll add it to the list!

Special thanks to: @osm0sis, @CosmicDan, @Ricky Divjakovski, @JustArchi

Source: https://github.com/Zackptg5/Init.d-Injector

Download
The Following 69 Users Say Thank You to Zackptg5 For This Useful Post: [ View ]
21st October 2017, 04:38 AM |#2  
CosmicDan's Avatar
Senior Member
Flag Sydney
Thanks Meter: 7,713
 
Donate to Me
More
Good stuff

Good idea with the removal of other/old init.d capabilities. It's annoying that so many ROM's/kernels claim to have init.d but they're fake or hacky (well, I guess the sepolicy injection is pretty hacky too lol). You might also want to consider looking for install-recovery hijack method of init.d and disabling that too - shouldn't be too hard, just check if the file exists in known locations and grep for init.d. The harder part though is what to actually *do* if found - probably best to comment-out the line that contains "run-parts" and/or "init.d" rather than erase the whole file.
The Following 2 Users Say Thank You to CosmicDan For This Useful Post: [ View ] Gift CosmicDan Ad-Free
21st October 2017, 04:42 AM |#3  
Zackptg5's Avatar
OP Recognized Developer
Thanks Meter: 6,589
 
Donate to Me
More
Quote:
Originally Posted by CosmicDan

Good stuff

Good idea with the removal of other/old init.d capabilities. It's annoying that so many ROM's/kernels claim to have init.d but they're fake or hacky (well, I guess the sepolicy injection is pretty hacky too lol). You might also want to consider looking for install-recovery hijack method of init.d and disabling that too - shouldn't be too hard, just check if the file exists in known locations and grep for init.d. The harder part though is what to actually *do* if found - probably best to comment-out the line that contains "run-parts" and/or "init.d" rather than erase the whole file.

Good idea, I'll look into that. Thanks!
22nd October 2017, 11:46 AM |#4  
Account currently disabled
Flag San Pedro, Laguna
Thanks Meter: 1,614
 
More
Will try this soon on Honor 8 Pro and report back.
22nd October 2017, 03:55 PM |#5  
Zackptg5's Avatar
OP Recognized Developer
Thanks Meter: 6,589
 
Donate to Me
More
Quick update to v1.1
Just bought a used nexus 9 and found that the boot partition layout for it and other nvidia tegra devices is different from typical android devices. So I added support for nvidia tegra devices
The Following 3 Users Say Thank You to Zackptg5 For This Useful Post: [ View ]
24th October 2017, 05:22 PM |#6  
Zackptg5's Avatar
OP Recognized Developer
Thanks Meter: 6,589
 
Donate to Me
More
So github screwed with my EOL again and converted a few of the files to windows eol which broke everything. I just fixed it and reuploaded v1.1 with the fixes so just redownload it and flash away. Thanks to @dmgZero for finding the issue
The Following 2 Users Say Thank You to Zackptg5 For This Useful Post: [ View ]
25th October 2017, 05:35 AM |#7  
Zackptg5's Avatar
OP Recognized Developer
Thanks Meter: 6,589
 
Donate to Me
More
Just updated to v1.2. I added support for pixels and nexus5x/6p avb-signing. I haven't been able to test it out myself as my bullhead doesn't even need signing to work so any feedback would be great. Also updated the OP on how to modify this for any weird boot imgs you may have

Edit: No point in spamming the thread with another post: updated to v1.3. Just adds capability to remove any init.d stuff present from install-recovery.sh. Thanks to @CosmicDan for pointing it out
The Following 2 Users Say Thank You to Zackptg5 For This Useful Post: [ View ]
26th October 2017, 07:01 AM |#8  
CosmicDan's Avatar
Senior Member
Flag Sydney
Thanks Meter: 7,713
 
Donate to Me
More
Works fine on Redmi Note (a MediaTek Helio X20 device) running MIUI 9 (Android 6.0).

One tiny detail, maybe just do an mkdir /system/etc/init.d after the patch succeeds, if it doesn't already exist. I could imagine that some other zips could check for the existence of this folder for a simple way to determine if init.d is supported.
The Following 3 Users Say Thank You to CosmicDan For This Useful Post: [ View ] Gift CosmicDan Ad-Free
26th October 2017, 01:13 PM |#9  
Zackptg5's Avatar
OP Recognized Developer
Thanks Meter: 6,589
 
Donate to Me
More
Quote:
Originally Posted by CosmicDan

Works fine on Redmi Note (a MediaTek Helio X20 device) running MIUI 9 (Android 6.0).

One tiny detail, maybe just do an mkdir /system/etc/init.d after the patch succeeds, if it doesn't already exist. I could imagine that some other zips could check for the existence of this folder for a simple way to determine if init.d is supported.

Sweet, I already have that in the sysinit script but it would make more sense to move that to the installer so I'll put that into the next version. Thanks!
The Following 3 Users Say Thank You to Zackptg5 For This Useful Post: [ View ]
28th October 2017, 11:46 AM |#10  
Junior Member
Thanks Meter: 0
 
More
Is that supposed to work systemlessly?
28th October 2017, 06:09 PM |#11  
Senior Member
Flag Erie, CO
Thanks Meter: 238
 
Donate to Me
More
You should probably add Samsung to the weird/hexed/Satan kernels. Tried flashing your zip and recovery came back with Invalid Partition upon failure, my device is a Galaxy Note 5 running RR 7.1.2. I do love the idea and your work though bro. Thanks.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes