Magisk Module Template Extended (MMT-Ex) [TEMPLATE]

Zackptg5

Recognized Developer
Sep 18, 2014
4,062
6,626
263
zackptg5.com
In the past couple years, magisk has come a long ways to the point that it's the de-facto root solution. I have been developing and maintaining the Unity template for the past couple years but it's now reached a point where there's no longer a need for it - it's simply not worth the effort anymore. There are very few use cases where someone would want to stay rootless and still install a bunch of mods and every other root solution is pretty much deprecated at this point. So I switched gears from Unity to a magisk only template.

Consider this the spiritual successor of the Unity Template

So what is Magisk Module Template Extended (MMT-Ex)?
MMT-Ex is just as the name describes - it's the magisk module template but with the best features of Unity added to it

What does this mean?
This means that MMT-Ex is an easy way to make a magisk module regardless of how basic or advanced it is.

Where do I start?
Follow the readme on the main repo here and you'll be setup in no time

Questions?
Post them here, I'll try to help out when I have the chance but hopefully you won't have any
 

MarcAnt01

Senior Member
Jun 26, 2018
240
286
0
@Zackptg5 I write here since there's no issue section in the repo, but there are two uninstall.sh files, one in common and the other one in the main directory, I think that's a bit confusing.
My ideas would be:
-merge the two files;
- rename the one in common in remove.sh , MMT-exuninstall.sh or similar names
 

Zackptg5

Recognized Developer
Sep 18, 2014
4,062
6,626
263
zackptg5.com
@Zackptg5 I write here since there's no issue section in the repo, but there are two uninstall.sh files, one in common and the other one in the main directory, I think that's a bit confusing.
My ideas would be:
-merge the two files;
- rename the one in common in remove.sh , MMT-exuninstall.sh or similar names
I could do a better drop explaining things in the wiki
The one in root gets copied as is to modpath and will uninstall any files outside modpath if removed via magisk manager
The one in common is like the old unity_uninstall one. The only reason I had the common ones named unity_whatever back in the day is because one of the past magisk module templates unzipped everything with the -j option (ignores directories) and so files would overwrite each other if they had the same name

I disabled issues on most of my repos because noobs would post stupid stuff on it so I redirected all support to here instead
 
Last edited:

aer0zer0

Recognized Contributor
Sep 20, 2013
3,277
2,493
253
Cortland NY
I could do a better drop explaining things in the wiki
The one in root gets copied as is to modpath and will uninstall any files outside modpath if removed via magisk manager
The one in common is like the old unity_uninstall one. The only reason I had the common ones named unity_whatever back in the day is because one of the past magisk module templates unzipped everything with the -j option (ignores directories) and so files would overwrite each other if they had the same name

I disabled issues on most of my repos because noobs would post stupid stuff on it so I redirected all support to here instead
So far so good here.
 
  • Like
Reactions: Zackptg5

aer0zer0

Recognized Contributor
Sep 20, 2013
3,277
2,493
253
Cortland NY
@Zackptg5 it appears system.prop and sepolicy.rule still need to be placed in the root of the mod, and not in common in order to propagate on-device.

Which is fine, as i know thats how to fix it. But wasnt sure if that was your intent, it sounds like you want everything running script-wise out of common (which makes sense). Attached my magisk log, and my mod has a new sepolicy.rule and system.prop. I tried this the way i maentioned above and every loads as it should.
 

Attachments

Zackptg5

Recognized Developer
Sep 18, 2014
4,062
6,626
263
zackptg5.com
@Zackptg5 it appears system.prop and sepolicy.rule still need to be placed in the root of the mod, and not in common in order to propagate on-device.

Which is fine, as i know thats how to fix it. But wasnt sure if that was your intent, it sounds like you want everything running script-wise out of common (which makes sense). Attached my magisk log, and my mod has a new sepolicy.rule and system.prop. I tried this the way i maentioned above and every loads as it should.
Common folder scripts should copy over but I've seen this issue in another module. I'll look into it later this week when I'm off work

Hello, if I develop a Module with your template, I will be able to install it on my device. But I don't think it will be accepted as a valid module submission here (https://github.com/Magisk-Modules-Repo/submission/issues) because it does not respect the new module format.

Can you confirm?
mmtex is the new template with some modifications so you shouldn't have any problems there
 

TotallyAnxious

Senior Member
Aug 3, 2013
2,418
1,995
188
That's on of the modifications I made although there appears to be a bug with it that I'll need to work out
If I was to guess it would be something in lines 208-214 of the functions.sh. but I'm way to stoned to be of any actual assistance.

Edit: Clearly too stoned. I meant to reply to the system.prop not being applied when in common not what I actually replied to lol
 

TotallyAnxious

Senior Member
Aug 3, 2013
2,418
1,995
188
Found the problem real quick. Seems I mixed up Unity with MMT-Ex logic:
The main boot scripts and such (service.sh, post-fs-data.sh, sepolicy.rule, and system.prop) should all be in root of installer like with regular template. Any extras can go into common. I'll push an update to the wiki on that shortly
That was my second guess!
 
  • Like
Reactions: tech_infinity

aer0zer0

Recognized Contributor
Sep 20, 2013
3,277
2,493
253
Cortland NY
Found the problem real quick. Seems I mixed up Unity with MMT-Ex logic:
The main boot scripts and such (service.sh, post-fs-data.sh, sepolicy.rule, and system.prop) should all be in root of installer like with regular template. Any extras can go into common. I'll push an update to the wiki on that shortly
that did the trick, much appreciated.
 

Zackptg5

Recognized Developer
Sep 18, 2014
4,062
6,626
263
zackptg5.com
MMT-Ex has been updated to v1.2! I anticipate this being the last update for a while unless something comes up - think I got it at a good state.
Changelog can be found same place as always: https://github.com/Zackptg5/MMT-Extended/wiki/Changelog

Some notable changes are:
MMT-Ex now has the same behavior as mainstream magisk module template - it always uninstalls/installs Furthermore, to simplify things, it'll only work in magisk manager. If you flash it in TWRP, it'll trigger automatic removal - this was kept in as a save from a module causing a bootloop
common/uninstall and upgrade scripts are gone now - no need for them anymore. There are very few instances where you'd need custom uninstall logic now since MMT-Ex handles all file removal automatically but if you do have something, you can place it in the TOP of the uninstall file at root of installer
ORIGVEN variable is gone - turns out that original vendor is always $ORIGDIR/vendor so you can just use that
 

mrjuniork

Forum Moderator
Staff member
Aug 29, 2015
964
958
123
MMT-Ex has been updated to v1.2! I anticipate this being the last update for a while unless something comes up - think I got it at a good state.
Changelog can be found same place as always: https://github.com/Zackptg5/MMT-Extended/wiki/Changelog

Some notable changes are:
MMT-Ex now has the same behavior as mainstream magisk module template - it always uninstalls/installs Furthermore, to simplify things, it'll only work in magisk manager. If you flash it in TWRP, it'll trigger automatic removal - this was kept in as a save from a module causing a bootloop
common/uninstall and upgrade scripts are gone now - no need for them anymore. There are very few instances where you'd need custom uninstall logic now since MMT-Ex handles all file removal automatically but if you do have something, you can place it in the TOP of the uninstall file at root of installer
ORIGVEN variable is gone - turns out that original vendor is always $ORIGDIR/vendor so you can just use that
Took you a while to find a proper avatar.. :p