Skip to content

Commit 31e9918

Browse files
use magisk denylist mode to fetch unmodified configuration files
1 parent 9b550eb commit 31e9918

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

magiskmodule/customize.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ rmi() {
1414
[ -f "$file" ] && rm "$file"
1515
}
1616

17+
denylist_run() {
18+
[ -z "$KSU" ] && [ "$MAGISK_VER_CODE" -ge 27000 ] && magisk --denylist exec "$@" && return
19+
"$@"
20+
}
21+
1722
# Create the scoped storage directory
1823
mkdir -p "$FOLDER"
1924

@@ -129,16 +134,18 @@ for ORIGINAL_FILE in $AUDIO_EFFECTS_FILES; do
129134
ORIGINAL_FILE="$SEARCH_ROOT"/"$ORIGINAL_FILE"
130135
case "$FILE" in
131136
*.conf)
137+
denylist_run cat "$ORIGINAL_FILE" | \
132138
sed \
133139
-e "s|^effects {|effects {\n $LIBRARY_NAME {\n library $EFFECT_NAME\n uuid $EFFECT_UUID\n }|" \
134140
-e "s|^libraries {|libraries {\n $EFFECT_NAME {\n path $LIBRARY_FILE_PATH\n }|" \
135-
< "$ORIGINAL_FILE" > "$FILE"
141+
> "$FILE"
136142
;;
137143
*.xml)
144+
denylist_run cat "$ORIGINAL_FILE" | \
138145
sed \
139146
-e "s|<libraries>|<libraries>\n <library name=\"$EFFECT_NAME\" path=\"$LIBRARY_FILE\"/>|" \
140147
-e "s|<effects>|<effects>\n <effect name=\"$LIBRARY_NAME\" library=\"$EFFECT_NAME\" uuid=\"$EFFECT_UUID\"/>|" \
141-
< "$ORIGINAL_FILE" > "$FILE"
148+
> "$FILE"
142149
;;
143150
esac
144151
osp_detect "$FILE"

0 commit comments

Comments
 (0)