yashsingh1/xdaforums huggingface dataset:
[Android Software Development] Dreamer(3MF):
Could We Use SYSOVERRIDE Variable To Overcome This Issue By Getting The Ability To Use The Unity Installer With Any Magisk Version Older Than 15.3?
[Android Software Development] Zackptg5:
Nope. With sysoverride, the files are installed to system, but the module.prop and scripts are still installed to magisk (or else they wouldn't work).

Why would anyone be on magisk older than that?

When magisk 18 drops, the structure will be changing a lot too so not sure if I'll be able to maintain backwards compatiblity or not when that happens or if it'd even be worth it (it'll depend on device compatibility and stuff)
[Android Software Development] Zackptg5:
As you all were expecting, with the release of magisk 18, I needed to change some things in unity. I also finally decided that it was time to clean house. This means that unity is not longer backwards compatible with magisk versions < 18. I also got rid of the stuff that would remove old audmodlib. I figured it's been long enough so that that's not needed anymore.

However, I added 1.7.2 to the OP for now for the few that may have issues with magisk v18

Important note: with magisk v18, symlinks for the old paths are preserved for backwards compatibility and so unity v1.7.2 should work fine with it. However, with magisk 18.1, these symlinks will likely be removed. Time to upgrade! :D

**Other big change to note**

A lot of mods only need a boot script for sepolicy patching. Although init.d injector should work for most people, there's always the chance that it doesn't and so I made sepolicy separate from the boot scripts now. Set SEPOLICY to true in config.sh and add your patches to the common/sepolicy.sh file. The syntax here is easy now because unity will adapt your sepolicy based on root method. Syntax:

<Action> <source class> <target class> <permission class> { <permission1 permission2 permission3> }

Syntax is the same as any magisk/supersu sepolicy statement EXCEPT NOT QUOTES AROUND IT. Unity will take care of that :)

Piece of cake right?

Due to this, the SEINJECT variable is now gone since there's no longer a need for it.

How does this change anything?

Well it makes it much easier to add the patches and rootless users don't need init.d support if you only had sepolicy patches in your boot script (assuming magiskboot is compatible with it).

The changelog here is extensive (hence the major version bump):

* Fixed bugs, reorganized some stuff

* Updated ramdisk logic for newer magiskboot

* Added new option: sepolicy. It's now separate from the boot scripts and syntax is different (and easier). See op for usage

* Added option to patch sepolicy in ramdisk directly with systems that lack magisk/supersu boot script support

* Updated for magisk v18, removed backwards compatibilities

* Fixed limitation in zipname triggers - you can use spaces in the zipname now and trigger is case insensitive

Edit: Had more time than I though today and so I fine tuned the sepolicy patching with v1.8.1
[Android Software Development] Zackptg5:
In case anybody missed it, I pushed 1.8.1 and edited the last post and OP. Fixed a small bug that led to ramdisk unpacking when it shouldn't have and made sepolicy stuff way easier
[Android Software Development] Zackptg5:
Last update for a while, I promise. Found a nasty bug that messed up busybox during the install and pretty much broke everything so I just rereleased v1.8.1. Also fixed a small bug with sepolicy patching. Only 2 files were changed here: update-binary and unityfliles.tar.xz.

Sorry!
[Android Software Development] Zackptg5:
Found one last bug although this one is more minor. Released v1.8.2 with bug fix for ramdisk being mounted during uninstall when it shouldn't be. Only file modified here was update-binary
[Android Software Development] Zackptg5:
Unity v2.0 is finally here!

Big changelog as this is a major release: Added back backwards compatibility to magisk 15.3 like before, fix script install paths, made sepolicy more dynamic - supports quoted or unquoted statements now, entire installer now runs in bash shell - no more workarounds for ****ty shell, cleaned up code

Note that for ORIGDIR, a variable many of you use in config.sh is changed now with magisk 18 stuff and I've now included it into unity so you don't need to define it anymore in your config.sh's

So now unity runs entirely in bash (compiled by me). So your code can now be normal bash scripting rather than android's garbage shell. Pretty exciting stuff
[Android Software Development] jcmm11:
The Android shell itself isn't that bad. It's a Korn shell. The TWRP shell is more restrictive since it uses the busybox shell, which is the ash (Almquist) shell. It's a lightweight shell, basically Bourne compatible and missing things that shells like Bash and Korn have.

That being said including Bash so you have consistency isn't a bad solution at all.
[Android Software Development] Zackptg5:
Updated Unity to v2.1!

Bug fix release (hopefully the last of them).

Changelog: Fix UNITY variable in boot scripts, add ORIGVEN variable since that stuff is super confusing - saving you all lots of headache here, fixed debug in bootmode
[Android Software Development] Zackptg5:
Updated Unity to v2.2! Just when I though everything was good, I found out that some of the new twrp releases decided to switch from busybox to toybox for some reason. The problem here is that toybox tar can't extract xz archives. So I changed unityfiles archive to be a gz now.

Note that once unityfiles is extracted, an included busybox is loaded so don't worry about any of your mods using xz archives, all of that's still fine :)
[Android Software Development] korom42:
Thank you for your hardwork :fingers-crossed:

For some reason I can't download the latest release 2.2 from zackptg5.com website. The link for UNITY Template keep redirecting me to the same page :)
[Android Software Development] Zackptg5:
Fixed. Sorry about that
[Android Software Development] Zackptg5:
Instead of just a bug fix update, I streamlined some stuff by creating a unity addons repository. This allowed me to take out some non-essentials like ramdisk patching which makes unity less confusing and leaner but allows you to still have that functionality if you want. So Unity 3.0 is here!

Changelog:

* Bug fixes with variables - fix install path issues

* Other bug fixes (mainly for system installs)

* Create addons feature - move all non-essentials to addons (like ramdisk)

* Add unity_upgrade function in config.sh - only for specific/unlikely situation in which something must run during an upgrade - such as backing up app data

* Temporary fix/workaround for `cat: write error` (magisk bug)

Note that the cat: write error that spams the logs is a magisk bug and not a unity one but I have a temporary workaround for it until it's fixed regardless :)

The link to the addons repository has been added to the OP: https://github.com/Zackptg5/Unity-Addons (Check it out! Lots of good stuff there)

A note for anyone follow GitHub, I'll only push stable updates to the master branch. All of the actual work and changes will be in the testing branch. So master branch will always be the latest stable/safe to use
[Android Software Development] onliner:
Hello, I don't know if this is the right place to ask, but I have a small problem when trying to patch an application with the latest installer.

Basically I'm creating a small module to modify the content of an xml placed inside an application folder, that xml has some booleans inside, something like this:

<boolean name="boolean_name_or_id" value="false/true"

Mi initial idea was use the Unity installer and place one small script inside of service.sh, and use the "sed" command to change the value from "value = true" to "value = false" and vice versa, but it just doesn't work, I don't know if I'm doing something wrong (I was using something like thss: sed -i -e 's/<boolean name="name_of_boolean" value="false" />/<boolean name="name_of_boolean" value="true" />/g' /path/to/file.xml) or something with the installer, also, I'm reading about APK-Patcher but I don't know if I want to ship the whole apk inside my module.
[Android Software Development] Skittles9823:
I don't have any experience with patching APKs. But make sure to escape the closing '/' in the sed command if you use '/' as the delimiter. For use cases where you need to sed / I'd recommend using a different delimiter

So something like this:

sed -i -e 's|<boolean name="name_of_boolean" value="false" />|<boolean name="name_of_boolean" value="true" />|g' /path/to/file.xml
[Android Software Development] Zackptg5:
Pushed a quick hotfix to util_functions - fixes broken reboot with aroma addon. Sorry!
[Android Software Development] Zackptg5:
Last hotfix - in order for the zip binary in some of the addons to work, I needed to rename the ZIP variable to ZIPNAME so I pushed a quick change to util_functions and update-binary in unity. APK-Patcher-Lite and Aroma-Installer have also been updated as well.

If you're trying out aroma - there's been lots of fixes today and I think it's finally ready so make sure you grab the latest version from the master branch. Unless I find some other bugs, I'll be pushing everything to the testing branch on unity-addons repo until they're ready for use and then I'll push them to the master branch
[Android Software Development] Zackptg5:
Unity v3.1 is here! Mainly bug fixes but also changed cp_ch a bit so you can now use it for folders! See the OP for usage. Note that the -nn argument has been changed to -i

Also, Aroma-Installer addon has been updated for unity 3.1 as well so make sure you grab latest from repo

Edit: Just when I think I got everything.... Pushed a hotfix to cp_ch function. Hopefully this will be the last of these
[Android Software Development] Zackptg5:
Hey everyone. I reorganized the documentation into a cleaner and easier to read format by making a wiki on the unity github page. Check it out here! https://github.com/Zackptg5/Unity/wiki
[Android Software Development] Zackptg5:
Unity v3.2 is here! This will be the last unity update for some time (assuming nothing changes with magisk).

Main changes were mostly lots of cleanup. The big thing for any devs here is that I removed a lot of unnecessary variables and replaced them with automatic detection. CHECK CONFIG.SH FOR CHANGES

Furthermore, if you use the install_script function, the shebang and MODPATH are automatically added so REMOVE SHEBANG FROM YOUR SCRIPTS USING THIS FUNCTION

The main function change is that the device_check function now also detects vendor props if the device has a separate vendor partition and is not case insensitive

This should make life less complicated for you all and make it easier for newbies to make their own unity modules :)
[Android Software Development] Zackptg5:
Made a quick bug fix to device_check function. Sorry!
[Android Software Development] Zackptg5:
Forgot to mention one other thing:

DYNAMICAPP is not an automatic, detected thing now except it works the opposite as before. Any files placed in priv-app will be moved to app if the priv-app folder doesn't exist on the target device. So move your apks to priv-app if that's where you want them
[Android Software Development] Zackptg5:
Pushed 2 other quick fixes - fix detection of scripts with blank lines, fix debug log when path has spaces in name
[Android Software Development] Ace42:
After using the unity template for two apps it occurred to me to try it for a 3rd cause. Whilst the zip appears to work fine, Android won't accept it.

So I made changes to APN conf for my carrier, applied it, and went to APN settings. Android now shows "settings not available to this user". Does the installer need to be configured in a certain manner for this file?

This is an odd use case for Magisk, I know... but the ability to edit bearer is broken in Oreo - even under custom ROMs. Google fixed it in Pie. I want to see how that field affects network performance (if at all). I'm also curious about the edits for Metro.

https://drive.google.com/file/d/10bPZKvhUqc0CI0n4MgUamWANPKORy__r/view?usp=drivesdk
[Android Software Development] Zackptg5:
You have a syntax error on line 1394 of your apn configs file - forgot the end quote after 'false' :)
[Android Software Development] korom42:
Hey, in v3.2 I noticed that AUTOMOUNT, PROPFILE, POSTFSDATA, LATESTARTSERVICE flags were removed from config.sh file so how are supposed to set these parameters now ? Do we have have to hard code and add them manually or I am missing something.

Thanks for your hard work,
[Android Software Development] Zackptg5:
Guess I didn't word the post clear enough. It's all auto-detected now, you don't have to do a thing. If there's anything other than comments or spaces in the service, post-fs-data, or system prop files, they'll be installed. If there's any content in your system folder, they'll be installed/automount will be set.

I recommend you manipulate the $INSTALLER files in your install/uninstall/config.sh files and letting unity handle the actual install/uninstall process.

So long story short, don't worry about it. These changes are to make life easier for you :)
[Android Software Development] Ace42:
Thank you!! I would've never noticed that, haha.

Cheers! :highfive:

Edit: Success! Everything is working on T-Mobile!
[Android Software Development] Zackptg5:
Updated Unity to v3.3! I wasn't planning on pushing this update to stable but some people talked me into it. Only real changelog is that bash shell is now updated to v5.0 and minapi for unity is now 17 to be in line with magisk. Also a minor bug fix for variable insertion into boot scripts. So nothing major

Also updated some of the unity addons with this as well
[Android Software Development] maruashok:
Hi Bro,

I am developing module which installs app as a "priv-app", everything works fine.

When i uninstall module i would like to delete installed app's trash(like data, DEX, XML etc..),

So how can i delete this file using uninstall.sh ???
[Android Software Development] rwxr-xr-xis:
Nevermind
[Android Software Development] Zackptg5:
Just add your script logic to the uninstall.sh file. Like:

rm -rf /data/data/appfolder
[Android Software Development] maruashok:
Ok thanks bro, get it.

Okk thanks.
[Android Software Development] JarlPenguin:
Hi, I'd like to implement a device check into my module, the problem is that I have a problem understanding functions. Do I just put them in raw text format?

For example, if I wanted my module to abort the install if my device wasn't a Nexus 5X, how would I do that?
[Android Software Development] Zackptg5:
Not quite sure what you mean. The wiki spells out your example though:

device_check - Checks if android device is what's specified. Ex - returns true if device is a nexus 5x (bullhead): device_check "Bullhead"

So for your case:

if ! device_check "bullhead"; then
abort "Mod only for Nexus 5x! Aborting!"
fi
[Android Software Development] JarlPenguin:
Ah, thanks! That's what I was looking for. I'm assuming the ! mark makes it so that if any other device is detected it refuses to install?

Edit:

Would this work?

if ! device_check "montana" or "cedric"; then
abort "Mod only for Moto G5/G5S! Aborting!"
fi
[Android Software Development] Zackptg5:
Ya, the '!' means 'not'. I suggest you read up on shell scripting to learn the syntax - google's your friend:

if ! device_check "montana" && ! device_check "cedric"; then
abort "Mod only for Moto G5/G5S! Aborting!"
fi
[Android Software Development] rwxr-xr-xis:
Hey there, I'm currently developing a module that replaces the system's webview with a custom one, I'm currently stuck trying to extract the files to the target destination, the tar command can't find the files that I point it to. Could someone help me with this?

ui_print "Volume(+) = arm64"
ui_print "Volume(-) = arm"

#Detect user input and extract files
if $VKSEL; then
ui_print "arm64 version selected"
tar -xJf webview-arm64.tar.xz -C $INSTALLER
cp_ch -r $INSTALLER/webview.apk $UNITY/system/app/webview/
else
ui_print "arm version selected"
tar -xJf webview-arm.tar.xz -C $INSTALLER
cp_ch -r $INSTALLER/webview.apk $UNITY/system/app/webview/
fi
[Android Software Development] Zackptg5:
You need to specify the full path. So if the webview tar is in root of zip for example:

tar -xf $INSTALLER/webview-ark.tar.xz -C $INSTALLER
[Android Software Development] Zackptg5:
Quick PSA for any magisk canary testers out there: Unity is NOT compatible with magisk canary. Update is in the works though so a unity update will be dropped around when the next stable/beta magisk comes out
[Android Software Development] Zackptg5:
New magisk template is out! Unity v4.0 will be out shortly so don't worry about magiskbot messages to your repos :)
[Android Software Development] Francescorm76:
Not installed... In twrp same View attachment 4732664

Edit... Now working

Enviado desde mi SM-N950F mediante Tapatalk
[Android Software Development] Zackptg5:
Unity v4.0 is here! Lots of changes made to it for the new magisk template. Make sure you read over the updated wiki for changelog and stuff: https://github.com/Zackptg5/Unity/wiki

Note that due to changes in the template, it's only compatible with magisk 18+ (and of course non-magisk installs). Magisk 19 fixed the majority of the issues users were having forcing them to stick with 16 or whatever so this should be fine

If you're migrating from unity v3.3, here's a short version of what you need to change:

Replace META-INF and common/unityfiles folders (delete old ones, copy new ones)

Copy install.sh and uninstall.sh from unity template to root of your mod. Then replace the relevant content in install.sh with stuff from your config.sh. Finally, delete your config.sh. Note the changed variables in the install.sh

Remove minMagisk from your module.prop, it does nothing now

Rename common/install.sh and common/uninstall.sh to common/unity_install.sh and common/unity_uninstall.sh respectively

Copy over unity_upgrade.sh -> it replaces the unity_upgrade function in config.sh (you can skip this step if you're not using this - most people have no need for it)

In all of your scripts and stuff, make sure you change these variables:

DYNAMICOREO -> DYNAMICLIB

SYSOVERRIDE -> SYSOVER

INSTALLER -> TMPDIR

MOUNTPATH -> MODULEROOT

Check your boot script variables - some of these changed too: https://github.com/Zackptg5/Unity/wiki/Variables

Update your addons (if applicable)

Why the changes? Mainly cause that's how the magisk template is. Not much I can do about it :)

Here's the complete changelog if you don't feel like going to wiki changelog page:

Fix addon main.sh error

Allow addons to run: before everything, preinstall only, install only, uninstall only, postuninstall only

Removed addon.d support - no real purpose for it plus v2 is out now

Move upgrade logic to separate file

Cleaned up code

Use recommended magisk method for uninstall in bootmode - create remove file (same as if you removed in magisk manager)

Overhauled debug log

Fixed props for system installs

Removed bash - couldn't use it with new magisk template

Added dynamic xbin like with priv-app

Renamed DYNAMICOREO to DYNAMICLIB

Fixed out of space issues with magisk 18.1 and older when using compression in zip

Updated to new magisk template - MOUNTPATH renamed to MODULEROOT, INSTALLER renamed to TMPDIR, config.sh renamed to install.sh, not compatible with magisk versions older than 18 (Please read revised instructions on homepage)

Renamed install and uninstall files to unity_install.sh and unity_uninstall.sh resepctively in common
[Android Software Development] mindlery:
Good morning, sir. I just applied your update and was unable to boot (tried 10 times) but from recovery i deleted the app folder and all is well. Just gonna grab the log.
[Android Software Development] mindlery:
Here you go.

*edit*

Sorry. That's why posting from my phone is a bad idea. Totally wrong thread.
[Android Software Development] Zackptg5:
Pushed a quick hotfix for some boot script variables. Sorry about that :/

Also added boot script variables to wiki, should've added that long ago: https://github.com/Zackptg5/Unity/wiki/Variables
[Android Software Development] Zackptg5:
Last hotfix hopefully. Small typo in uninstall.sh, just replace the file
[Android Software Development] Peter1212:
How can I install unity installer modules without volume keys? I'm trying to put the flags which might bypass the volume key press but somehow it's not working. Can I get some help in installing the viper4fx and audio compatibility patch?
[Android Software Development] Zackptg5:
This belongs in the mod specific threads but you need to flash in twrp. Magisk manager renames the zip when flashed so zipname triggers won't work there
[Android Software Development] Peter1212:
Got the same results, it asks for volume keys once again. I'll check out the specific thread too and post this query there then.
[Android Software Development] Zackptg5:
Unity v4.1 has been released! This is a super minor update with 2 bug fixes and some minor scripting changes to keep in line with magisk 19.1. Changelog:

Bug fix in uninstall.sh

Bug fix for LOS Su detection

Update scripting and tools to magisk 19.1

So what files changed/do you need to update?

uninstall.sh

common/unityfiles/util_functions.sh

Pretty straightforward update. Magisk changed the way it mounts partitions: there's a new function called mount_part (which you can use if needbe). It's very straightforward. For example:

mount_part /odm

Wiki is of course update with these changes

Also, ramdisk patcher addon has been updated too
[Android Software Development] Zackptg5:
Quick hotfix to util_functions.sh. Sorry about that!
[Android Software Development] Zackptg5:
So in case anyone else is trying to pull original (before magisk mount change) files in a magisk install, here's the layout:

The directory is: /sbin/.magisk/mirror

Folders in it:

system = original system

vendor = original vendor

these always hold true but they can be symlinks instead if:

Devices with no vendor partition:

vendor = symlink to mirror system/vendor

System as root devices (this is where things get weird):

system_root = original system_root or whatever you call it - contains both original system and vendor folders

system = symlink to mirror system_root/system

The vendor setup varies based on if the device has a separate vendor partition or not. If it does:

vendor = symlink to mirror system_root/vendor

system_root/vendor = original vendor

system_root/system/vendor = symlink to /vendor -> Not what you want, this is mounted stuff

If it doesn't:

vendor = symlink to mirror system_root/system/vendor

system_root/vendor = symlink to /system/vendor -> Not what you want, this is mounted stuff

The source code for these mirror paths is in this file: https://github.com/topjohnwu/Magisk/blob/master/native/jni/core/bootstages.cpp

Note that with unity, this goofy stuff is done for you so you can instead do something like:

if $BOOTMODE; then
CFGS="$(find /system /vendor -type f -name "*audio_effects*.conf" -o -name "*audio_effects*.xml")"
else
CFGS="$(find -L /system -type f -name "*audio_effects*.conf" -o -name "*audio_effects*.xml")"
fi
for OFILE in ${CFGS}; do
FILE="$UNITY$(echo $OFILE | sed "s|^/vendor|/system/vendor|g")"
cp_ch -i $ORIGDIR$OFILE $FILE
# Patch files here
done

So what we did was first set the CFGS variable to a list of all system and vendor audio_effects

Then we looped through each file and changed any files from /vendor partition to /system/vendor for proper copying to magisk path (and works fine on system installs since /system/vendor symlinks to /vendor)

Then we copied the original file to the destination ($UNITY/system/vendor/whatever file is)

$ORIGDIR is equal to /sbin/.magisk/mirror (or nothing if system install) and as you can see in the notes on mirror paths above, mirror system and vendor are always equal to or symlinked to the original, unmodified by magisk mount system and vendor directories

The more you know :)
[Android Software Development] Zackptg5:
Updated Unity to v4.2! Quite a few changes here actually, see usual location for changelog: https://github.com/Zackptg5/Unity/wiki/Changelog