mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-10 15:12:01 -03:30
metrics.sh: Fix set -u in calling script causing failure
This commit is contained in:
parent
ba209a7a5d
commit
20eb4a6b06
@ -31,14 +31,14 @@ configure()
|
||||
echo -e "Error reading data directory. Is NextCloud running and configured?";
|
||||
return 1;
|
||||
}
|
||||
[ -d "$SRCDIR" ] || { echo -e "data directory $SRCDIR not found"; return 1; }
|
||||
[ -d "${SRCDIR?}" ] || { echo -e "data directory $SRCDIR not found"; return 1; }
|
||||
|
||||
[[ "$SRCDIR" == "${DATADIR}" ]] && { echo -e "INFO: data already there"; return 0; }
|
||||
[[ "$SRCDIR" == "${DATADIR?}" ]] && { echo -e "INFO: data already there"; return 0; }
|
||||
[[ "$SRCDIR" == "${DATADIR}"/data ]] && { echo -e "INFO: data already there"; return 0; }
|
||||
|
||||
BASEDIR="${DATADIR}"
|
||||
# If the user chooses the root of the mountpoint, force a folder
|
||||
mountpoint -q "${BASEDIR}" && {
|
||||
mountpoint -q "${BASEDIR?}" && {
|
||||
BASEDIR="${BASEDIR}"/ncdata
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ configure()
|
||||
[ -d "${BASEDIR}" ] && {
|
||||
rmdir "${BASEDIR}" &>/dev/null || {
|
||||
local BKP="${BASEDIR}-$(date "+%m-%d-%y.%s")"
|
||||
echo "INFO: ${BASEDIR} is not empty. Creating backup ${BKP}"
|
||||
echo "INFO: ${BASEDIR} is not empty. Creating backup ${BKP?}"
|
||||
mv "${BASEDIR}" "${BKP}"
|
||||
}
|
||||
mkdir -p "${BASEDIR}"
|
||||
@ -84,7 +84,7 @@ configure()
|
||||
# use encryption, if selected
|
||||
if is_active_app nc-encrypt; then
|
||||
# if we have encryption AND BTRFS, then store ncdata_enc in the subvolume
|
||||
mv "$(dirname "${SRCDIR}")"/ncdata_enc "${ENCDIR}"
|
||||
mv "$(dirname "${SRCDIR}")"/ncdata_enc "${ENCDIR?}"
|
||||
mkdir "${DATADIR}" && mount --bind "${SRCDIR}" "${DATADIR}"
|
||||
mkdir "$(dirname "${SRCDIR}")"/ncdata_enc && mount --bind "${ENCDIR}" "$(dirname "${SRCDIR}")"/ncdata_enc
|
||||
else
|
||||
@ -93,7 +93,7 @@ configure()
|
||||
chown www-data: "${DATADIR}"
|
||||
|
||||
# datadir
|
||||
sed -i "s|'datadirectory' =>.*|'datadirectory' => '${DATADIR}',|" "$NCDIR"/config/config.php
|
||||
sed -i "s|'datadirectory' =>.*|'datadirectory' => '${DATADIR}',|" "${NCDIR?}"/config/config.php
|
||||
ncc config:system:set logfile --value="${DATADIR}/nextcloud.log"
|
||||
set_ncpcfg datadir "${DATADIR}"
|
||||
|
||||
@ -101,7 +101,7 @@ configure()
|
||||
mkdir -p "${DATADIR}/tmp"
|
||||
chown www-data:www-data "${DATADIR}/tmp"
|
||||
ncc config:system:set tempdirectory --value "$DATADIR/tmp"
|
||||
sed -i "s|^;\?upload_tmp_dir =.*$|uploadtmp_dir = ${DATADIR}/tmp|" /etc/php/"${PHPVER}"/cli/php.ini
|
||||
sed -i "s|^;\?upload_tmp_dir =.*$|uploadtmp_dir = ${DATADIR}/tmp|" /etc/php/"${PHPVER?}"/cli/php.ini
|
||||
sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = ${DATADIR}/tmp|" /etc/php/"${PHPVER}"/fpm/php.ini
|
||||
sed -i "s|^;\?sys_temp_dir =.*$|sys_temp_dir = ${DATADIR}/tmp|" /etc/php/"${PHPVER}"/fpm/php.ini
|
||||
|
||||
@ -115,7 +115,7 @@ configure()
|
||||
restore_maintenance_mode
|
||||
|
||||
(
|
||||
. "${BINDIR}/SYSTEM/metrics.sh"
|
||||
. "${BINDIR?}/SYSTEM/metrics.sh"
|
||||
reload_metrics_config
|
||||
)
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ apt_install_with_recommends() {
|
||||
}
|
||||
|
||||
is_supported() {
|
||||
[[ "$DOCKERBUILD" == 1 ]] && [[ "$(lsb_release -r)" =~ .*10 ]] && return 1
|
||||
[[ "${DOCKERBUILD:-0}" == 1 ]] && [[ "$(lsb_release -r)" =~ .*10 ]] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -87,6 +87,7 @@ install() {
|
||||
(
|
||||
|
||||
set -e
|
||||
set +u
|
||||
|
||||
is_supported || {
|
||||
echo -e "Metrics app is not supported in debian 10 docker containers. Installation will be skipped."
|
||||
@ -213,6 +214,7 @@ EOF
|
||||
}
|
||||
|
||||
configure() {
|
||||
set +u
|
||||
|
||||
if [[ "$ACTIVE" != yes ]]
|
||||
then
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set +u
|
||||
source /usr/local/etc/library.sh
|
||||
|
||||
if [[ "$1" == "--defaults" ]]
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
set +u
|
||||
source /usr/local/etc/library.sh
|
||||
|
||||
[[ "$1" != "--defaults" ]] || echo "INFO: Restoring template to default settings" >&2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user