This commit is contained in:
Yawasau
2022-07-09 09:29:27 +08:00
parent 9a35179caa
commit 97322fab3f
3 changed files with 70 additions and 64 deletions

View File

@@ -48,7 +48,7 @@ else
echo "Magisk busybox Path does not exist"
fi
export PATH="$PATH"
backup_version="V15.5.6"
backup_version="V15.5.7"
#設置二進制命令目錄位置
if [[ $bin_path = "" ]]; then
echoRgb "未正確指定bin.sh位置" "0"
@@ -243,12 +243,12 @@ update_script() {
if [[ $(unzip -l "$zipFile" | awk '{print $4}' | egrep -o "^backup_settings.conf$") = "" ]]; then
echoRgb "${zipFile##*/}並非指定的備份zip請刪除後重新放置\n -何謂更新zip? 就是GitHub release頁面下載的zip" "0"
else
unzip -o "$zipFile" -j "tools/bin/bin.sh" -d "$MODDIR"
unzip -o "$zipFile" -j "tools/bin/bin.sh" -d "$MODDIR" &>/dev/null
if [[ $(expr "$(echo "$backup_version" | tr -d "a-zA-Z")" \> "$(cat "$MODDIR/bin.sh" | awk '/backup_version/{print $1}' | cut -f2 -d '=' | head -1 | sed 's/\"//g' | tr -d "a-zA-Z")") -eq 0 ]]; then
echoRgb "$zipFile更新"
cp -r "$tools_path" "$TMPDIR" && rm -rf "$tools_path"
find "$MODDIR" -maxdepth 3 -name "*.sh" -type f -exec rm -rf {} \;
unzip -o "$zipFile" -x "backup_settings.conf" -d "$MODDIR"
unzip -o "$zipFile" -x "backup_settings.conf" -d "$MODDIR" | sed 's/inflating/釋放/g ; s/creating/創建/g ; s/Archive/解壓縮/g'
echo_log "解壓縮${zipFile##*/}"
if [[ $result = 0 ]]; then
case $MODDIR in
@@ -360,7 +360,7 @@ update_script() {
echoRgb "更新完成 請重新執行腳本" "2"
exit
else
echoRgb "${zipFile##*/}版本低於當前版本,自動刪除"
echoRgb "${zipFile##*/}版本低於當前版本,自動刪除" "0"
rm -rf "$zipFile" "$MODDIR/bin.sh"
fi
fi

View File

@@ -203,7 +203,7 @@ backup_path() {
data="/dev/block/vold/$PU"
mountinfo="$(df -T "${Backup%/*}" | sed -n 's|% /.*|%|p' | awk '{print $(NF-4)}')"
case $mountinfo in
fuseblk | exfat | NTFS | ext4 | f2fs)
sdfat | fuseblk | exfat | NTFS | ext4 | f2fs)
outshow="於隨身碟備份" && hx=usb
;;
*)
@@ -408,6 +408,8 @@ Backup_data() {
echo "$1Size=\"$(du -ks "$data_path" | awk '{print $1}')\"" >>"$app_details"
fi
fi
else
rm -rf "$Backup_folder/$1".tar.*
fi
fi
[[ $Compression_method1 != "" ]] && Compression_method="$Compression_method1"
@@ -570,9 +572,9 @@ get_name(){
txt="${txt/'/storage/emulated/'/'/data/media/'}"
[[ $1 = Apkname ]] && rm -rf *.txt && echoRgb "列出全部資料夾內應用名與自定義目錄壓縮包名稱" "3"
rgb_a=118
find "$MODDIR" -maxdepth 1 -type d 2>/dev/null | sort | while read; do
find "$MODDIR" -maxdepth 2 -name "app_details" -type f 2>/dev/null | sort | while read; do
REPLY="${REPLY%/*}"
[[ $rgb_a -ge 229 ]] && rgb_a=118
if [[ -f $REPLY/app_details ]]; then
if [[ ${REPLY##*/} = Media && $1 = Apkname ]]; then
echoRgb "存在媒體資料夾" "2"
[[ ! -f $txt2 ]] && echo "#不需要恢復的資料夾請在開頭注釋# 比如#媒體" > "$txt2"
@@ -628,7 +630,6 @@ get_name(){
esac
fi
fi
fi
let rgb_a++
done
[[ $1 = Apkname ]] && sort -u "$txt" -o "$txt" 2>/dev/null && echoRgb "$txt重新生成" "1"
@@ -650,13 +651,16 @@ Check_archive() {
rm -rf "$error_log"
FIND_PATH="$(find "$1" -maxdepth 3 -name "*.tar*" -type f 2>/dev/null | sort)"
i=1
r="$(echo "$FIND_PATH" | wc -l)"
while [[ $i -le $r ]]; do
unset REPLY
REPLY="$(echo "$FIND_PATH" | sed -n "${i}p")"
r="$(find "$MODDIR" -maxdepth 2 -name "app_details" -type f 2>/dev/null | wc -l)"
find "$MODDIR" -maxdepth 2 -name "app_details" -type f 2>/dev/null | sort | while read; do
REPLY="${REPLY%/*}"
echoRgb "效驗第$i/$r個資料夾 剩下$((r - i))" "3"
echoRgb "效驗:${REPLY##*/}"
find "$REPLY" -maxdepth 1 -name "*.tar*" -type f 2>/dev/null | sort | while read; do
Validation_file "$REPLY"
[[ $result != 0 ]] && echo "效驗失敗:$MODDIR_NAME/$1">>"$error_log"
echoRgb "$i/$r個剩$((r - i))$((i * 100 / r))%"
done
echoRgb "$((i * 100 / r))%"
let i++ nskg++
done
endtime 1
@@ -1131,6 +1135,9 @@ Restore3)
rm -rf "$TMPDIR/scriptTMP"
;;
Getlist)
case $MODDIR in
/storage/emulated/0/Android/* | /data/media/0/Android/* | /sdcard/Android/*) echoRgb "請勿在$MODDIR內生成列表" "0" && exit 2 ;;
esac
#效驗選填是否正確
isBoolean "$Lo" "Lo" && Lo="$nsx"
isBoolean "$debug_list" "debug_list" && debug_list="$nsx"
@@ -1246,7 +1253,6 @@ backup_media)
echoRgb "完成$((A * 100 / B))% $hx$(echo "$Occupation_status" | awk 'END{print "剩餘:"$1"使用率:"$2}')" "2" && echoRgb "____________________________________" && let A++
done
Calculate_size "$Backup_folder"
echoRgb "目錄↓↓↓\n -$Backup_folder"
endtime 1 "自定義備份"
else
echoRgb "自定義路徑為空 無法備份" "0"

Binary file not shown.