diff --git a/scripts/update-nfs-utils.sh b/scripts/update-nfs-utils.sh new file mode 100755 index 000000000..51257abc8 --- /dev/null +++ b/scripts/update-nfs-utils.sh @@ -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