diff options
-rwxr-xr-x | bin/ncp-update | 7 | ||||
-rw-r--r-- | install.sh | 2 | ||||
-rw-r--r-- | ncp.sh | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/bin/ncp-update b/bin/ncp-update index 4f07907d..63ed2c31 100755 --- a/bin/ncp-update +++ b/bin/ncp-update @@ -9,7 +9,7 @@ [[ "$BRANCH" != "master" ]] && echo "INFO: updating to development branch '$BRANCH'" TMPDIR="$( mktemp -d /tmp/ncp-update.XXXXXX || ( echo "Failed to create temp dir. Exiting" >&2; exit 1 ) )" - trap 'ret=$?; cd /; rm -rf "${TMPDIR}"; exit $ret' EXIT + trap 'cd /; rm -rf "${TMPDIR}"' EXIT echo -e "Downloading updates" git clone --depth 20 -b "$BRANCH" -q https://github.com/nextcloud/nextcloudpi.git "$TMPDIR" || { @@ -23,10 +23,11 @@ ./update.sh || exit $? cd "$TMPDIR" - VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" ) + git describe --always --tags --abbrev=0 2>/dev/null | grep -oP "v\d+\.\d+\.\d+" || git fetch --unshallow --tags + VER=$( git describe --always --tags --abbrev=0 | grep -oP "v\d+\.\d+\.\d+" ) # check format - grep -qP "v\d+\.\d+\.\d+" <<< "$VER" || { "Error: missing version"; exit 1; } + grep -qP "v\d+\.\d+\.\d+" <<< "$VER" || { echo "Error: missing version"; exit 1; } echo "$VER" > /usr/local/etc/ncp-version echo "$VER" > /var/run/.ncp-latest-version @@ -15,7 +15,7 @@ BRANCH="${BRANCH:-master}" set -e$DBG TMPDIR="$(mktemp -d /tmp/nextcloudpi.XXXXXX || (echo "Failed to create temp dir. Exiting" >&2 ; exit 1) )" -trap "rm -rf \"${TMPDIR}\" ; exit 0" 0 1 2 3 15 +trap "rm -rf \"${TMPDIR}\"" 0 1 2 3 15 [[ ${EUID} -ne 0 ]] && { printf "Must be run as root. Try 'sudo $0'\n" @@ -10,7 +10,7 @@ WEBADMIN=ncp WEBPASSWD=ownyourbits -BRANCH=master +BRANCH="${BRANCH:-master}" BINDIR=/usr/local/bin/ncp CONFDIR=/usr/local/etc/ncp-config.d/ |