diff options
author | nachoparker <nacho@ownyourbits.com> | 2019-07-02 04:15:46 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2019-07-06 06:43:54 +0300 |
commit | 35526ab9fcfc538b68a10bbf449d6b1fe5ea7d6d (patch) | |
tree | bf5f7762937f0fd38bb7463041e25726cc74bd16 /etc | |
parent | 88da901eddff125b3e71d9706fbe02edffc659b3 (diff) |
build: use a system wide config file. Remove sury sources
Signed-off-by: nachoparker <nacho@ownyourbits.com>
Diffstat (limited to 'etc')
-rw-r--r-- | etc/library.sh | 24 | ||||
-rw-r--r-- | etc/ncp.cfg | 9 |
2 files changed, 33 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 diff --git a/etc/ncp.cfg b/etc/ncp.cfg new file mode 100644 index 00000000..2b721009 --- /dev/null +++ b/etc/ncp.cfg @@ -0,0 +1,9 @@ +{ + "nextcloud_version": "15.0.8", + "php_version": "7.2", + "release": "stretch", + "release_issue": [ + "Debian GNU/Linux 9", + "Raspbian GNU/Linux 9" + ] +} |