-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvements; cleanup; rename NFS_SERVER to NFS4SERVER
- Loading branch information
1 parent
5420f90
commit 2cb90f1
Showing
9 changed files
with
85 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
usr/share/rear/prep/NFS4SERVER/default/400_prep_nfs_server.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# 400_prep_nfs_server.sh | ||
# | ||
# prepare stuff for NFS4SERVER | ||
# | ||
|
||
PROGS+=("${PROGS_NFS4SERVER[@]}") | ||
|
||
REQUIRED_PROGS+=("${REQUIRED_PROGS_NFS4SERVER[@]}") | ||
|
||
MODULES_LOAD+=("${NFS4SERVER_MODULES[@]}") | ||
|
||
# Check if at least one trusted client was specified | ||
(( "${#NFS4SERVER_TRUSTED_CLIENTS[@]}" > 0 )) || Error "You must have defined at least one client in NFS4SERVER_TRUSTED_CLIENTS." |
14 changes: 0 additions & 14 deletions
14
usr/share/rear/prep/NFS_SERVER/default/400_prep_nfs_server.sh
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
usr/share/rear/restore/NFS4SERVER/default/300_start_nfs_server.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# 300_start_nfs_server.sh | ||
|
||
# same options works for mountd | ||
local nfsd_opts=(--no-udp --no-nfs-version 3 -V 4.2) | ||
local cpu_cores=$(nproc) | ||
# 4 threads per cpu core | ||
local nfs_threads=$(( $cpu_cores * 4 )) | ||
# 8 are the standard and should be the minumun | ||
if (( nfs_threads < 8 )); then nfs_threads=8; fi | ||
|
||
# clear /etc/exports if the user rerun the restore with other options | ||
> /etc/exports | ||
|
||
# add all mountpoints to /etc/exports | ||
while read mountpoint junk ; do | ||
local options=("${NFS4SERVER_EXPORT_OPTS[@]}") | ||
if [[ $mountpoint == "/" ]]; then | ||
options+=("fsid=0") | ||
else | ||
options+=(nohide) | ||
fi | ||
local nfs_options=$(IFS=',' ; echo "${options[*]}") | ||
local nfs_trust_options="" | ||
for trust in "${NFS4SERVER_TRUSTED_CLIENTS[@]}"; do | ||
nfs_trust_options+="$trust($nfs_options) " | ||
done | ||
|
||
echo "${TARGET_FS_ROOT}${mountpoint} $nfs_trust_options" >> /etc/exports | ||
done < "${VAR_DIR}/recovery/mountpoint_device" | ||
Debug "$(cat /etc/exports)" | ||
|
||
exportfs $v -ra || Error "exportfs failed!" | ||
|
||
rpc.nfsd --debug "$nfs_threads" "${nfsd_opts[@]}" || Error "rpc.nfsd failed!" | ||
Debug "nfsd startet with $nfs_threads threads." | ||
|
||
if [ -z "$(pidof rpc.mountd)" ]; then | ||
rpc.mountd --debug all "${nfsd_opts[@]}" || Error "rpc.mountd failed!" | ||
fi | ||
|
||
LogPrint "NFS-Server started successfully." |
19 changes: 19 additions & 0 deletions
19
usr/share/rear/restore/NFS4SERVER/default/400_restore_with_nfs_server.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 400_restore_with_nfs_server.sh | ||
|
||
local check_file="$TARGET_FS_ROOT/$NFS4SERVER_RESTORE_FINISHED_FILE" | ||
|
||
LogPrint "Mount the nfs share: 'mount -t nfs <ip>:/ <destination>' and restore all files to mounted destination." | ||
LogPrint "Create the $check_file file when the restore is completed and umount the share." | ||
|
||
rm -f $check_file || Error "Couldn't delete restore finished file $check_file" | ||
|
||
LogPrint "Wait until $check_file was created and there is no connection on the NFS-Port 2049." | ||
|
||
# or look at /var/lib/nfs/rmtab | ||
local nfs_connections=1 | ||
while [ ! -f "$check_file" ] || [ "$nfs_connections" -gt 0 ]; do | ||
sleep 5 | ||
nfs_connections=$(ss -tanpH state established "( sport = 2049 )" | wc -l) | ||
done | ||
|
||
rm -f $check_file || Error "Couldn't delete restore finished file $check_file" |
File renamed without changes.
35 changes: 0 additions & 35 deletions
35
usr/share/rear/restore/NFS_SERVER/default/300_start_nfs_server.sh
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
usr/share/rear/restore/NFS_SERVER/default/400_restore_with_nfs_server.sh
This file was deleted.
Oops, something went wrong.