maple-upgrade (/sbin/maple-upgrade):
- Backup 21 critical configs to p4 (/mnt/mmc2-4/.maple-backup/)
- Then sysupgrade -n (skip broken backup/restore flow)
- Supports -b (backup-only), --no-backup (direct flash), -h
maple-restore (/etc/uci-defaults/99-maple-restore):
- Auto-restores configs from p4 on first boot after upgrade
- Restores: shadow, openclash, frpc, firewall, network, dhcp,
fstab, dropbear, transmission, aria2, tailscale, dockerd, etc.
- Restarts services (frpc, openclash, cron, dropbear)
- Runs once via uci-defaults, then self-deletes
Fixes the long-standing issue: sysupgrade without -n hangs due to
0-byte tgz backup + stage2 ubus deadlock. With maple-upgrade:
config is safely backed up to p4 (survives reflash), then -n flash
works perfectly, and config is restored automatically.
49 lines
1.1 KiB
Makefile
49 lines
1.1 KiB
Makefile
#
|
|
# Copyright (C) 2026 xiexiaobao
|
|
#
|
|
# This is free software, licensed under the GPL 2.0 license.
|
|
#
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
PKG_NAME:=maple-restore
|
|
PKG_VERSION:=1.0
|
|
PKG_RELEASE:=1
|
|
|
|
PKG_MAINTAINER:=xiexiaobao
|
|
PKG_LICENSE:=GPL-2.0
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
define Package/maple-restore
|
|
SECTION:=utils
|
|
CATEGORY:=Utilities
|
|
TITLE:=Auto-restore configs from p4 after MapleOS sysupgrade
|
|
PKGARCH:=all
|
|
DEPENDS:=
|
|
endef
|
|
|
|
define Package/maple-restore/description
|
|
UCI defaults script that auto-restores backed-up configs from
|
|
/mnt/mmc2-4/.maple-backup/ on first boot after a maple-upgrade.
|
|
|
|
Restores: shadow, frpc, openclash, firewall, network, dhcp, fstab,
|
|
dropbear, luci, system, uhttpd, transmission, aria2, tinyproxy,
|
|
tailscale, dockerd, crontab, and more.
|
|
|
|
Runs exactly once via uci-defaults, then self-deletes.
|
|
endef
|
|
|
|
define Build/Configure
|
|
endef
|
|
|
|
define Build/Compile
|
|
endef
|
|
|
|
define Package/maple-restore/install
|
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
|
$(INSTALL_BIN) ./files/99-maple-restore.sh $(1)/etc/uci-defaults/99-maple-restore
|
|
endef
|
|
|
|
$(eval $(call BuildPackage,maple-restore))
|