From 35715cf82e301d750b711bda454a5bcccfcb811c Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 30 Jan 2019 21:53:11 +0100 Subject: [PATCH] mxmount: Add option --noexport When mxmount is called by mxmount.service during boot, we do want to mount the filesystems and produce /etc/exports, but we do not need to call `exportfs -ra`. This is done by the startup of nfsd.service anyway. When `exportfs -ra` is used, the hostnames in /etc/exports are looked up via dns. This might be a problem, if dns is not yet available. Add option --noexport and use it in mxmount.service. --- mxmount/mxmount | 6 ++++-- mxmount/mxmount.service | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mxmount/mxmount b/mxmount/mxmount index 237771a..af0926c 100755 --- a/mxmount/mxmount +++ b/mxmount/mxmount @@ -20,9 +20,10 @@ my %D; our $USAGE=<<"_EOF_"; usage: $0 $0 --reexport-only + $0 --noexport _EOF_ -our ($opt_reexport_only); +our ($opt_reexport_only,$opt_noexport); $fullhostname = hostname(); ($hostname) = $fullhostname =~ /^([^.]*)/; @@ -52,12 +53,13 @@ add_data0_if_not_present(); my %options; GetOptions ( 'reexport-only' => \$opt_reexport_only, + 'noexport' => \$opt_noexport, ) or die $USAGE; @ARGV and die $USAGE; mount_all() unless $opt_reexport_only; create_exports(); -system("exportfs -ra"); +system("exportfs -ra") unless $opt_noexport; sub safe_qx { open my $pipe,'-|',@_; return join('',<$pipe>) } diff --git a/mxmount/mxmount.service b/mxmount/mxmount.service index 6434001..c5d64ae 100644 --- a/mxmount/mxmount.service +++ b/mxmount/mxmount.service @@ -5,7 +5,7 @@ ConditionPathExists=/etc/mxmounts [Service] Type=oneshot -ExecStart=/usr/bin/mxmount +ExecStart=/usr/bin/mxmount --noexport RemainAfterExit=yes [Install]