Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'etc/library.sh')
-rw-r--r--etc/library.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/etc/library.sh b/etc/library.sh
index d2ec12b6..3ddd4c7f 100644
--- a/etc/library.sh
+++ b/etc/library.sh
@@ -8,8 +8,21 @@
# More at ownyourbits.com
#
+NCPCFG=${NCPCFG:-/usr/local/etc/ncp.cfg}
CFGDIR=/usr/local/etc/ncp-config.d
BINDIR=/usr/local/bin/ncp
+BINDIR=/usr/local/bin/ncp
+
+command -v jq &>/dev/null || {
+ apt-get update
+ apt-get install -y --no-install-recommends jq
+}
+
+[[ -f "$NCPCFG" ]] && {
+ NCVER=$( jq -r .nextcloud_version < "$NCPCFG")
+ PHPVER=$( jq -r .php_version < "$NCPCFG")
+ RELEASE=$(jq -r .release < "$NCPCFG")
+}
function configure_app()
{
@@ -257,6 +270,17 @@ function is_more_recent_than()
return 0
}
+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
+ return 1
+}
+
# License
#
# This script is free software; you can redistribute it and/or modify it