2013-11-14 23:11:16 -07:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
|
|
|
|
START=99
|
|
|
|
boot() {
|
2014-11-12 22:25:41 -07:00
|
|
|
|
2022-03-13 21:19:04 -06:00
|
|
|
[ -x /usr/local/bin/aredn_postupgrade ] && /usr/local/bin/aredn_postupgrade
|
2015-04-05 22:03:50 -06:00
|
|
|
|
2013-11-14 23:11:16 -07:00
|
|
|
# setup nvram variables
|
2013-12-02 13:04:54 -07:00
|
|
|
[ -x /usr/local/bin/nvram-setup ] && /usr/local/bin/nvram-setup
|
2013-11-14 23:11:16 -07:00
|
|
|
|
|
|
|
# run mode specific setup
|
|
|
|
[ -x /etc/config/local ] && /etc/config/local
|
2013-12-02 13:04:54 -07:00
|
|
|
[ -x /etc/local/services ] && /etc/local/services
|
2018-10-26 20:34:16 -06:00
|
|
|
|
|
|
|
# set POE passthrough if available
|
2018-11-16 21:41:58 -07:00
|
|
|
local poevalue=$(uci -q get aredn.@poe[0].passthrough)
|
|
|
|
if [ -z "$poevalue" ]; then
|
|
|
|
local dpval=$(jsonfilter -e '@.gpioswitch.poe_passthrough.default' < /etc/board.json)
|
|
|
|
if [ ! -z "$dpval" ]; then
|
|
|
|
uci -q set aredn.@poe[0].passthrough="$dpval"
|
|
|
|
uci -q commit aredn
|
|
|
|
poevalue=$dpval
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
/usr/local/bin/poe_passthrough "${poevalue}"
|
|
|
|
|
|
|
|
# set USB passthrough if available
|
|
|
|
local usbvalue=$(uci -q get aredn.@usb[0].passthrough)
|
|
|
|
if [ -z "$usbvalue" ]; then
|
|
|
|
local duval=$(jsonfilter -e '@.gpioswitch.usb_power_switch.default' < /etc/board.json)
|
|
|
|
uci -q set aredn.@usb[0].passthrough="$duval"
|
|
|
|
uci -q commit aredn
|
|
|
|
usbvalue=$duval
|
2018-10-26 20:34:16 -06:00
|
|
|
fi
|
2018-11-29 21:15:16 -07:00
|
|
|
/usr/local/bin/usb_passthrough "${usbvalue}"
|
2020-04-03 14:58:30 -06:00
|
|
|
|
2020-08-18 15:17:03 -06:00
|
|
|
# package repositories
|
2024-09-10 17:59:05 -06:00
|
|
|
local packages_default=$(uci -q get "aredn.@downloads[0].packages_default")
|
2024-08-15 21:28:45 -06:00
|
|
|
if [ "${packages_default}" != "" ]; then
|
|
|
|
local repos="core base arednpackages packages luci routing telephony"
|
|
|
|
set -- $repos
|
|
|
|
while [ -n "$1" ]; do
|
2024-09-10 17:59:05 -06:00
|
|
|
local distrepo=$(grep aredn_$1 /etc/opkg/distfeeds.conf | cut -d' ' -f3)
|
|
|
|
local prefixurl=$(echo $distrepo | sed -n 's/\(http[s]\?:\/\/[^/]\+\).*/\1/p')
|
2024-08-15 21:28:45 -06:00
|
|
|
if [ "$packages_default" != "$prefixurl" ]; then
|
|
|
|
sed -i "s|$prefixurl|$packages_default|g" /etc/opkg/distfeeds.conf
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
done
|
2020-08-18 15:17:03 -06:00
|
|
|
fi
|
2013-11-14 23:11:16 -07:00
|
|
|
}
|