From b5271fef349d6b76e6a04db0729a7f9d4ada5222 Mon Sep 17 00:00:00 2001 From: dev Date: Thu, 3 Apr 2025 14:42:46 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=87=E4=BB=BD=E5=92=8C?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E6=95=B0=E6=8D=AE=E5=BA=93=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 没有修改前会读取指定位置的数据库路径,如果在使用过程中修改了数据库文件路径再备份指定位置的数据库就没有意义了 --- luci-app-easytier/Makefile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/luci-app-easytier/Makefile b/luci-app-easytier/Makefile index 8ad40cc..1a97f5f 100644 --- a/luci-app-easytier/Makefile +++ b/luci-app-easytier/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_VERSION:=2.2.4 -PKG_RELEASE:=1 +PKG_RELEASE:=2 LUCI_TITLE:=LuCI support for EasyTier LUCI_DEPENDS:=+kmod-tun @@ -22,16 +22,21 @@ if [ -f /etc/config/easytier ] ; then echo "不重启设备之前再次安装luci-app-easytier 配置不丢失,不用重新配置" mv -f /etc/config/easytier /tmp/easytier_backup fi + if [ -f /etc/easytier/config.toml ] ; then echo "备份easytier配置文件/etc/easytier/config.toml到/tmp/et_config_backup.toml" echo "不重启设备之前再次安装luci-app-easytier 配置不丢失,不用重新配置" - mv -f /etc/easytier/config.toml /tmp/et_config_backup.toml + mv -f /etc/easytier/config.toml /tmp/et_config_backup.toml fi -if [ -f /etc/easytier/et.db ] ; then - echo "备份easytier数据库/etc/easytier/et.db到/tmp/et_backup.db" - echo "不重启设备之前再次安装luci-app-easytier 配置不丢失,不用重新配置" - mv -f /etc/easytier/et.db /tmp/et_backup.db + +DB_PATH=$$(uci -q get easytier.@easytierweb[0].db_path) +if [ -n "$$DB_PATH" ] && [ -f "$$DB_PATH" ]; then + echo "数据库 $$DB_PATH 已备份到 /tmp/et_backup.db" + mv -f "$$DB_PATH" /tmp/et_backup.db +else + echo "未找到数据库文件,跳过备份!" fi + if [ -f /etc/easytier/et_machine_id ] ; then echo "备份easytier UUID /etc/easytier/et_machine_id到/tmp/et_machine_id_backup" echo "不重启设备之前再次安装luci-app-easytier UUID不丢失,不用重新配置" @@ -54,6 +59,7 @@ if [ -f /tmp/et_config_backup.toml ] ; then fi if [ -f /tmp/et_backup.db ] ; then echo "发现easytier备份数据库/tmp/et_backup.db,开始恢复到/etc/easytier/et.db" + echo "警告:如果卸载之前修改过easytier数据库路径,请手动将/etc/easytier/et.db复制到修改过的数据库文件路径位置,如不想修改请将数据库路径还原为/etc/easytier/et.db" mv -f /tmp/et_backup.db /etc/easytier/et.db echo "请前往 VPN - EasyTier 界面进行重启插件" fi