b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (C) 2011-2012 OpenWrt.org |
| 4 | # |
| 5 | |
| 6 | ubootenv_add_uci_config() { |
| 7 | local dev=$1 |
| 8 | local offset=$2 |
| 9 | local envsize=$3 |
| 10 | local secsize=$4 |
| 11 | local numsec=$5 |
| 12 | uci batch <<EOF |
| 13 | add ubootenv ubootenv |
| 14 | set ubootenv.@ubootenv[-1].dev='$dev' |
| 15 | set ubootenv.@ubootenv[-1].offset='$offset' |
| 16 | set ubootenv.@ubootenv[-1].envsize='$envsize' |
| 17 | set ubootenv.@ubootenv[-1].secsize='$secsize' |
| 18 | set ubootenv.@ubootenv[-1].numsec='$numsec' |
| 19 | EOF |
| 20 | uci commit ubootenv |
| 21 | } |
| 22 | |
| 23 | ubootenv_add_app_config() { |
| 24 | local dev |
| 25 | local offset |
| 26 | local envsize |
| 27 | local secsize |
| 28 | local numsec |
| 29 | config_get dev "$1" dev |
| 30 | config_get offset "$1" offset |
| 31 | config_get envsize "$1" envsize |
| 32 | config_get secsize "$1" secsize |
| 33 | config_get numsec "$1" numsec |
| 34 | grep -q "^[[:space:]]*${dev}[[:space:]]*${offset}" /etc/fw_env.config || echo "$dev $offset $envsize $secsize $numsec" >>/etc/fw_env.config |
| 35 | } |
| 36 | |