Sven Nierlein 8fe4ec4c8d
Update nfs_client.rb for rocky 9
Starting a rocky 9 box (having nfs shares) fails with: `No match for argument: nfs-utils-lib`.
Apparently Rocky 9 does not have a `nfs-utils-lib` but mounting nfs shares without nfs-utils-lib works fine.
So updating the nfs client install to only install `nfs-utils-lib` if the package is available. That way older rhel clones
should continue to work as well.
2022-07-21 13:49:31 +02:00

31 lines
943 B
Ruby

module VagrantPlugins
module GuestRedHat
module Cap
class NFSClient
def self.nfs_client_install(machine)
machine.communicate.sudo <<-EOH.gsub(/^ {12}/, '')
if command -v dnf; then
if `dnf info -q libnfs-utils > /dev/null 2>&1` ; then
dnf -y install nfs-utils libnfs-utils portmap
elif `dnf info -q nfs-utils-lib > /dev/null 2>&1` ; then
dnf -y install nfs-utils nfs-utils-lib portmap
else
dnf -y install nfs-utils portmap
fi
else
yum -y install nfs-utils nfs-utils-lib portmap
fi
if test $(ps -o comm= 1) == 'systemd'; then
/bin/systemctl restart rpcbind nfs-server
else
/etc/init.d/rpcbind restart
/etc/init.d/nfs restart
fi
EOH
end
end
end
end
end