This commit is contained in:
Yawasau
2022-05-26 01:21:04 +08:00
parent 1853d6b773
commit 939a7a302e
4 changed files with 167 additions and 146 deletions

View File

@@ -4,7 +4,7 @@
Lo=0 Lo=0
#備份時檢查資料夾是否存在已經卸載應用 有則音量鍵選擇刪除或是移動到恢復資料夾/被卸載的應用 #備份時檢查資料夾是否存在已經卸載應用 有則音量鍵選擇刪除或是移動到恢復資料夾/被卸載的應用
delete_folder=0 delete_folder=1
#自定義備份目錄輸出位置 (忽略為空將默認腳本路徑中) #自定義備份目錄輸出位置 (忽略為空將默認腳本路徑中)
Output_path= Output_path=

View File

@@ -48,7 +48,7 @@ else
echo "Magisk busybox Path does not exist" echo "Magisk busybox Path does not exist"
fi fi
export PATH="$PATH" export PATH="$PATH"
backup_version="V14.9" backup_version="V15.2"
#設置二進制命令目錄位置 #設置二進制命令目錄位置
if [[ $bin_path = "" ]]; then if [[ $bin_path = "" ]]; then
echoRgb "未正確指定bin.sh位置" "0" echoRgb "未正確指定bin.sh位置" "0"
@@ -213,128 +213,131 @@ Open_apps="$(appinfo -d "(" -ed ")" -o ands,pn -ta c 2>/dev/null)"
Open_apps2="$(echo "$Open_apps" | cut -f2 -d '(' | sed 's/)//g')" Open_apps2="$(echo "$Open_apps" | cut -f2 -d '(' | sed 's/)//g')"
raminfo="$(awk '($1 == "MemTotal:"){print $2/1000"MB"}' /proc/meminfo 2>/dev/null)" raminfo="$(awk '($1 == "MemTotal:"){print $2/1000"MB"}' /proc/meminfo 2>/dev/null)"
echoRgb "\n ----------------------------\n -當前腳本執行路徑:$MODDIR\n -busybox路徑:$(which busybox)\n -busybox版本:$(busybox | head -1 | awk '{print $2}')\n -appinfo版本:$(appinfo --version)\n -腳本版本:$backup_version\n -Magisk版本:$(cat "/data/adb/magisk/util_functions.sh" 2>/dev/null | grep "MAGISK_VER_CODE" | cut -f2 -d '=')\n -設備架構:$abi\n -品牌:$(getprop ro.product.brand 2>/dev/null)\n -設備代號:$(getprop ro.product.device 2>/dev/null)\n -型號:$(getprop ro.product.model 2>/dev/null)\n -RAM:$raminfo\n -閃存類型:$ROM_TYPE\n -閃存顆粒:$UFS_MODEL\n -Android版本:$(getprop ro.build.version.release 2>/dev/null) SDK:$(getprop ro.build.version.sdk 2>/dev/null)\n -終端:$Open_apps\n -By@YAWAsau\n -Support: https://jq.qq.com/?_wv=1027&k=f5clPNC3" echoRgb "\n ----------------------------\n -當前腳本執行路徑:$MODDIR\n -busybox路徑:$(which busybox)\n -busybox版本:$(busybox | head -1 | awk '{print $2}')\n -appinfo版本:$(appinfo --version)\n -腳本版本:$backup_version\n -Magisk版本:$(cat "/data/adb/magisk/util_functions.sh" 2>/dev/null | grep "MAGISK_VER_CODE" | cut -f2 -d '=')\n -設備架構:$abi\n -品牌:$(getprop ro.product.brand 2>/dev/null)\n -設備代號:$(getprop ro.product.device 2>/dev/null)\n -型號:$(getprop ro.product.model 2>/dev/null)\n -RAM:$raminfo\n -閃存類型:$ROM_TYPE\n -閃存顆粒:$UFS_MODEL\n -Android版本:$(getprop ro.build.version.release 2>/dev/null) SDK:$(getprop ro.build.version.sdk 2>/dev/null)\n -終端:$Open_apps\n -By@YAWAsau\n -Support: https://jq.qq.com/?_wv=1027&k=f5clPNC3"
zippath="$(find "$MODDIR" -maxdepth 1 -name "*.zip" -type f 2>/dev/null)" update_script() {
if [[ $zippath != "" ]]; then zippath="$(find "$MODDIR" -maxdepth 1 -name "*.zip" -type f 2>/dev/null)"
case $(echo "$zippath" | wc -l) in if [[ $zippath != "" ]]; then
1) case $(echo "$zippath" | wc -l) in
[[ $GitHub != true ]] && echoRgb "$zippath更新" 1)
if [[ $(unzip -l "$zippath" | awk '{print $4}' | grep -oE "^backup_settings.conf$") = "" ]]; then [[ $GitHub != true ]] && echoRgb "$zippath更新"
echoRgb "${zippath##*/}並非指定的備份zip請刪除後重新放置\n -何謂更新zip? 就是GitHub release頁面下載的zip" "0" if [[ $(unzip -l "$zippath" | awk '{print $4}' | grep -oE "^backup_settings.conf$") = "" ]]; then
else echoRgb "${zippath##*/}並非指定的備份zip請刪除後重新放置\n -何謂更新zip? 就是GitHub release頁面下載的zip" "0"
cp -r "$tools_path" "$TMPDIR" && rm -rf "$tools_path" else
find "$MODDIR" -maxdepth 3 -name "*.sh" -type f -exec rm -rf {} \; cp -r "$tools_path" "$TMPDIR" && rm -rf "$tools_path"
unzip -o "$zippath" -x "backup_settings.conf" -d "$MODDIR" find "$MODDIR" -maxdepth 3 -name "*.sh" -type f -exec rm -rf {} \;
echo_log "解壓縮${zippath##*/}" unzip -o "$zippath" -x "backup_settings.conf" -d "$MODDIR"
if [[ $result = 0 ]]; then echo_log "解壓縮${zippath##*/}"
case $MODDIR in if [[ $result = 0 ]]; then
*Backup_*) case $MODDIR in
if [[ -f $MODDIR/app_details ]]; then *Backup_*)
mv "$MODDIR/tools" "${MODDIR%/*}" if [[ -f $MODDIR/app_details ]]; then
echoRgb "更新當前${MODDIR##*/}目錄下恢復相關腳本+外部tools目錄與腳本" mv "$MODDIR/tools" "${MODDIR%/*}"
cp -r "$tools_path/script/Get_DirName" "${MODDIR%/*}/重新生成應用列表.sh" echoRgb "更新當前${MODDIR##*/}目錄下恢復相關腳本+外部tools目錄與腳本"
cp -r "$tools_path/script/restore" "${MODDIR%/*}/恢復備份.sh" cp -r "$tools_path/script/Get_DirName" "${MODDIR%/*}/重新生成應用列表.sh"
cp -r "$MODDIR/終止腳本.sh" "${MODDIR%/*}/終止腳本.sh" cp -r "$tools_path/script/restore" "${MODDIR%/*}/恢復備份.sh"
[[ -d ${MODDIR%/*}/Media ]] && cp -r "$tools_path/script/restore3" "${MODDIR%/*}/恢復自定義資料夾.sh" cp -r "$MODDIR/終止腳本.sh" "${MODDIR%/*}/終止腳本.sh"
find "${MODDIR%/*}" -maxdepth 1 -type d | sort | while read; do [[ -d ${MODDIR%/*}/Media ]] && cp -r "$tools_path/script/restore3" "${MODDIR%/*}/恢復自定義資料夾.sh"
if [[ -f $REPLY/app_details ]]; then find "${MODDIR%/*}" -maxdepth 1 -type d | sort | while read; do
unset PackageName if [[ -f $REPLY/app_details ]]; then
. "$REPLY/app_details" &>/dev/null unset PackageName
if [[ $PackageName != "" ]]; then . "$REPLY/app_details" &>/dev/null
cp -r "$tools_path/script/restore2" "$REPLY/$PackageName.sh" if [[ $PackageName != "" ]]; then
else cp -r "$tools_path/script/restore2" "$REPLY/$PackageName.sh"
if [[ ${REPLY##*/} != Media ]]; then else
NAME="${REPLY##*/}" if [[ ${REPLY##*/} != Media ]]; then
NAME="${NAME%%.*}" NAME="${REPLY##*/}"
[[ $NAME != "" ]] && cp -r "$tools_path/script/restore2" "$REPLY/$NAME.sh" NAME="${NAME%%.*}"
fi [[ $NAME != "" ]] && cp -r "$tools_path/script/restore2" "$REPLY/$NAME.sh"
fi
fi
done
if [[ -d ${MODDIR%/*/*}/tools && -f ${MODDIR%/*/*}/備份應用.sh ]]; then
echoRgb "更新${MODDIR%/*/*}/tools與備份相關腳本"
rm -rf "${MODDIR%/*/*}/tools"
find "${MODDIR%/*/*}" -maxdepth 1 -name "*.sh" -type f -exec rm -rf {} \;
mv "$MODDIR/備份應用.sh" "$MODDIR/生成應用列表.sh" "$MODDIR/備份自定義資料夾.sh" "$MODDIR/終止腳本.sh" "${MODDIR%/*/*}"
cp -r "$tools_path" "${MODDIR%/*/*}"
fi
rm -rf "$MODDIR/終止腳本.sh"
else
echoRgb "更新當前${MODDIR##*/}目錄下恢復相關腳本+tools目錄"
cp -r "$tools_path/script/Get_DirName" "$MODDIR/重新生成應用列表.sh"
cp -r "$tools_path/script/restore" "$MODDIR/恢復備份.sh"
[[ -d $MODDIR/Media ]] && cp -r "$tools_path/script/restore3" "$MODDIR/恢復自定義資料夾.sh"
find "$MODDIR" -maxdepth 1 -type d | sort | while read; do
if [[ -f $REPLY/app_details ]]; then
unset PackageName
. "$REPLY/app_details" &>/dev/null
if [[ $PackageName != "" ]]; then
cp -r "$tools_path/script/restore2" "$REPLY/$PackageName.sh"
else
if [[ ${REPLY##*/} != Media ]]; then
NAME="${REPLY##*/}"
NAME="${NAME%%.*}"
[[ $NAME != "" ]] && cp -r "$tools_path/script/restore2" "$REPLY/$NAME.sh"
fi
fi
fi
done
if [[ -d ${MODDIR%/*}/tools && -f ${MODDIR%/*}/備份應用.sh ]]; then
echoRgb "更新${MODDIR%/*}/tools與備份相關腳本"
rm -rf "${MODDIR%/*}/tools"
find "${MODDIR%/*}" -maxdepth 1 -name "*.sh" -type f -exec rm -rf {} \;
cp -r "$MODDIR/備份應用.sh" "$MODDIR/終止腳本.sh" "$MODDIR/生成應用列表.sh" "$MODDIR/備份自定義資料夾.sh" "${MODDIR%/*}"
cp -r "$tools_path" "${MODDIR%/*}"
fi
fi
rm -rf "$MODDIR/備份自定義資料夾.sh" "$MODDIR/生成應用列表.sh" "$MODDIR/備份應用.sh" "$tools_path/script"
;;
*)
if [[ $(find "$MODDIR" -maxdepth 1 -name "Backup_*" -type d) != "" ]]; then
find "$MODDIR" -maxdepth 1 -name "Backup_*" -type d | while read backup_path; do
if [[ -d $backup_path && $backup_path != $MODDIR ]]; then
echoRgb "更新當前目錄下備份相關腳本&tools目錄+${backup_path##*/}內tools目錄+恢復腳本+tools"
rm -rf "$backup_path/tools"
cp -r "$tools_path" "$backup_path" && rm -rf "$backup_path/tools/bin/zip" "$backup_path/tools/script"
cp -r "$tools_path/script/restore" "$backup_path/恢復備份.sh"
cp -r "$tools_path/script/Get_DirName" "$backup_path/重新生成應用列表.sh"
cp -r "$MODDIR/終止腳本.sh" "$backup_path/終止腳本.sh"
[[ -d $backup_path/Media ]] && cp -r "$tools_path/script/restore3" "$backup_path/恢復自定義資料夾.sh"
find "$MODDIR" -maxdepth 2 -type d | sort | while read; do
if [[ -f $REPLY/app_details ]]; then
unset PackageName
. "$REPLY/app_details" &>/dev/null
if [[ $PackageName != "" ]]; then
cp -r "$tools_path/script/restore2" "$REPLY/$PackageName.sh"
else
if [[ ${REPLY##*/} != Media ]]; then
NAME="${REPLY##*/}"
NAME="${NAME%%.*}"
[[ $NAME != "" ]] && cp -r "$tools_path/script/restore2" "$REPLY/$NAME.sh"
fi
fi fi
fi fi
done fi
done
if [[ -d ${MODDIR%/*/*}/tools && -f ${MODDIR%/*/*}/備份應用.sh ]]; then
echoRgb "更新${MODDIR%/*/*}/tools與備份相關腳本"
rm -rf "${MODDIR%/*/*}/tools"
find "${MODDIR%/*/*}" -maxdepth 1 -name "*.sh" -type f -exec rm -rf {} \;
mv "$MODDIR/備份應用.sh" "$MODDIR/生成應用列表.sh" "$MODDIR/備份自定義資料夾.sh" "$MODDIR/終止腳本.sh" "${MODDIR%/*/*}"
cp -r "$tools_path" "${MODDIR%/*/*}"
fi fi
done rm -rf "$MODDIR/終止腳本.sh"
else else
echoRgb "更新當前${MODDIR##*/}目錄下備份相關腳本+tools目錄" echoRgb "更新當前${MODDIR##*/}目錄下恢復相關腳本+tools目錄"
fi cp -r "$tools_path/script/Get_DirName" "$MODDIR/重新生成應用列表.sh"
;; cp -r "$tools_path/script/restore" "$MODDIR/恢復備份.sh"
esac [[ -d $MODDIR/Media ]] && cp -r "$tools_path/script/restore3" "$MODDIR/恢復自定義資料夾.sh"
else find "$MODDIR" -maxdepth 1 -type d | sort | while read; do
cp -r "$TMPDIR/tools" "$MODDIR" if [[ -f $REPLY/app_details ]]; then
unset PackageName
. "$REPLY/app_details" &>/dev/null
if [[ $PackageName != "" ]]; then
cp -r "$tools_path/script/restore2" "$REPLY/$PackageName.sh"
else
if [[ ${REPLY##*/} != Media ]]; then
NAME="${REPLY##*/}"
NAME="${NAME%%.*}"
[[ $NAME != "" ]] && cp -r "$tools_path/script/restore2" "$REPLY/$NAME.sh"
fi
fi
fi
done
if [[ -d ${MODDIR%/*}/tools && -f ${MODDIR%/*}/備份應用.sh ]]; then
echoRgb "更新${MODDIR%/*}/tools與備份相關腳本"
rm -rf "${MODDIR%/*}/tools"
find "${MODDIR%/*}" -maxdepth 1 -name "*.sh" -type f -exec rm -rf {} \;
cp -r "$MODDIR/備份應用.sh" "$MODDIR/終止腳本.sh" "$MODDIR/生成應用列表.sh" "$MODDIR/備份自定義資料夾.sh" "${MODDIR%/*}"
cp -r "$tools_path" "${MODDIR%/*}"
fi
fi
rm -rf "$MODDIR/備份自定義資料夾.sh" "$MODDIR/生成應用列表.sh" "$MODDIR/備份應用.sh" "$tools_path/script"
;;
*)
if [[ $(find "$MODDIR" -maxdepth 1 -name "Backup_*" -type d) != "" ]]; then
find "$MODDIR" -maxdepth 1 -name "Backup_*" -type d | while read backup_path; do
if [[ -d $backup_path && $backup_path != $MODDIR ]]; then
echoRgb "更新當前目錄下備份相關腳本&tools目錄+${backup_path##*/}內tools目錄+恢復腳本+tools"
rm -rf "$backup_path/tools"
cp -r "$tools_path" "$backup_path" && rm -rf "$backup_path/tools/bin/zip" "$backup_path/tools/script"
cp -r "$tools_path/script/restore" "$backup_path/恢復備份.sh"
cp -r "$tools_path/script/Get_DirName" "$backup_path/重新生成應用列表.sh"
cp -r "$MODDIR/終止腳本.sh" "$backup_path/終止腳本.sh"
[[ -d $backup_path/Media ]] && cp -r "$tools_path/script/restore3" "$backup_path/恢復自定義資料夾.sh"
find "$MODDIR" -maxdepth 2 -type d | sort | while read; do
if [[ -f $REPLY/app_details ]]; then
unset PackageName
. "$REPLY/app_details" &>/dev/null
if [[ $PackageName != "" ]]; then
cp -r "$tools_path/script/restore2" "$REPLY/$PackageName.sh"
else
if [[ ${REPLY##*/} != Media ]]; then
NAME="${REPLY##*/}"
NAME="${NAME%%.*}"
[[ $NAME != "" ]] && cp -r "$tools_path/script/restore2" "$REPLY/$NAME.sh"
fi
fi
fi
done
fi
done
else
echoRgb "更新當前${MODDIR##*/}目錄下備份相關腳本+tools目錄"
fi
;;
esac
else
cp -r "$TMPDIR/tools" "$MODDIR"
fi
rm -rf "$TMPDIR"/*
find "$MODDIR" -maxdepth 1 -name "*.zip" -type f -exec rm -rf {} \;
echoRgb "更新完成 請重新執行腳本" "2"
exit
fi fi
rm -rf "$TMPDIR"/* ;;
find "$MODDIR" -maxdepth 1 -name "*.zip" -type f -exec rm -rf {} \; *)
echoRgb "更新完成 請重新執行腳本" "2" echoRgb "錯誤 請刪除當前目錄多餘zip\n -保留一個最新的數據備份.zip\n -下列為當前目錄zip\n$zippath" "0"
exit exit 1
fi ;;
;; esac
*) fi
echoRgb "錯誤 請刪除當前目錄多餘zip\n -保留一個最新的數據備份.zip\n -下列為當前目錄zip\n$zippath" "0" unset NAME
exit 1 }
;; update_script
esac
fi
unset NAME
#buzexe /data/tmp false tools.sh #buzexe /data/tmp false tools.sh

View File

@@ -21,6 +21,13 @@ fi
[[ $EXIT = true ]] && exit 1 [[ $EXIT = true ]] && exit 1
. "$conf_path" . "$conf_path"
. "$bin_path/bin.sh" . "$bin_path/bin.sh"
zipFile="$(ls -t /storage/emulated/0/Download/*.zip 2>/dev/null | head -1)"
FILE_NAME="${zipFile##*/}"
if [[ $(unzip -l "$zipFile" | awk '{print $4}' | grep -oE "^backup_settings.conf$") != "" ]]; then
echoRgb "發現$zipFile\n移動並解壓縮中...."
mv "$zipFile" "$MODDIR"
update_script
fi
isBoolean "$Lo" "LO" && Lo="$nsx" isBoolean "$Lo" "LO" && Lo="$nsx"
if [[ $Lo = false ]]; then if [[ $Lo = false ]]; then
isBoolean "$toast_info" "toast_info" && toast_info="$nsx" isBoolean "$toast_info" "toast_info" && toast_info="$nsx"
@@ -111,9 +118,24 @@ if [[ $json != "" ]]; then
if [[ $update = true ]]; then if [[ $update = true ]]; then
isBoolean "$update_behavior" "update_behavior" && update_behavior="$nsx" isBoolean "$update_behavior" "update_behavior" && update_behavior="$nsx"
if [[ $update_behavior = true ]]; then if [[ $update_behavior = true ]]; then
echoRgb "更新腳本步驟如下\n -1.將跳轉時下載的zip壓縮包完整不解壓縮放在$MODDIR\n -2.在$MODDIR目錄隨便執行一個腳本\n -3.假設沒有提示錯誤重新進入腳本如版本號發生變化則更新成功" "2"
am start -a android.intent.action.VIEW -d "$zip_url" am start -a android.intent.action.VIEW -d "$zip_url"
echo_log "跳轉瀏覽器" echo_log "跳轉瀏覽器"
if [[ $result = 0 ]]; then
echoRgb "等待下載中.....請儘速點擊下載 否則腳本將等待10秒後自動退出"
zipFile="$(ls -t /storage/emulated/0/Download/*.zip 2>/dev/null | head -1)"
FILE_NAME="${zipFile##*/}"
seconds=1
while [[ $(unzip -l "$zipFile" | awk '{print $4}' | grep -oE "^backup_settings.conf$") = "" ]]; do
zipFile="$(ls -t /storage/emulated/0/Download/*.zip 2>/dev/null | head -1)"
FILE_NAME="${zipFile##*/}"
echoRgb "$seconds秒"
[[ $seconds = 10 ]] && exit 2
sleep 1 && let seconds++
done
echoRgb "發現$zipFile\n移動並解壓縮中...."
mv "$zipFile" "$MODDIR"
update_script
fi
else else
echoRgb "更新腳本步驟如下\n -1.將剪貼簿內的連結用瀏覽器下載\n -2.將zip壓縮包完整不解壓縮放在$MODDIR\n -3.在$MODDIR目錄隨便執行一個腳本\n -4.假設沒有提示錯誤重新進入腳本如版本號發生變化則更新成功" "2" echoRgb "更新腳本步驟如下\n -1.將剪貼簿內的連結用瀏覽器下載\n -2.將zip壓縮包完整不解壓縮放在$MODDIR\n -3.在$MODDIR目錄隨便執行一個腳本\n -4.假設沒有提示錯誤重新進入腳本如版本號發生變化則更新成功" "2"
starttime1="$(date -u "+%s")" starttime1="$(date -u "+%s")"
@@ -251,7 +273,7 @@ Release_data() {
Path_details="$(stat -c "%A/%a %U/%G" "$X")" Path_details="$(stat -c "%A/%a %U/%G" "$X")"
chown -hR "$G:$G" "$X/" chown -hR "$G:$G" "$X/"
echo_log "設置用戶組:$(echo "$Path_details" | awk '{print $2}')" echo_log "設置用戶組:$(echo "$Path_details" | awk '{print $2}')"
restorecon -RF "$X/" >/dev/null 2>&1 restorecon -RF "$X/" 2>/dev/null
echo_log "selinux上下文設置" echo_log "selinux上下文設置"
else else
echoRgb "uid獲取失敗" "0" echoRgb "uid獲取失敗" "0"
@@ -264,11 +286,11 @@ Release_data() {
[[ -d $path/$FILE_NAME2/$name2 ]] && chmod -R 0777 "$path/$FILE_NAME2/$name2" [[ -d $path/$FILE_NAME2/$name2 ]] && chmod -R 0777 "$path/$FILE_NAME2/$name2"
;; ;;
thanox) thanox)
restorecon -RF "$(find "/data/system" -name "thanos*" -maxdepth 1 -type d 2>/dev/null)/" >/dev/null 2>&1 restorecon -RF "$(find "/data/system" -name "thanos*" -maxdepth 1 -type d 2>/dev/null)/" 2>/dev/null
echo_log "selinux上下文設置" && echoRgb "警告 thanox配置恢復後務必重啟\n -否則不生效" "0" echo_log "selinux上下文設置" && echoRgb "警告 thanox配置恢復後務必重啟\n -否則不生效" "0"
;; ;;
storage-isolation) storage-isolation)
restorecon -RF "/data/adb/storage-isolation/" >/dev/null 2>&1 restorecon -RF "/data/adb/storage-isolation/" 2>/dev/null
echo_log "selinux上下文設置" echo_log "selinux上下文設置"
;; ;;
esac esac
@@ -295,7 +317,7 @@ installapk() {
case $(find "$TMPDIR" -maxdepth 1 -name "*.apk" -type f 2>/dev/null | wc -l) in case $(find "$TMPDIR" -maxdepth 1 -name "*.apk" -type f 2>/dev/null | wc -l) in
1) 1)
echoRgb "恢復普通apk" "2" echoRgb "恢復普通apk" "2"
pm install -i com.android.vending --user 0 -r -t "$TMPDIR"/*.apk >/dev/null 2>&1 pm install -i com.android.vending --user 0 -r -t "$TMPDIR"/*.apk 2>/dev/null
echo_log "Apk安裝" echo_log "Apk安裝"
;; ;;
0) 0)
@@ -305,14 +327,14 @@ installapk() {
echoRgb "恢復split apk" "2" echoRgb "恢復split apk" "2"
b="$(pm install-create -i -i com.android.vending --user 0 2>/dev/null | grep -E -o '[0-9]+')" b="$(pm install-create -i -i com.android.vending --user 0 2>/dev/null | grep -E -o '[0-9]+')"
if [[ -f $TMPDIR/nmsl.apk ]]; then if [[ -f $TMPDIR/nmsl.apk ]]; then
pm install -i com.android.vending --user 0 -r -t"$TMPDIR/nmsl.apk" >/dev/null 2>&1 pm install -i com.android.vending --user 0 -r -t"$TMPDIR/nmsl.apk" 2>/dev/null
echo_log "nmsl.apk安裝" echo_log "nmsl.apk安裝"
fi fi
find "$TMPDIR" -maxdepth 1 -name "*.apk" -type f 2>/dev/null | grep -v 'nmsl.apk' | while read; do find "$TMPDIR" -maxdepth 1 -name "*.apk" -type f 2>/dev/null | grep -v 'nmsl.apk' | while read; do
pm install-write "$b" "${REPLY##*/}" "$REPLY" >/dev/null 2>&1 pm install-write "$b" "${REPLY##*/}" "$REPLY" 2>/dev/null
echo_log "${REPLY##*/}安裝" echo_log "${REPLY##*/}安裝"
done done
pm install-commit "$b" >/dev/null 2>&1 pm install-commit "$b" 2>/dev/null
echo_log "split Apk安裝" echo_log "split Apk安裝"
;; ;;
esac esac
@@ -336,7 +358,7 @@ backup)
if [[ $script != "" ]]; then if [[ $script != "" ]]; then
for x in zstd tar pv lz4; do for x in zstd tar pv lz4; do
pgrep -f "$x" | while read; do pgrep -f "$x" | while read; do
kill -KILL "$REPLY" >/dev/null kill -KILL "$REPLY" 2>/dev/null
done done
done done
fi fi
@@ -703,17 +725,17 @@ backup)
#設置無障礙開關 #設置無障礙開關
if [[ $var != "" ]]; then if [[ $var != "" ]]; then
if [[ $var != null ]]; then if [[ $var != null ]]; then
settings put secure enabled_accessibility_services "$var" >/dev/null 2>&1 settings put secure enabled_accessibility_services "$var" 2>/dev/null
echo_log "設置無障礙" echo_log "設置無障礙"
settings put secure accessibility_enabled 1 >/dev/null 2>&1 settings put secure accessibility_enabled 1 2>/dev/null
echo_log "打開無障礙開關" echo_log "打開無障礙開關"
fi fi
fi fi
#設置鍵盤 #設置鍵盤
if [[ $keyboard != "" ]]; then if [[ $keyboard != "" ]]; then
ime enable "$keyboard" >/dev/null 2>&1 ime enable "$keyboard" 2>/dev/null
ime set "$keyboard" >/dev/null 2>&1 ime set "$keyboard" 2>/dev/null
settings put secure default_input_method "$keyboard" >/dev/null 2>&1 settings put secure default_input_method "$keyboard" 2>/dev/null
echo_log "設置鍵盤$(appinfo -d "(" -ed ")" -o ands,pn -pn "${keyboard%/*}" 2>/dev/null)" echo_log "設置鍵盤$(appinfo -d "(" -ed ")" -o ands,pn -pn "${keyboard%/*}" 2>/dev/null)"
fi fi
echoRgb "\n -已更新的apk=\"$osn\"\n -apk版本號無變化=\"$osj\"\n -user數據已備份=\"$osx\"\n -data數據已備份=\"$osb\"\n -obb數據已備份=\"$osg\"\n -user數據不存在=\"$osz\"\n -obb數據不存在=\"$osd\"\n -obb數據不存在=\"$ose\"" "3" echoRgb "\n -已更新的apk=\"$osn\"\n -apk版本號無變化=\"$osj\"\n -user數據已備份=\"$osx\"\n -data數據已備份=\"$osb\"\n -obb數據已備份=\"$osg\"\n -user數據不存在=\"$osz\"\n -obb數據不存在=\"$osd\"\n -obb數據不存在=\"$ose\"" "3"
@@ -774,11 +796,11 @@ backup)
longToast "批量備份完成" longToast "批量備份完成"
Print "批量備份完成 執行過程請查看$Status_log" Print "批量備份完成 執行過程請查看$Status_log"
#打開應用 #打開應用
appinfo -sort-i -d "/" -o pn,sa -pn $am_start >/dev/null 2>&1 | while read; do appinfo -sort-i -d "/" -o pn,sa -pn $am_start 2>/dev/null | while read; do
am start -n "$REPLY" >/dev/null 2>&1 am start -n "$REPLY" 2>/dev/null
done done
#回到桌面 #回到桌面
#input keyevent 3 >/dev/null 2>&1 #input keyevent 3 2>/dev/null
exit 0 exit 0
} & } &
wait && exit wait && exit
@@ -860,8 +882,8 @@ Restore)
installapk installapk
else else
unset apk_version unset apk_version
apk_version="$(echo "$apk_version" | head -n 1)"
[[ -f "$Backup_folder/app_details" ]] && . "$Backup_folder/app_details" [[ -f "$Backup_folder/app_details" ]] && . "$Backup_folder/app_details"
apk_version="$(echo "$apk_version" | head -n 1)"
if [[ $apk_version -gt $(pm list packages --show-versioncode "$name2" 2>/dev/null | cut -f3 -d ':' | head -n 1) ]]; then if [[ $apk_version -gt $(pm list packages --show-versioncode "$name2" 2>/dev/null | cut -f3 -d ':' | head -n 1) ]]; then
installapk installapk
echoRgb "版本提升$(pm list packages --show-versioncode "$name2" 2>/dev/null | cut -f3 -d ':' | head -n 1)>$apk_version" "1" echoRgb "版本提升$(pm list packages --show-versioncode "$name2" 2>/dev/null | cut -f3 -d ':' | head -n 1)>$apk_version" "1"
@@ -940,13 +962,9 @@ Restore2)
name2="$PackageName" name2="$PackageName"
if [[ $name2 = "" ]]; then if [[ $name2 = "" ]]; then
Script_path="$(find "$MODDIR" -maxdepth 1 -name "*.sh*" -type f 2>/dev/null)" Script_path="$(find "$MODDIR" -maxdepth 1 -name "*.sh*" -type f 2>/dev/null)"
NAME="$(echo "${Script_path##*/}" | sed 's/.sh//g')" name2="$(echo "${Script_path##*/}" | sed 's/.sh//g')"
if [[ $NAME != "" ]]; then
name2="$NAME"
else
echoRgb "包名獲取失敗" "0" && exit 2
fi
fi fi
[[ $name2 = "" ]] && echoRgb "包名獲取失敗" "0" && exit 2
echoRgb "恢複$name1 ($name2)" "3" echoRgb "恢複$name1 ($name2)" "3"
starttime2="$(date -u "+%s")" starttime2="$(date -u "+%s")"
if [[ $(pm path "$name2" 2>/dev/null) = "" ]]; then if [[ $(pm path "$name2" 2>/dev/null) = "" ]]; then

Binary file not shown.