bug fix
This commit is contained in:
@@ -18,7 +18,7 @@ if [[ -d $(magisk --path 2>/dev/null) ]]; then
|
||||
else
|
||||
echo "Magisk busybox Path does not exist"
|
||||
fi ; export PATH="$PATH"
|
||||
backup_version="V11.7"
|
||||
backup_version="V11.8"
|
||||
#設置二進制命令目錄位置
|
||||
[[ $bin_path = "" ]] && echo "未正確指定bin.sh位置" && exit 2
|
||||
#bin_path="${bin_path/'/storage/emulated/'/'/data/media/'}"
|
||||
@@ -83,10 +83,12 @@ fi
|
||||
export PATH="$filepath:$PATH"
|
||||
export TZ=Asia/Taipei
|
||||
TMPDIR="/data/local/tmp"
|
||||
[[ ! -d $TMPDIR ]] && mkdir "$TMPDIR"
|
||||
if [[ $(which busybox) = "" ]]; then
|
||||
echo "環境變量中沒有找到busybox 請在tools/bin內添加一個\narm64可用的busybox\n或是安裝搞機助手 scene或是Magisk busybox模塊...."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Open_apps="$(appinfo -o ands -ta c)"
|
||||
#下列為自定義函數
|
||||
Set_back() {
|
||||
@@ -165,4 +167,95 @@ if [[ $(pm path ice.message) = "" ]]; then
|
||||
echoRgb "未安裝toast 開始安裝" "0"
|
||||
cp -r "${bin_path%/*}/apk"/*.apk "$TMPDIR" && pm install --user 0 -r "$TMPDIR"/*.apk &>/dev/null && rm -rf "$TMPDIR"/*
|
||||
[[ $? = 0 ]] && echoRgb "安裝toast成功" "1" || echoRgb "安裝toast失敗" "0"
|
||||
fi
|
||||
zippath="$(find "$MODDIR" -maxdepth 1 -name "*.zip" -type f)"
|
||||
curl -Lks https://api.github.com/repos/YAWAsau/backup_script/releases/latest | jq -r '.tag_name'>"$bin_path/tag" ; tag="$(cat "$bin_path/tag" 2>/dev/null)"
|
||||
if [[ $? = 0 ]]; then
|
||||
if [[ $backup_version != $tag ]]; then
|
||||
echoRgb "發現新版本 從GitHub更新 版本:$tag"
|
||||
curl -Lks -o "$MODDIR/$tag.zip" "https://gh.api.99988866.xyz/$(curl -Lks "https://api.github.com/repos/YAWAsau/backup_script/releases/latest" | sed -r -n 's/.*"browser_download_url": *"(.*.zip)".*/\1/p')"
|
||||
echo_log "下載$tag.zip"
|
||||
if [[ $result = 0 ]]; then
|
||||
zippath="$(find "$MODDIR" -maxdepth 1 -name "*.zip" -type f)"
|
||||
GitHub="true"
|
||||
else
|
||||
echoRgb "請手動將備份腳本壓縮包放置在\n -$MODDIR後再次執行腳本進行更新" "0" && exit 2
|
||||
fi
|
||||
else
|
||||
echoRgb "本地版本:$backup_version 線上版本:$tag 版本一致無須更新"
|
||||
fi
|
||||
else
|
||||
echoRgb "curl or jq其中之一發生錯誤 無法下載" "0" && exit 1
|
||||
fi
|
||||
if [[ $zippath != "" ]]; then
|
||||
case $(echo "$zippath" | wc -l) in
|
||||
1)
|
||||
[[ $GitHub != true ]] && echoRgb "從$zippath更新"
|
||||
if [[ $(unzip -l "$zippath" | awk '{print $4}' | grep -oE "^backup_settings.conf$") = "" ]]; then
|
||||
echoRgb "${zippath##*/}並非指定的備份zip,請刪除後重新放置\n -何謂更新zip? 就是GitHub release頁面下載的zip" "0"
|
||||
else
|
||||
cp -r "$tools_path" "$TMPDIR" && rm -rf "$tools_path"
|
||||
unzip -o "$zippath" -d "$MODDIR"
|
||||
echo_log "解壓縮${zippath##*/}"
|
||||
if [[ $result = 0 ]]; then
|
||||
case $MODDIR in
|
||||
*Backup_*)
|
||||
if [[ -f $MODDIR/app_details ]]; then
|
||||
mv "$MODDIR/tools" "${MODDIR%/*}"
|
||||
echoRgb "更新當前${MODDIR##*/}目錄下恢復相關腳本+外部tools目錄"
|
||||
cp -r "$tools_path/script/Get_DirName" "${MODDIR%/*}/掃描資料夾名.sh"
|
||||
cp -r "$tools_path/script/restore" "${MODDIR%/*}/還原備份.sh"
|
||||
[[ -d ${MODDIR%/}/媒體 ]] && cp -r "$tools_path/script/restore3" "${MODDIR%/*}/媒體/恢復多媒體數據.sh"
|
||||
. "$MODDIR/app_details"
|
||||
if [[ $PackageName != "" ]]; then
|
||||
cp -r "$tools_path/script/restore2" "$MODDIR/還原備份.sh"
|
||||
else
|
||||
cp -r "$tools_path/script/restore3" "${MODDIR%/*}/媒體/恢復多媒體數據.sh"
|
||||
fi
|
||||
else
|
||||
echoRgb "更新當前${MODDIR##*/}目錄下恢復相關腳本+tools目錄"
|
||||
cp -r "$tools_path/script/Get_DirName" "$MODDIR/掃描資料夾名.sh"
|
||||
cp -r "$tools_path/script/restore" "$MODDIR/還原備份.sh"
|
||||
[[ -d $MODDIR/媒體 ]] && 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"
|
||||
[[ $PackageName != "" ]] && cp -r "$tools_path/script/restore2" "$REPLY/還原備份.sh"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
rm -rf "$tools_path/script" "$tools_path/bin/zip" "$MODDIR/backup_settings.conf" "$MODDIR/備份應用.sh" "$MODDIR/生成應用列表.sh" ;;
|
||||
*)
|
||||
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"
|
||||
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"
|
||||
[[ -d $backup_path/媒體 ]] && 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"
|
||||
[[ $PackageName != "" ]] && cp -r "$tools_path/script/restore2" "$REPLY/還原備份.sh"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
else
|
||||
echoRgb "更新當前${MODDIR##*/}目錄下備份相關腳本+tools目錄"
|
||||
fi ;;
|
||||
esac
|
||||
rm -rf "$TMPDIR"/*
|
||||
else
|
||||
cp -r "$TMPDIR/tools" "$MODDIR" && rm -rf "$TMPDIR"/*
|
||||
fi
|
||||
find "$MODDIR" -maxdepth 1 -name "*.zip" -type f -exec rm -rf {} \;
|
||||
echoRgb "更新完成 請重新執行腳本" "2" && exit
|
||||
fi ;;
|
||||
*)
|
||||
echoRgb "錯誤 請刪除當前目錄多餘zip\n -保留一個最新的數據備份.zip\n -下列為當前目錄zip\n$(find "$MODDIR" -maxdepth 1 -name "*.zip" -type f)" "0" && exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
3154
tools/bin/cacert.pem
Normal file
3154
tools/bin/cacert.pem
Normal file
File diff suppressed because it is too large
Load Diff
3
tools/bin/curl
Normal file
3
tools/bin/curl
Normal file
@@ -0,0 +1,3 @@
|
||||
export LD_LIBRARY_PATH=${0%/*}
|
||||
export CURL_CA_BUNDLE=${0%/*}/cacert.pem
|
||||
exec ${0%/*}/curl.elf "$@"
|
||||
BIN
tools/bin/curl.elf
Normal file
BIN
tools/bin/curl.elf
Normal file
Binary file not shown.
BIN
tools/bin/libcrypto.so
Normal file
BIN
tools/bin/libcrypto.so
Normal file
Binary file not shown.
BIN
tools/bin/libcrypto.so.1.1
Normal file
BIN
tools/bin/libcrypto.so.1.1
Normal file
Binary file not shown.
BIN
tools/bin/libcurl.so
Normal file
BIN
tools/bin/libcurl.so
Normal file
Binary file not shown.
BIN
tools/bin/libnghttp2.so
Normal file
BIN
tools/bin/libnghttp2.so
Normal file
Binary file not shown.
BIN
tools/bin/libssh2.so
Normal file
BIN
tools/bin/libssh2.so
Normal file
Binary file not shown.
BIN
tools/bin/libssl.so
Normal file
BIN
tools/bin/libssl.so
Normal file
Binary file not shown.
BIN
tools/bin/libssl.so.1.1
Normal file
BIN
tools/bin/libssl.so.1.1
Normal file
Binary file not shown.
2
tools/bin/openssl
Normal file
2
tools/bin/openssl
Normal file
@@ -0,0 +1,2 @@
|
||||
export LD_LIBRARY_PATH=${0%/*}
|
||||
exec ${0%/*}/openssl.elf "$@"
|
||||
BIN
tools/bin/openssl.elf
Normal file
BIN
tools/bin/openssl.elf
Normal file
Binary file not shown.
@@ -1,6 +1,8 @@
|
||||
#!/system/bin/sh
|
||||
MODDIR="${0%/*}"
|
||||
tools_path="${MODDIR%/*}/tools"
|
||||
bin_path="$MODDIR/tools/bin"
|
||||
[[ ! -d $tools_path ]] && echo "$tools_path目錄遺失" && exit 1
|
||||
[[ ! -d $bin_path ]] && echo "$bin_path目錄遺失" && exit 1
|
||||
txt="$MODDIR/應用列表.txt"
|
||||
. "$bin_path/bin.sh"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/system/bin/sh
|
||||
MODDIR="${0%/*}"
|
||||
tools_path="$MODDIR/tools"
|
||||
bin_path="$MODDIR/tools/bin"
|
||||
[[ ! -d $tools_path ]] && echo "$tools_path目錄遺失" && exit 1
|
||||
[[ ! -d $bin_path ]] && echo "$bin_path目錄遺失" && exit 1
|
||||
[[ ! -f $MODDIR/recover.conf ]] && echo "recover.conf遺失" && exit 1
|
||||
. "$bin_path/bin.sh"
|
||||
@@ -9,7 +11,6 @@ isBoolean "$Recovery_mode" && Recovery_mode="$nsx"
|
||||
[[ $Recovery_mode = false ]] && echoRgb "當前恢復模式:安裝apk不恢復數據" "0" || echoRgb "當前恢復模式:安裝apk+恢復數據" "1"
|
||||
path="/data/media/0/Android"
|
||||
path2="/data/data"
|
||||
[[ ! -d $TMPDIR ]] && mkdir "$TMPDIR"
|
||||
[[ ! -d $path2 ]] && echoRgb "設備不存在user目錄" "0" && exit 1
|
||||
[[ ! -d ${bin_path%/*}/apk ]] && echo "${bin_path%/*}/apk目錄遺失" && exit 1
|
||||
i=1
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/system/bin/sh
|
||||
MODDIR="${0%/*}"
|
||||
tools_path="${MODDIR%/*}/tools"
|
||||
bin_path="${MODDIR%/*}/tools/bin"
|
||||
[[ ! -d $tools_path ]] && echo "$tools_path目錄遺失" && exit 1
|
||||
[[ ! -d $bin_path ]] && echo "$bin_path目錄遺失" && exit 1
|
||||
[[ ! -f $MODDIR/recover.conf ]] && echo "recover.conf遺失" && exit 1
|
||||
. "$MODDIR/recover.conf"
|
||||
@@ -9,7 +11,6 @@ isBoolean "$Recovery_mode" && Recovery_mode="$nsx"
|
||||
[[ $Recovery_mode = false ]] && echoRgb "當前恢復模式:安裝apk不恢復數據" "0" || echoRgb "當前恢復模式:安裝apk+恢復數據" "1"
|
||||
path="/data/media/0/Android"
|
||||
path2="/data/data"
|
||||
[[ ! -d $TMPDIR ]] && mkdir "$TMPDIR"
|
||||
[[ ! -d $path2 ]] && echoRgb "設備不存在user目錄" "0" && exit 1
|
||||
[[ $(restorecon --help 2>/dev/null) = "" ]] && echoRgb "restorecon命令不存在" "0" && exit 1
|
||||
#記錄開始時間
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/system/bin/sh
|
||||
MODDIR="${0%/*}"
|
||||
app_details="$MODDIR/app_details"
|
||||
tools_path="${tools_path%/*}/tools"
|
||||
bin_path="${MODDIR%/*}/tools/bin"
|
||||
[[ ! -d $tools_path ]] && echo "$tools_path目錄遺失" && exit 1
|
||||
[[ ! -d $bin_path ]] && echo "$bin_path目錄遺失" && exit 1
|
||||
. "$bin_path/bin.sh"
|
||||
#記錄開始時間
|
||||
|
||||
6
備份應用.sh
6
備份應用.sh
@@ -41,7 +41,6 @@ i=1
|
||||
#數據目錄
|
||||
path="/data/media/0/Android"
|
||||
path2="/data/user/0"
|
||||
[[ ! -d $TMPDIR ]] && mkdir "$TMPDIR"
|
||||
if [[ $path3 = true ]]; then
|
||||
Backup="$PWD/Backup_$Compression_method"
|
||||
txt="$PWD/應用列表.txt"
|
||||
@@ -72,7 +71,7 @@ if [[ $PU != "" ]]; then
|
||||
data="/dev/block/vold/$PU"
|
||||
mountinfo="$(df -T "$data" | awk 'END{print $1}')"
|
||||
case $mountinfo in
|
||||
exfat|NTFS|ext4)
|
||||
fuseblk|exfat|NTFS|ext4)
|
||||
echoRgb "於隨身碟備份 檔案系統:$mountinfo" "1"
|
||||
;;
|
||||
*)
|
||||
@@ -87,9 +86,8 @@ fi
|
||||
[[ $Backup_obb_data = false ]] && echoRgb "當前backup_settings.conf的\n -Backup_obb_data為0將不備份外部數據" "0"
|
||||
[[ ! -d $Backup ]] && mkdir -p "$Backup"
|
||||
[[ ! -f $Backup/應用列表.txt ]] && echo "#不需要恢復還原的應用請在開頭注釋# 比如#xxxxxxxx 酷安" >"$Backup/應用列表.txt"
|
||||
[[ ! -f $Backup/本地一鍵更新腳本.sh ]] && cp -r "$MODDIR/本地一鍵更新腳本.sh" "$Backup"
|
||||
[[ ! -f $Backup/recover.conf ]] && cp -r "$script_path/recover.conf" "$Backup"
|
||||
[[ ! -d $Backup/tools ]] && cp -r "$tools_path" "$Backup" && rm -rf "$Backup/tools/META-INF" "$Backup/tools/script"
|
||||
[[ ! -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"
|
||||
filesize="$(du -ks "$Backup" | awk '{print $1}')"
|
||||
|
||||
73
本地一鍵更新腳本.sh
73
本地一鍵更新腳本.sh
@@ -1,73 +0,0 @@
|
||||
MODDIR="${0%/*}"
|
||||
#鏈接腳本設置環境變量
|
||||
tools_path="$MODDIR/tools"
|
||||
bin_path="$tools_path/bin"
|
||||
[[ $(echo "$MODDIR" | grep -v 'mt') = "" ]] && echo "我他媽骨灰給你揚了撒了TM不解壓縮?用毛線 憨批" && exit 1
|
||||
[[ ! -d $tools_path ]] && echo " $tools_path目錄遺失" && exit 1
|
||||
. "$bin_path/bin.sh"
|
||||
zippath="$(find "$MODDIR" -maxdepth 1 -name "*.zip" -type f)"
|
||||
if [[ $zippath != "" ]]; then
|
||||
case $(echo "$zippath" | wc -l) in
|
||||
1)
|
||||
echoRgb "從$zippath更新" ;;
|
||||
*)
|
||||
echoRgb "錯誤 請刪除當前目錄多餘zip\n -保留一個最新的數據備份.zip\n -下列為當前目錄zip\n$(find "$MODDIR" -maxdepth 1 -name "*.zip" -type f)" "0" && exit 1 ;;
|
||||
esac
|
||||
else
|
||||
echoRgb "從GitHub更新"
|
||||
down -s -A s "https://api.github.com/repos/YAWAsau/backup_script/releases/latest" | jq -r '.tag_name'>"$bin_path/tag" ; tag="$(cat "$bin_path/tag" 2>/dev/null)"
|
||||
if [[ $backup_version != $(down -s -A s "https://api.github.com/repos/YAWAsau/backup_script/releases/latest" | jq -r '.tag_name') ]]; then
|
||||
down -o "$MODDIR/$tag.zip" "https://gh.api.99988866.xyz/$(down -s -A s "https://api.github.com/repos/YAWAsau/backup_script/releases/latest" | sed -r -n 's/.*"browser_download_url": *"(.*.zip)".*/\1/p')"
|
||||
echo_log "下載$tag.zip"
|
||||
if [[ $result = 0 ]]; then
|
||||
zippath="$(find "$MODDIR" -maxdepth 1 -name "*.zip" -type f)"
|
||||
else
|
||||
echoRgb "請手動將備份腳本壓縮包放置在\n -$MODDIR後再次執行腳本進行更新" "0" && exit 2
|
||||
fi
|
||||
else
|
||||
echoRgb "本地版本:$backup_version 線上版本:$tag 版本一致無須更新" && exit
|
||||
fi
|
||||
fi
|
||||
[[ $(unzip -l "$zippath" | awk '{print $4}' | grep -oE "^backup_settings.conf$") = "" ]] && echoRgb "${zippath##*/}並非指定的備份zip" "0" && exit 2
|
||||
unzip -o "$zippath" -d "$MODDIR"
|
||||
echo_log "解壓縮${zippath##*/}"
|
||||
if [[ $result = 0 ]]; then
|
||||
case $MODDIR in
|
||||
*Backup_*)
|
||||
echoRgb "更新當前${MODDIR##*/}目錄下恢復相關腳本+tools目錄"
|
||||
cp -r "$tools_path/script/Get_DirName" "$MODDIR/掃描資料夾名.sh"
|
||||
cp -r "$tools_path/script/restore" "$MODDIR/還原備份.sh"
|
||||
[[ -d $MODDIR/媒體 ]] && 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"
|
||||
[[ $PackageName != "" ]] && cp -r "$tools_path/script/restore2" "$REPLY/還原備份.sh"
|
||||
fi
|
||||
done
|
||||
rm -rf "$tools_path/script" "$tools_path/META-INF" "$tools_path/bin/zip" "$MODDIR/backup_settings.conf" "$MODDIR/備份應用.sh" "$MODDIR/生成應用列表.sh" ;;
|
||||
*)
|
||||
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"
|
||||
cp -r "$tools_path" "$backup_path" && rm -rf "$backup_path/tools/bin/zip" "$backup_path/tools/META-INF" "$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/媒體 ]] && 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"
|
||||
[[ $PackageName != "" ]] && cp -r "$tools_path/script/restore2" "$REPLY/還原備份.sh"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
else
|
||||
echoRgb "更新當前${MODDIR##*/}目錄下備份相關腳本+tools目錄"
|
||||
fi ;;
|
||||
esac
|
||||
fi
|
||||
find "$MODDIR" -maxdepth 1 -name "*.zip" -type f -exec rm -rf {} \;
|
||||
Reference in New Issue
Block a user