mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 18:15:30 +00:00
Rename sepolicy.rules -> rules
This commit is contained in:
parent
1c2fcd14b5
commit
7048aa1014
@ -43,10 +43,10 @@ data class LocalModule(
|
||||
set(enable) {
|
||||
if (enable) {
|
||||
disableFile.delete()
|
||||
Shell.cmd("copy_sepolicy_rules").submit()
|
||||
Shell.cmd("copy_rules").submit()
|
||||
} else {
|
||||
!disableFile.createNewFile()
|
||||
Shell.cmd("copy_sepolicy_rules").submit()
|
||||
Shell.cmd("copy_rules").submit()
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,10 +56,10 @@ data class LocalModule(
|
||||
if (remove) {
|
||||
if (updateFile.exists()) return
|
||||
removeFile.createNewFile()
|
||||
Shell.cmd("copy_sepolicy_rules").submit()
|
||||
Shell.cmd("copy_rules").submit()
|
||||
} else {
|
||||
removeFile.delete()
|
||||
Shell.cmd("copy_sepolicy_rules").submit()
|
||||
Shell.cmd("copy_rules").submit()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ direct_install() {
|
||||
rm -f $1/new-boot.img
|
||||
fix_env $1
|
||||
run_migrations
|
||||
copy_sepolicy_rules
|
||||
copy_rules
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ static void mount_mirrors() {
|
||||
restorecon();
|
||||
}
|
||||
|
||||
// check and mount sepolicy.rules
|
||||
// check and mount rules
|
||||
if (struct stat st{}; stat((MAGISKTMP + "/" BLOCKDIR "/rules").data(), &st) == 0 && (st.st_mode & S_IFBLK)) {
|
||||
dev_t rules_dev = st.st_rdev;
|
||||
for (const auto &info: self_mount_info) {
|
||||
@ -153,7 +153,7 @@ dev_t find_rules_device() {
|
||||
}
|
||||
|
||||
if (!custom_rules_dir.empty()) {
|
||||
auto rules_dir = getenv("MAGISKTMP") + "/sepolicy.rules"s;
|
||||
auto rules_dir = getenv("MAGISKTMP") + "/rules"s;
|
||||
mkdirs(custom_rules_dir.data(), 0700);
|
||||
mkdirs(rules_dir.data(), 0700);
|
||||
xmount(custom_rules_dir.data(), rules_dir.data(), nullptr, MS_BIND, nullptr);
|
||||
|
@ -18,7 +18,7 @@
|
||||
extern std::string MAGISKTMP;
|
||||
#define INTLROOT ".magisk"
|
||||
#define MIRRDIR INTLROOT "/mirror"
|
||||
#define RULESDIR INTLROOT "/sepolicy.rules"
|
||||
#define RULESDIR INTLROOT "/rules"
|
||||
#define BLOCKDIR INTLROOT "/block"
|
||||
#define WORKERDIR INTLROOT "/worker"
|
||||
#define MODULEMNT INTLROOT "/modules"
|
||||
|
@ -133,15 +133,15 @@ static void mount_rules_dir(string path, dev_t rules_dev) {
|
||||
// Create bind mount
|
||||
xmkdirs(RULESDIR, 0);
|
||||
if (access(custom_rules_dir.data(), F_OK)) {
|
||||
LOGW("empty sepolicy.rules: %s\n", custom_rules_dir.data());
|
||||
LOGW("empty rules: %s\n", custom_rules_dir.data());
|
||||
} else {
|
||||
LOGD("sepolicy.rules: %s\n", custom_rules_dir.data());
|
||||
LOGD("rules: %s\n", custom_rules_dir.data());
|
||||
xmount(custom_rules_dir.data(), RULESDIR, nullptr, MS_BIND, nullptr);
|
||||
mount_list.emplace_back(path += "/" RULESDIR);
|
||||
}
|
||||
xumount2(MIRRDIR "/rules", MNT_DETACH);
|
||||
} else {
|
||||
PLOGE("Failed to mount sepolicy.rules %u:%u", major(rules_dev), minor(rules_dev));
|
||||
PLOGE("Failed to mount rules %u:%u", major(rules_dev), minor(rules_dev));
|
||||
unlink(BLOCKDIR "/rules");
|
||||
}
|
||||
}
|
||||
|
@ -296,13 +296,6 @@ mount_partitions() {
|
||||
|
||||
# Allow /system/bin commands (dalvikvm) on Android 10+ in recovery
|
||||
$BOOTMODE || mount_apex
|
||||
|
||||
# Mount sepolicy rules dir locations in recovery (best effort)
|
||||
if ! $BOOTMODE; then
|
||||
mount_name "cache cac" /cache
|
||||
mount_name metadata /metadata
|
||||
mount_name persist /persist
|
||||
fi
|
||||
}
|
||||
|
||||
# loop_setup <ext4_img>, sets LOOPDEV
|
||||
@ -636,10 +629,10 @@ run_migrations() {
|
||||
done
|
||||
}
|
||||
|
||||
copy_sepolicy_rules() {
|
||||
local RULESDIR=$(magisk --path)/.magisk/sepolicy.rules
|
||||
copy_rules() {
|
||||
local RULESDIR=$(magisk --path)/.magisk/rules
|
||||
if ! grep -q " $RULESDIR " /proc/mounts; then
|
||||
ui_print "- Unable to find sepolicy rules dir"
|
||||
ui_print "- Unable to find rules dir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -792,10 +785,10 @@ install_module() {
|
||||
cp -af $MODPATH/module.prop $NVBASE/modules/$MODID/module.prop
|
||||
fi
|
||||
|
||||
# Copy over custom sepolicy rules
|
||||
# Copy over custom rules
|
||||
if [ -f $MODPATH/sepolicy.rule ]; then
|
||||
ui_print "- Installing custom sepolicy rules"
|
||||
copy_sepolicy_rules
|
||||
copy_rules
|
||||
fi
|
||||
|
||||
# Remove stuff that doesn't belong to modules and clean up any empty directories
|
||||
|
Loading…
Reference in New Issue
Block a user