Skip to content

Commit

Permalink
library.sh,nc-database.sh,nc-datadir.sh,ncp-restore: Define supported…
Browse files Browse the repository at this point in the history
… filesystems in library.sh, enable f2fs
  • Loading branch information
twojstaryzdomu committed Jan 4, 2025
1 parent baa8438 commit 5615e26
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/ncp-restore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DIR="$( cd "$( dirname "$BACKUPFILE" )" &>/dev/null && pwd )" #abspath
[[ "$DIR" =~ "$NCDIR".* ]] && { echo "Refusing to restore from $NCDIR"; exit 1; }

TEMPDIR="$( mktemp -d "$( dirname "$BACKUPFILE" )"/ncp-restore.XXXXXX )" || { echo "Failed to create temp dir" >&2; exit 1; }
[[ "$(stat -fc%T "${TEMPDIR}")" =~ ext|btrfs|zfs ]] || { echo "Can only restore from ext/btrfs/zfs filesystems (found '$(stat -fc%T "${TEMPDIR}")" >&2; exit 1; }
[[ "$(stat -fc%T "${TEMPDIR}")" =~ $FS ]] || { echo "Can only restore from ${FS//|/\/} filesystems (found '$(stat -fc%T "${TEMPDIR}")')" >&2; exit 1; }

TEMPDIR="$( cd "$TEMPDIR" &>/dev/null && pwd )" || { echo "$TEMPDIR not found"; exit 1; } #abspath
cleanup(){ local RET=$?; echo "Cleanup..."; rm -rf "${TEMPDIR}"; trap "" EXIT; exit $RET; }
Expand Down
2 changes: 1 addition & 1 deletion bin/ncp/CONFIG/nc-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ configure()
local BASEDIR=$( dirname "$DBDIR" )
mkdir -p "$BASEDIR"

[[ "$(stat -fc%T "${BASEDIR}")" =~ ext|btrfs|zfs ]] || { echo -e "Only ext/btrfs/zfs filesystems can hold the data directory (found '$(stat -fc%T "${BASEDIR}")"; return 1; }
[[ "$(stat -fc%T "${BASEDIR}")" =~ $FS ]] || { echo -e "Only ${FS//|/\/} filesystems can hold the data directory (found '$(stat -fc%T "${BASEDIR}")')"; return 1; }

sudo -u mysql test -x "$BASEDIR" || { echo -e "ERROR: the user mysql does not have access permissions over $BASEDIR"; return 1; }

Expand Down
4 changes: 2 additions & 2 deletions bin/ncp/CONFIG/nc-datadir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ configure()
ENCDIR="${BASEDIR}"/ncdata_enc

# checks
[[ "$DISABLE_FS_CHECK" == 1 ]] || [[ "$(stat -fc%T "${BASEDIR}")" =~ ext|btrfs|zfs ]] || {
echo -e "Only ext/btrfs/zfs filesystems can hold the data directory (found '$(stat -fc%T "${BASEDIR}")')"
[[ "$DISABLE_FS_CHECK" == 1 ]] || [[ "$(stat -fc%T "${BASEDIR}")" =~ $FS ]] || {
echo -e "Only ${FS//|/\/} filesystems can hold the data directory (found '$(stat -fc%T "${BASEDIR}")')"
return 1
}

Expand Down
1 change: 1 addition & 0 deletions etc/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export REDIS_CONF=${REDIS_CONF:-/etc/redis/redis.conf}
export APACHE_LOG_DIR=${APACHE_LOG_DIR:-/var/log/apache2}
export ARCH="$(dpkg --print-architecture)"
export DB_PREFIX="$(php -r 'include("/var/www/nextcloud/config/config.php"); echo $CONFIG['"'dbtableprefix'"'];' || echo 'oc_')"
export FS="ext|btrfs|zfs|f2fs"
[[ "${ARCH}" =~ ^(armhf|arm)$ ]] && ARCH="armv7"
[[ "${ARCH}" == "arm64" ]] && ARCH=aarch64
[[ "${ARCH}" == "amd64" ]] && ARCH=x86_64
Expand Down

0 comments on commit 5615e26

Please sign in to comment.