优化备份和恢复数据库路径

没有修改前会读取指定位置的数据库路径,如果在使用过程中修改了数据库文件路径再备份指定位置的数据库就没有意义了
This commit is contained in:
dev
2025-04-03 14:42:46 +00:00
parent a594a32b2a
commit b5271fef34
+12 -6
View File
@@ -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