bugfix: re-submit path reset2 (previously approved) (#75)

This commit is contained in:
dman776 2021-03-12 20:02:08 -06:00 committed by GitHub
parent 4b86b4f02a
commit cdf8057f65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 55 additions and 71 deletions

View File

@ -1,81 +1,65 @@
#!/usr/bin/perl #!/bin/sh
=for comment
Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks #check for modified path values and update if needed
Copyright (C) 2021 - Darryl Quinn #will not change existing custom entries
See Contributors file for additional contributors 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/'
This program is free software: you can redistribute it and/or modify getReleasePrefix()
it under the terms of the GNU General Public License as published by {
the Free Software Foundation version 3 of the License. local PREFIX=""
ccount=`expr "${DISTRIB_RELEASE}" : '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'`
This program is distributed in the hope that it will be useful, if [ "$ccount" -ne 0 ]; then
but WITHOUT ANY WARRANTY; without even the implied warranty of v1=$(echo ${DISTRIB_RELEASE} | cut -d'.' -f1)
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the v2=$(echo ${DISTRIB_RELEASE} | cut -d'.' -f2)
GNU General Public License for more details. PREFIX="releases/${v1}/${v2}/${DISTRIB_RELEASE}/"
else
You should have received a copy of the GNU General Public License PREFIX="${SNAPSHOT_PREFIX}"
along with this program. If not, see <http://www.gnu.org/licenses/>. fi
echo $PREFIX
Additional Terms:
Additional use restrictions exist on the AREDN(TM) trademark and logo.
See AREDNLicense.txt for more info.
Attributions to the AREDN Project must be retained in the source code.
If importing this code into a new or existing project attribution
to the AREDN project must be added to the source code.
You must not misrepresent the origin of the material contained within.
Modified versions must be modified to attribute to the original source
and be marked in reasonable ways as differentiate it from the original
version.
=cut
BEGIN {push @INC, '/www/cgi-bin'};
use perlfunc;
use ucifunc;
$debug = 0;
$| = 1;
sub checkPath {
my $uciopt = $_[0];
my $repo = $_[1];
my ($rc, $uci_val) = &uci_get_indexed_option("aredn", "downloads", "0", $uciopt);
my $default_val = &defaultPackageRepos($repo);
# is the current value different than the default?
if($uci_val ne $default_val)
{
# does the non-standard value START with downloads.arednmesh.org? if so, change it, if NOT, leave it.
if($uci_val =~ m/^http:\/\/downloads.arednmesh.org\/*./)
{
&uci_set_indexed_option("aredn", "downloads", "0", $uciopt, $default_val);
}
}
} }
#PKGS_CORE
checkPath("pkgs_core", "aredn_core");
# PKGS_BASE defaultPackageRepos()
checkPath("pkgs_base", "base"); {
repo=$1
# PKGS_AREDNPACKAGES if [ "$repo" == "core" ]; then
checkPath("pkgs_arednpackages", "arednpackages"); echo "${SERVER_PREFIX}${BUILD_PREFIX}targets/${DISTRIB_TARGET}/packages"
else
echo "${SERVER_PREFIX}${BUILD_PREFIX}packages/mips_24kc/${repo}"
fi
}
# PKGS_LUCI checkPath()
checkPath("pkgs_luci", "luci"); {
uciopt=$1
repo=$2
uci_val=$(/sbin/uci -c /etc/config.mesh get "aredn.@downloads[0].${uciopt}")
default_val=$(eval defaultPackageRepos "${repo}")
# PKGS_PACKAGES # is the current value different than the default?
checkPath("pkgs_packages", "packages"); 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
}
# PKGS_ROUTING BUILD_PREFIX=$(eval getReleasePrefix)
checkPath("pkgs_routing", "routing");
# PKGS_TELEPHONY # set
checkPath("pkgs_telephony", "telephony"); 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
&uci_commit("aredn"); /sbin/uci commit aredn
cp /etc/config/aredn /etc/config.mesh