Skip to content

Commit

Permalink
Add scripts/update-nfs-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Dec 29, 2018
1 parent 517a710 commit ba0bb3b
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions scripts/update-nfs-utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#! /bin/bash

# Note, you are doing this to a live nfs server, writes will be blocked
# for 90 seconds.
#

set -v

bee remove portmap-6.0-0.x86_64
bee remove rpcinfo-1.0-0.x86_64
bee update iana-etc-2.30-1
bee install rpcbind-1.2.5-0.x86_64
bee remove libnfsidmap-0.25-0.x86_64
bee install keyutils-1.5.11-0.x86_64
bee install libtirpc-1.1.4-0.x86_64
bee update nfs-utils-2.3.3-0.x86_64

# Remove portmap.service dependencies from nis,stats,nfsd service unit files.
# These three files are currently neither installed with bee nor
# part of mxtools, so just replace.
#
# 'portmap.service' is removed from Requires= and After= lines.
#
# We don't need new dependencies for rpcbind, because this is socket
# activated (if socket unit is enabled) and the service units order
# after sockets.target via DefaultDependencies.
#
# Additionally, for nfsd.serviced, we remove the '--descriptors 64' limit, which
# is to low for the mountd of nfs-utils 2.3 when serving ipv4,ipv6 and
# named sockets.
#
cat << '_EOF_' >/etc/systemd/system/nis.service
[Unit]
Description=Network information Service (NIS)
Requires=network.target
After=network.target
[Service]
ExecStartPre=/usr/bin/domainname molgen
ExecStart=/usr/sbin/ypbind -foreground
Restart=always
[Install]
WantedBy=multi-user.target
_EOF_
cat << '_EOF_' >/etc/systemd/system/statd.service
[Unit]
Description=NSM Daemon
Requires=network.target local-fs.target
After=network.target local-fs.target
[Service]
ExecStart=/usr/sbin/rpc.statd --foreground
Restart=always
[Install]
WantedBy=multi-user.target
_EOF_
cat << '_EOF_' >/etc/systemd/system/nfsd.service
[Unit]
Description=NFS Daemon
ConditionPathExists=/etc/exports
Requires=statd.service local-fs.target proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount
After=statd.service local-fs.target proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount
[Service]
ExecStartPre=/bin/mkdir -p /var/lib/nfs/v4recovery
ExecStartPre=/usr/sbin/exportfs -ra
ExecStart=/usr/sbin/rpc.mountd --foreground --manage-gids
ExecStartPost=/usr/sbin/rpc.nfsd 64 ; /usr/sbin/sm-notify
ExecReload=/usr/sbin/exportfs -ra
ExecStopPost=/usr/sbin/rpc.nfsd 0 ; /usr/sbin/exportfs -ua
Restart=always
[Install]
WantedBy=multi-user.target
_EOF_

#
# Remove portmap unit file, enable rpcbind socket activation
#
systemctl disable portmap
rm /etc/systemd/system/portmap.service
systemctl enable rpcbind.socket

# on-disk changes done.
#
# Note, we can't just stop here and leave the old daemon running until
# reboot, because any new invocation of exportfs would create entries in
# /var/lib/nfs/etab with options, which the old mountd doesn't understand
# (nopnfs).
#
# This implies, we can't just push the changes around from the distmaster,
# but have to execute this script on every node.
#

systemctl daemon-reload
systemctl restart systemd-logind.service # maybe still required after daemon-reload

systemctl stop nfsd.service
systemctl stop nis.service
systemctl stop portmap.service

systemctl start rpcbind.socket
systemctl start nis.service
systemctl start nfsd.service

0 comments on commit ba0bb3b

Please sign in to comment.