From 521197371e008fc4e60db652bdcb0b6a9dfaf0f3 Mon Sep 17 00:00:00 2001 From: Lawrence-Tang Date: Mon, 17 Feb 2025 16:24:00 +0800 Subject: [PATCH] rockchip basefiles: update setup.sh keep fstab config for /opt --- target/linux/rockchip/armv8/base-files/root/setup.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/target/linux/rockchip/armv8/base-files/root/setup.sh b/target/linux/rockchip/armv8/base-files/root/setup.sh index b1d8dbe9c372e2..90245a28c2fcde 100755 --- a/target/linux/rockchip/armv8/base-files/root/setup.sh +++ b/target/linux/rockchip/armv8/base-files/root/setup.sh @@ -197,7 +197,17 @@ function init_button() { } function clean_fstab() { - while uci -q del fstab.@mount[-1]; do true; done + # delete all entries but keep /opt + local index=0 + while uci -q get fstab.@mount[$index]; do + local target=$(uci -q get fstab.@mount[$index].target) + if [ "$target" = "/opt" ]; then + index=$((index + 1)) + else + uci -q del fstab.@mount[$index] + # do not increment index because the remaining entries will shift forward after deletion + fi + done uci commit fstab }