Skip to content

Commit

Permalink
mxmount: Add option --noexport
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
donald committed Jan 30, 2019
1 parent b02990f commit 35715cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions mxmount/mxmount
Original file line number Diff line number Diff line change
Expand Up @@ -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 =~ /^([^.]*)/;
Expand Down Expand Up @@ -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>) }

Expand Down
2 changes: 1 addition & 1 deletion mxmount/mxmount.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ConditionPathExists=/etc/mxmounts

[Service]
Type=oneshot
ExecStart=/usr/bin/mxmount
ExecStart=/usr/bin/mxmount --noexport
RemainAfterExit=yes

[Install]
Expand Down

0 comments on commit 35715cf

Please sign in to comment.