2021-03-12 19:02:08 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#check for modified path values and update if needed
|
|
|
|
#will not change existing custom entries
|
|
|
|
DISTRIB_TARGET=$(grep DISTRIB_TARGET /etc/openwrt_release|cut -d'=' -f2|tr -d "'")
|
|
|
|
DISTRIB_RELEASE=$(grep DISTRIB_RELEASE /etc/openwrt_release|cut -d'=' -f2|tr -d "'")
|
|
|
|
SERVER_PREFIX='http://downloads.arednmesh.org/'
|
|
|
|
SNAPSHOT_PREFIX='snapshots/trunk/'
|
|
|
|
|
|
|
|
getReleasePrefix()
|
|
|
|
{
|
|
|
|
local PREFIX=""
|
|
|
|
ccount=`expr "${DISTRIB_RELEASE}" : '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'`
|
|
|
|
if [ "$ccount" -ne 0 ]; then
|
|
|
|
v1=$(echo ${DISTRIB_RELEASE} | cut -d'.' -f1)
|
|
|
|
v2=$(echo ${DISTRIB_RELEASE} | cut -d'.' -f2)
|
|
|
|
PREFIX="releases/${v1}/${v2}/${DISTRIB_RELEASE}/"
|
|
|
|
else
|
|
|
|
PREFIX="${SNAPSHOT_PREFIX}"
|
|
|
|
fi
|
|
|
|
echo $PREFIX
|
2021-02-23 20:23:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-12 19:02:08 -07:00
|
|
|
defaultPackageRepos()
|
|
|
|
{
|
|
|
|
repo=$1
|
|
|
|
|
|
|
|
if [ "$repo" == "core" ]; then
|
|
|
|
echo "${SERVER_PREFIX}${BUILD_PREFIX}targets/${DISTRIB_TARGET}/packages"
|
|
|
|
else
|
|
|
|
echo "${SERVER_PREFIX}${BUILD_PREFIX}packages/mips_24kc/${repo}"
|
|
|
|
fi
|
|
|
|
}
|
2021-02-23 20:23:06 -07:00
|
|
|
|
2021-03-12 19:02:08 -07:00
|
|
|
checkPath()
|
|
|
|
{
|
|
|
|
uciopt=$1
|
|
|
|
repo=$2
|
|
|
|
uci_val=$(/sbin/uci -c /etc/config.mesh get "aredn.@downloads[0].${uciopt}")
|
|
|
|
default_val=$(eval defaultPackageRepos "${repo}")
|
|
|
|
|
|
|
|
# is the current value different than the default?
|
|
|
|
if [ "${uci_val}" != "${default_val}" ]; then
|
|
|
|
# does the non-standard value START with downloads.arednmesh.org? if so, change it, if NOT, leave it.
|
|
|
|
count=$(expr "${uci_val}" : "http:\\/\\/downloads.arednmesh.org\\/.*")
|
|
|
|
if [ "${count}" -gt 0 ]; then #starts with default server
|
|
|
|
/sbin/uci set "aredn.@downloads[0].${uciopt}=${default_val}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
2021-02-23 20:23:06 -07:00
|
|
|
|
2021-03-12 19:02:08 -07:00
|
|
|
BUILD_PREFIX=$(eval getReleasePrefix)
|
2021-02-23 20:23:06 -07:00
|
|
|
|
2021-03-12 19:02:08 -07:00
|
|
|
# set
|
|
|
|
checkPath pkgs_core core
|
|
|
|
checkPath pkgs_base base
|
|
|
|
checkPath pkgs_arednpackages arednpackages
|
|
|
|
checkPath pkgs_luci luci
|
|
|
|
checkPath pkgs_packages packages
|
|
|
|
checkPath pkgs_routing routing
|
|
|
|
checkPath pkgs_telephony telephony
|
2021-02-23 20:23:06 -07:00
|
|
|
|
2021-03-12 19:02:08 -07:00
|
|
|
/sbin/uci commit aredn
|
|
|
|
cp /etc/config/aredn /etc/config.mesh
|