| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -x |
| 4 |
set -e |
| 5 |
|
| 6 |
now=$(date --utc) |
| 7 |
result=0 |
| 8 |
|
| 9 |
echo "creating /nfspub nfs export" |
| 10 |
mkdir -p /nfspub |
| 11 |
echo "${now} - This is an nfs public export" > /nfspub/nfs-public.txt |
| 12 |
echo "/nfspub *(ro,no_subtree_check)" > /etc/exports |
| 13 |
exportfs -avr |
| 14 |
|
| 15 |
echo "Configuring automount for nfs on /net" |
| 16 |
mkdir -p /etc/auto.master.d |
| 17 |
echo '/net -hosts -intr,soft --timeout=180' > /etc/auto.master.d/net.autofs |
| 18 |
systemctl restart autofs |
| 19 |
|
| 20 |
echo "Accessing the autofs mountpoint" |
| 21 |
timeout 30s grep -qE "${now}.*nfs public" /net/localhost/nfspub/nfs-public.txt || result=$? |
| 22 |
if [ "$result" -ne "0" ]; then |
| 23 |
echo "test failed, couldn't access /net/localhost/nfspub/nfs-public.txt" |
| 24 |
exit ${result} |
| 25 |
fi |