diff --git a/tools/bin/bin.sh b/tools/bin/bin.sh index 11a8ea4..47691a3 100644 --- a/tools/bin/bin.sh +++ b/tools/bin/bin.sh @@ -30,6 +30,7 @@ busybox2="$bin_path/busybox" #排除自身 exclude=" json +.doh busybox_path update bin.sh" @@ -201,15 +202,23 @@ if [[ $LANG != "" ]]; then else echoRgb "獲取系統語系失敗 默認簡體中文" "0" fi -down -s -L "$Language" 2>/dev/null >"$bin_path/json" +#dns="1.1.1.1,1.0.0.1" +dns="8.8.8.8" +#dns="114.114.114.114" +# Curl uses boringssl - first appeared in Marshmallow - don't try using ssl in older android versions +[[ $(getprop ro.build.version.sdk) -lt 23 ]] && alias curl="curl -kL --dns-servers $dns$flag" || alias curl="curl -L --dns-servers $dns$flag" +echoRgb "DNS:$dns" +jsonpath="$bin_path/json" +(curl "$Language" 2>/dev/null >"$jsonpath" && echoRgb "使用curl") || (down -s -L "$Language" 2>/dev/null >"$bin_path/json" && echoRgb "使用down") if [[ $? = 0 ]]; then - if [[ -f $bin_path/json && $(cat "$bin_path/json") != "" ]]; then - tag="$(cat "$bin_path/json" | sed -r -n 's/.*"tag_name": *"(.*)".*/\1/p')" - download="$(cat "$bin_path/json" | sed -r -n 's/.*"browser_download_url": *"(.*.zip)".*/\1/p')" + json="$(cat "$jsonpath")" + if [[ -f $jsonpath && $(echo "$json") != "" ]]; then + tag="$(echo "$json" | sed -r -n 's/.*"tag_name": *"(.*)".*/\1/p')" if [[ $tag != "" ]]; then if [[ $backup_version != $tag ]]; then - echoRgb "發現新版本 從GitHub更新 版本:$tag\n -更新日誌:\n$(down -s -L "https://api.github.com/repos/YAWAsau/backup_script/releases/latest" 2>/dev/null | sed -r -n 's/.*"body": *"(.*)".*/\1/p')" - down -s -L -o "$MODDIR/$tag.zip" "https://gh.api.99988866.xyz/$download" + echoRgb "發現新版本 從GitHub更新 版本:$tag\n -更新日誌:\n$(curl "https://api.github.com/repos/YAWAsau/backup_script/releases/latest" 2>/dev/null | sed -r -n 's/.*"body": *"(.*)".*/\1/p')" + download="$(echo "$json" | sed -r -n 's/.*"browser_download_url": *"(.*.zip)".*/\1/p')" + curl -O "https://gh.api.99988866.xyz/$download" || down -s -L -o "$MODDIR/$tag.zip" "https://gh.api.99988866.xyz/$download" echo_log "下載${download##*/}" if [[ $result = 0 ]]; then zippath="$(find "$MODDIR" -maxdepth 1 -name "*.zip" -type f)" @@ -221,7 +230,7 @@ if [[ $? = 0 ]]; then echoRgb "本地版本:$backup_version 線上版本:$tag 版本一致無須更新" fi fi - rm -rf "$bin_path/json" + rm -rf "$jsonpath" fi else echoRgb "更新獲取失敗" "0" @@ -235,7 +244,7 @@ if [[ $zippath != "" ]]; then else cp -r "$tools_path" "$TMPDIR" && rm -rf "$tools_path" find "$MODDIR" -maxdepth 3 -name "*.sh" -type f -exec rm -rf {} \; - unzip -o "$zippath" -d "$MODDIR" + unzip -o "$zippath" -x "backup_settings.conf" -d "$MODDIR" echo_log "解壓縮${zippath##*/}" if [[ $result = 0 ]]; then case $MODDIR in @@ -315,6 +324,6 @@ if [[ $zippath != "" ]]; then esac fi #down -s -L "https://magisk-modules-repo.github.io/submission/modules.json" | jq -r '.modules[] | {id,prop_url,zip_url}' -#down -s -L "https://magisk-modules-repo.github.io/submission/modules.json" | jq -r '.modules[].zip_url' | egrep -w "Ainur_Narsil|riru_lsposed|busybox-ndk|riru_storage_redirect|riru-core|HideNavBar" | while read; do +#down -s -L "https://magisk-modules-repo.github.io/submission/modules.json" | jq -r '.modules[].zip_url' | egrep -w "Ainur_Narsil|riru_lsposed|busybox-ndk|riru_storage_redirect|riru-core|HideNavBar|ccbins" | while read; do # down -s -L -o "$MODDIR/${REPLY##*/}" "$REPLY" #done \ No newline at end of file diff --git a/tools/bin/curl b/tools/bin/curl new file mode 100644 index 0000000..66ae61a Binary files /dev/null and b/tools/bin/curl differ diff --git a/tools/script/restore b/tools/script/restore index 970153d..9e756e7 100644 --- a/tools/script/restore +++ b/tools/script/restore @@ -199,7 +199,7 @@ while [[ $i -le $r ]]; do done rm -rf "$TMPDIR/scriptTMP" starttime1="$TIME" -echoRgb "批量恢複完成" && endtime 1 "批量恢複開始到結束" && echoRgb "應用閃退請重新開機" "0" +echoRgb "批量恢複完成" && endtime 1 "批量恢複開始到結束" && echoRgb "如發現應用閃退請重新開機" longToast "批量恢復完成" Print "批量恢復完成 執行過程請查看$Status_log" && rm -rf "$TMPDIR"/* } & \ No newline at end of file diff --git a/tools/script/restore2 b/tools/script/restore2 index 4bdb0eb..e382d3a 100644 --- a/tools/script/restore2 +++ b/tools/script/restore2 @@ -135,6 +135,6 @@ if [[ $Recovery_mode = true ]]; then echoRgb "$name2沒有安裝無法恢復數據" "0" fi fi -endtime 1 "恢複開始到結束" && echoRgb "應用閃退請重新開機" "0" && rm -rf "$TMPDIR"/* +endtime 1 "恢複開始到結束" && echoRgb "如發現應用閃退請重新開機" && rm -rf "$TMPDIR"/* rm -rf "$TMPDIR/scriptTMP" } & \ No newline at end of file diff --git a/備份應用.sh b/備份應用.sh index 59b3789..3fb43af 100644 --- a/備份應用.sh +++ b/備份應用.sh @@ -81,13 +81,11 @@ fi [[ $backup_media = false ]] && echoRgb "當前backup_settings.conf的\n -backup_media為0將不備份自定義資料夾" "0" [[ ! -d $Backup ]] && mkdir -p "$Backup" [[ ! -f $Backup/應用列表.txt ]] && echo "#不需要恢復還原的應用請在開頭注釋# 比如#xxxxxxxx 酷安" >"$Backup/應用列表.txt" -[[ ! -f $Backup/recover.conf ]] && cp -r "$script_path/recover.conf" "$Backup" [[ ! -d $Backup/tools ]] && cp -r "$tools_path" "$Backup" && rm -rf "$Backup/tools/bin/zip" "$Backup/tools/script" [[ ! -f $Backup/還原備份.sh ]] && cp -r "$script_path/restore" "$Backup/還原備份.sh" [[ ! -f $Backup/掃描資料夾名.sh ]] && cp -r "$script_path/Get_DirName" "$Backup/掃描資料夾名.sh" [[ ! -f $MODDIR/刪除已卸載備份.sh ]] && cp -r "$script_path/delete_backup" "$MODDIR/刪除已卸載備份.sh" filesize="$(du -ks "$Backup" | awk '{print $1}')" -#調用二進制 Quantity=0 #檢測apk狀態進行備份 Backup_apk() { @@ -123,6 +121,7 @@ Backup_apk() { [[ $ChineseName = "" ]] && echo "ChineseName=\"$name1\"" >>"$app_details" [[ ! -f $Backup_folder/還原備份.sh ]] && cp -r "$script_path/restore2" "$Backup_folder/還原備份.sh" [[ ! -f $Backup_folder/recover.conf ]] && cp -r "$script_path/recover.conf" "$Backup_folder" + [[ ! -f $Backup/recover.conf ]] && cp -r "$script_path/recover.conf" "$Backup" fi if [[ $name2 = com.android.chrome ]]; then #刪除所有舊apk ,保留一個最新apk進行備份