兼容MT2500/MT3000/MT6000的备份与还原
This commit is contained in:
parent
a80e0e1ab0
commit
58b9389fa9
@ -7,17 +7,38 @@ blue() { echo -e "\033[34m\033[01m[MESSAGE] $1\033[0m"; }
|
||||
light_magenta() { echo -e "\033[95m\033[01m[NOTICE] $1\033[0m"; }
|
||||
light_yellow() { echo -e "\033[93m\033[01m[NOTICE] $1\033[0m"; }
|
||||
|
||||
restore() {
|
||||
# 检查文件传输是否已安装
|
||||
check_istoreos_style_installed() {
|
||||
# 检查luci-app-filetransfer的一些关键文件是否存在
|
||||
CHECK_FILES="/usr/lib/lua/luci/controller/filetransfer.lua
|
||||
/usr/lib/lua/luci/view/filetransfer
|
||||
/usr/lib/lua/luci/model/cbi/filetransfer"
|
||||
|
||||
# 设置一个标记,用来表示文件是否找到
|
||||
FOUND=0
|
||||
|
||||
for FILE in $CHECK_FILES; do
|
||||
if [ -e "$FILE" ]; then
|
||||
FOUND=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $FOUND -eq 1 ]; then
|
||||
echo "luci-app-filetransfer is installed."
|
||||
else
|
||||
# 先恢复到一键iStoreOS风格化
|
||||
wget -O /tmp/restore.sh https://gitee.com/wukongdaily/gl_onescript/raw/master/restore.sh && sh /tmp/restore.sh
|
||||
fi
|
||||
}
|
||||
|
||||
# 恢复标准的iStoreOS
|
||||
normal_restore() {
|
||||
mkdir -p /tmp/upload/restore
|
||||
# 检查backup.tar.gz文件是否存在
|
||||
if [ -f /tmp/upload/backup.tar.gz ]; then
|
||||
tar -xzvf /tmp/upload/backup.tar.gz -C /tmp/upload/restore
|
||||
cd /tmp/upload/restore
|
||||
# 恢复软件源配置
|
||||
cp distfeeds.conf /etc/opkg/distfeeds.conf
|
||||
# 恢复已安装软件列表
|
||||
opkg update
|
||||
cat packages-list.txt | cut -f 1 -d ' ' | xargs opkg install
|
||||
# 恢复overlay
|
||||
tar -xzvf overlay_backup.tar.gz -C /
|
||||
green "恢复已完成, 系统正在重启....."
|
||||
@ -26,7 +47,22 @@ restore() {
|
||||
red "请将恢复文档backup.tar.gz上传到/tmp/upload目录再重试。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
restore() {
|
||||
model_info=$(cat /tmp/sysinfo/model)
|
||||
green "型号:$model_info"
|
||||
case "$model_info" in
|
||||
*2500* | *3000* | *6000*)
|
||||
check_istoreos_style_installed
|
||||
normal_restore
|
||||
;;
|
||||
*)
|
||||
echo "Router name does not contain '3000', '6000', or '2500'."
|
||||
normal_restore
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
restore
|
||||
restore
|
Loading…
Reference in New Issue
Block a user