Blame tests/p_nfs/nfs_share_rw.sh

Steve Barnes 723e7b
#!/bin/sh
Steve Barnes 723e7b
# Author: Athmane Madjoudj <athmanem@gmail.com>
Steve Barnes 723e7b
Steve Barnes 723e7b
t_Log "Running $0 - NFS writable share test."
Steve Barnes 723e7b
Steve Barnes 723e7b
cp /etc/exports /etc/exports.orig
Steve Barnes 723e7b
echo '/srv/nfs *(rw,sync,no_root_squash)' >/etc/exports
Steve Barnes 723e7b
mkdir -p /srv/nfs
Steve Barnes 723e7b
exportfs -ar
Steve Barnes 723e7b
Athmane Madjoudj f4110c
# Fix SELinux boolean
Athmane Madjoudj f4110c
setsebool allow_nfsd_anon_write 1
Athmane Madjoudj f4110c
Steve Barnes 723e7b
# Mount the share
Athmane Madjoudj ca1e78
mkdir /mnt/nfs
Athmane Madjoudj 1ae544
mount -t nfs 127.0.0.1:/srv/nfs /mnt/nfs || exit 1
Athmane Madjoudj ca1e78
echo 'NFS test file' > /mnt/nfs/test.txt
Steve Barnes 723e7b
Steve Barnes 723e7b
# Test twice
Athmane Madjoudj ca1e78
(cat /mnt/nfs/test.txt | grep 'NFS test file' > /dev/null 2>&1) && \
Steve Barnes 723e7b
(cat /srv/nfs/test.txt | grep 'NFS test file' > /dev/null 2>&1)
Athmane Madjoudj 478755
ret_val=$?
Steve Barnes 723e7b
Athmane Madjoudj 478755
# Clean up
Athmane Madjoudj 478755
umount /mnt/nfs
Athmane Madjoudj 478755
/bin/rm -fr /mnt/nfs
Alice Kaerast 4b697f
mv /etc/exports.orig /etc/exports
Athmane Madjoudj 478755
Athmane Madjoudj 478755
t_CheckExitStatus $ret_val