From 7d445ad01d48110b701353ba3af5786e7578f917 Mon Sep 17 00:00:00 2001 From: adminer Date: Thu, 9 Apr 2026 23:08:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20backup=5Fuci.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup_uci.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 backup_uci.sh diff --git a/backup_uci.sh b/backup_uci.sh new file mode 100644 index 0000000..82c75b4 --- /dev/null +++ b/backup_uci.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Create OpenWRT uci-defaults file for image builder +target=$(sed -n 1p /etc/opkg/distfeeds.conf | cut -d'/' -f8) +soc=$(sed -n 1p /etc/opkg/distfeeds.conf | cut -d'/' -f9) +arch=$(sed -n 2p /etc/opkg/distfeeds.conf | cut -d'/' -f8) +model=$(cat /tmp/sysinfo/model) +profile=$(cat /tmp/sysinfo/board_name | sed 's/,/_/') +script="/tmp/99-custom" +echo ---------------------------------------------------- +echo Generating custom default file for $model +echo ---------------------------------------------------- +echo "profile = $profile" +echo "target = $target" +echo "soc = $soc" +echo "arch = $arch" +echo "#!/bin/sh">"$script" +echo "#$model custom default settings">>"$script" +echo "uci -q batch << EOI" >> "$script" +for section in $(uci show 2>/dev/null | awk -F. '{print $1}' | sort -u); do +uci show "$section" | awk -F. '{print "set "$0}' >> "$script" +echo "commit $section" >> "$script" +done +echo "EOI" >> "$script" +chmod 755 "$script" +echo "Created $script". +echo Now transfer the file to the 'files/etc/uci-defaults/' folder in your image builder directory. \ No newline at end of file