Skip to content

Commit

Permalink
Merge pull request #2 from AkinaAcct/dev
Browse files Browse the repository at this point in the history
merge Dev to main
  • Loading branch information
AkinaAcct authored Sep 15, 2024
2 parents b245966 + da85480 commit 988f879
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
11 changes: 8 additions & 3 deletions AAP.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#by Akina | LuoYan
#2024-06-03 Rewrite
#shellcheck disable=SC2059,SC2086,SC2166
Expand Down Expand Up @@ -57,14 +57,15 @@ print_help() {
printf "${BLUE}%s${RESET}\n\n" "
APatch Auto Patch Tool
Written by Akina
Version: 5.0.0
Version: 6.0.0
Current DIR: $(pwd)
-h, -v, print the usage and version.
-i [BOOT IMAGE PATH], specify a boot image path.
-k [RELEASE NAME], specify a kernelpatch version [RELEASE NAME].
-d /PATH/TO/DIR specify a folder containing kptools and kpimg as the kptools to be used.
-s \"STRING\", specify a superkey. Use STRING as superkey.
-K, Specify the KPMs to be embedded.
-I, directly install to current slot after patch.
-S, Install to another slot (for OTA).
-E [ARGS], Add args [ARGS] to kptools when patching."
Expand All @@ -86,7 +87,7 @@ In addition, you can use \`APTOOLDEBUG=1 ${0} [ARGS]\` format to enter verbose m

# 参数解析
DOWNLOADKP=true
while getopts ":hvi:k:IVs:Sd:E:" OPT; do
while getopts ":hvi:k:KIVs:Sd:E:" OPT; do
case $OPT in
h | v)
print_help
Expand All @@ -107,6 +108,10 @@ while getopts ":hvi:k:IVs:Sd:E:" OPT; do
fi
done
;;
K)
EMBEDKPMS=true
msg_info "The -K parameter was received. Will embed KPMs."
;;
i)
BOOTPATH="$(realpath ${OPTARG})"
if [ -e "${BOOTPATH}" ]; then
Expand Down
23 changes: 21 additions & 2 deletions AAPFunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#rewrited
#shellcheck disable=SC2086
get_device_boot() {
Expand Down Expand Up @@ -73,8 +73,27 @@ get_tools() {
done
fi
}

analyze_kpms_path() {
unset KPMP # Reset array KPMP
while true; do
msg_info "Now enter your KPMs' path(Enter \"done\" to finish this operation): "
read TKPM
if [ "${TKPM}" = "done" ]; then
break
fi
KPMP+=($(realpath ${TKPM}))
msg_info "Current seleted KPMs: ${KPMP[*]}"
msg_info "Totally: ${#KPMP[@]}"
done
for i in "${KPMP[@]}"; do
EXTRAARGS+=" --embed-extra-path=$i --extra-type=kpm"
done
msg_info "Current EXTRAARGS: ${EXTRAARGS}"
}
patch_boot() {
if [ "${EMBEDKPMS}" = "true" ]; then
analyze_kpms_path
fi
msg_info "Unpacking image..."
./magiskboot unpack boot${BOOTSUFFIX}.img
EXITSTATUS=$?
Expand Down

0 comments on commit 988f879

Please sign in to comment.