Skip to content

Commit

Permalink
check destination filesystem in nc-datadir nc-databasedir
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed May 22, 2017
1 parent 0f0c860 commit addd0a8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions etc/nextcloudpi-config.d/nc-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
DBDIR_=/media/USBdrive/ncdatabase
DESCRIPTION="Move your database to a new location, like a USB drive"

show_info()
{
whiptail --yesno \
--backtitle "NextCloudPi configuration" \
--title "Info" \
"Note that non Unix filesystems such as NTFS are not supported
because they do not provide a compatible user/permissions system" \
20 90
}

configure()
{
Expand All @@ -35,6 +44,8 @@ configure()
local BASEDIR=$( dirname "$DBDIR_" )
mkdir -p "$BASEDIR"

grep -q ext <( stat -fc%T $BASEDIR ) || { echo -e "Only ext filesystems can hold the database"; sleep 3; return 1; }

[[ $( stat -fc%d / ) == $( stat -fc%d $BASEDIR ) ]] && \
echo -e "INFO: moving database to another place in the same SD card\nIf you want to use an external mount, make sure it is properly set up"

Expand Down
12 changes: 12 additions & 0 deletions etc/nextcloudpi-config.d/nc-datadir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
DATADIR_=/media/USBdrive/ncdata
DESCRIPTION="Change your data dir to a new location, like a USB drive"

show_info()
{
whiptail --yesno \
--backtitle "NextCloudPi configuration" \
--title "Info" \
"Note that non Unix filesystems such as NTFS are not supported
because they do not provide a compatible user/permissions system" \
20 90
}

configure()
{
local SRCDIR=$( cd /var/www/nextcloud; sudo -u www-data php occ config:system:get datadirectory )
Expand All @@ -34,6 +44,8 @@ configure()
local BASEDIR=$( dirname "$DATADIR_" )
mkdir -p "$BASEDIR"

grep -q ext <( stat -fc%T $BASEDIR ) || { echo -e "Only ext filesystems can hold the data directory"; sleep 3; return 1; }

[[ $( stat -fc%d / ) == $( stat -fc%d $BASEDIR ) ]] && \
echo -e "INFO: moving data dir to another place in the same SD card\nIf you want to use an external mount, make sure it is properly set up"

Expand Down

0 comments on commit addd0a8

Please sign in to comment.