#!/bin/bash # NFS server for Raspbian # # Copyleft 2017 by Ignacio Nunez Hernanz # GPL licensed (see end of file) * Use at your own risk! # # Usage: # # ./installer.sh NFS.sh () # # See installer.sh instructions for details # More at: https://ownyourbits.com # ACTIVE_=no DIR_=/media/USBdrive/ncdata/admin/files SUBNET_=192.168.1.0/24 USER_=www-data GROUP_=www-data DESCRIPTION="NFS network file system server (for Linux LAN)" INFOTITLE="Instructions for external synchronization" INFO="If we intend to modify the data folder through NFS, then we have to synchronize NextCloud to make it aware of the changes. This can be done manually or automatically using 'nc-scan' and 'nc-scan-auto' from 'nextcloudpi-config'" install() { apt-get update apt-get install --no-install-recommends -y nfs-kernel-server systemctl disable nfs-kernel-server systemctl mask nfs-blkmap cat > /etc/systemd/system/nfs-common.services < /etc/systemd/system/rpcbind.service </dev/null || { echo "user USER_ does not exist" ; return 1; } id -g "$GROUP_" &>/dev/null || { echo "group GROUP_ does not exist"; return 1; } [ -d "$DIR_" ] || { echo -e "INFO: directory $DIR_ does not exist. Creating"; mkdir -p "$DIR_"; } [[ $( stat -fc%d / ) == $( stat -fc%d $DIR_ ) ]] && \ echo -e "INFO: mounting a in the SD card\nIf you want to use an external mount, make sure it is properly set up" # CONFIG ################################ cat > /etc/exports <