armbian: fix distro check

Signed-off-by: nachoparker <nacho@ownyourbits.com>
This commit is contained in:
nachoparker 2019-07-24 17:13:11 -06:00
parent 2fb7225d28
commit e30271f96f
5 changed files with 7 additions and 13 deletions

View File

@ -273,11 +273,8 @@ function is_more_recent_than()
function check_distro()
{
local cfg="${1:-$NCPCFG}"
local len="$(jq '.release_issue | length' < "$cfg")"
for i in $(seq 0 $((len-1))); do
local supported=$(jq -r .release_issue[$i] < "$cfg")
grep -q "$supported" /etc/issue && return 0
done
local supported=$(jq -r .release < "$cfg")
grep -q "$supported" <(lsb_release -sc) && return 0
return 1
}

View File

@ -1,9 +1,5 @@
{
"nextcloud_version": "16.0.3",
"php_version": "7.3",
"release": "buster",
"release_issue": [
"Debian GNU/Linux 10",
"Raspbian GNU/Linux 10"
]
"release": "buster"
}

2
ncp.sh
View File

@ -22,7 +22,7 @@ install()
{
# NCP-CONFIG
apt-get update
$APTINSTALL git dialog whiptail jq file
$APTINSTALL git dialog whiptail jq file lsb-release
mkdir -p "$CONFDIR" "$BINDIR"
# include option in raspi-config (only Raspbian)

View File

@ -165,12 +165,10 @@ is_active_app nc-autoupdate-nc && run_app nc-autoupdate-nc
check_distro "$NCPCFG" && check_distro etc/ncp.cfg || {
php_ver_new=$(jq -r '.php_version' < etc/ncp.cfg)
release_new=$(jq -r '.release' < etc/ncp.cfg)
issue_new=$( jq -r '.release_issue' < etc/ncp.cfg)
cfg="$(jq '.' "$NCPCFG")"
cfg="$(jq '.php_version = "'$php_ver_new'"' <<<"$cfg")"
cfg="$(jq '.release = "'$release_new'"' <<<"$cfg")"
cfg="$(jq '.release_issue = '"$issue_new" <<<"$cfg")"
echo "$cfg" > /usr/local/etc/ncp-recommended.cfg
[[ -f /.dockerenv ]] && \

View File

@ -12,6 +12,9 @@ source /usr/local/etc/library.sh
apt-get update
apt-get install -y --no-install-recommends php-smbclient exfat-fuse exfat-utils
# install lsb-release
apt-get install -y --no-install-recommends lsb-release
# docker images only
[[ -f /.docker-image ]] && {
: