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 28, 2018
1 parent a0be64f commit 123d3d7
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions scripts/update-nfs-utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#! /bin/bash

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

set -v

sudo bee remove portmap-6.0-0.x86_64
sudo bee remove rpcinfo-1.0-0.x86_64
sudo bee update iana-etc-2.30-1
sudo bee install rpcbind-1.2.5-0.x86_64
sudo bee remove libnfsidmap-0.25-0.x86_64
sudo bee install keyutils-1.5.11-0.x86_64
sudo bee install libtirpc-1.1.4-0.x86_64
sudo 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 neither installed with bee nor part of mxtools,
# so just replace.

# 'portmap.service' is removed from Requires= and After= lines.
# Additionally, for nfsd.serviced, we remove the '--descriptors 64' limit, which
# is to low for the current mountd.
#
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

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 nis.service
systemctl start nfsd.service

0 comments on commit 123d3d7

Please sign in to comment.