# Copyright (C) 2015 OpenWrt.org # SPDX-License-Identifier: GPL-2.0-only # # Modified by CicadaTAK (2026-10-03), from OpenWrt's target/linux/bcm27xx/base-files/lib/preinit/79_move_config: # on a RAM overlay — fstools fell back to RAM because the real overlay will not mount # (imagebuilder/vanilla/package-patches/fstools/901-cicadatak-overlay-mount-failure-ramoverlay.patch) — COPY the # update tarball instead of moving it, so a node that reboots before its storage is repaired still restores its # settings and identity. A healthy boot moves it, as stock does. docs/plans/overlay-mount-failure.md §3.2. # MC_MOUNTS is a test hook (imagebuilder/tools/test-move-config.sh); preinit never sets it. . /lib/upgrade/common.sh move_config() { local partdev export_bootdevice && export_partdevice partdev 1 || { partdev=mmcblk0p1 } if [ -b "/dev/$partdev" ]; then insmod nls_cp437 insmod nls_iso8859-1 insmod fat insmod vfat mkdir -p /boot mount -t vfat -o rw,noatime /dev/$partdev /boot if [ -f "/boot/$BACKUP_FILE" ]; then if grep -q "^overlayfs:/tmp/root / " "${MC_MOUNTS:-/proc/mounts}"; then cp -f "/boot/$BACKUP_FILE" / else mv -f "/boot/$BACKUP_FILE" / fi export BCM27XX_SET_ROOT_PART=1 fi fi } boot_hook_add preinit_mount_root move_config