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.
51 lines
1.1 KiB
Makefile
51 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-upgrade
|
|
PKG_VERSION:=1.0
|
|
PKG_RELEASE:=1
|
|
|
|
PKG_MAINTAINER:=xiexiaobao
|
|
PKG_LICENSE:=GPL-2.0
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
define Package/maple-upgrade
|
|
SECTION:=utils
|
|
CATEGORY:=Utilities
|
|
TITLE:=MapleOS firmware upgrade with auto-config backup
|
|
PKGARCH:=all
|
|
DEPENDS:=
|
|
endef
|
|
|
|
define Package/maple-upgrade/description
|
|
Safely upgrade MapleOS firmware with automatic config backup to p4.
|
|
|
|
Usage:
|
|
maple-upgrade <firmware.img.gz> Back up configs then sysupgrade -n
|
|
maple-upgrade -b Backup-only mode (no flash)
|
|
maple-upgrade --no-backup <file> Direct sysupgrade -n (skip backup)
|
|
maple-upgrade -h Show help
|
|
|
|
Backups go to /mnt/mmc2-4/.maple-backup/ and are auto-restored
|
|
by maple-restore on next boot.
|
|
endef
|
|
|
|
define Build/Configure
|
|
endef
|
|
|
|
define Build/Compile
|
|
endef
|
|
|
|
define Package/maple-upgrade/install
|
|
$(INSTALL_DIR) $(1)/sbin
|
|
$(INSTALL_BIN) ./files/maple-upgrade.sh $(1)/sbin/maple-upgrade
|
|
endef
|
|
|
|
$(eval $(call BuildPackage,maple-upgrade))
|