Blame tests/p_samba/samba_share_test.sh

Athmane Madjoudj 7a6852
#!/bin/sh
Athmane Madjoudj 7a6852
# Author: Athmane Madjoudj <athmanem@gmail.com>
Athmane Madjoudj 7a6852
Athmane Madjoudj 7a6852
t_Log "Running $0 - Samba share test."
Athmane Madjoudj 7a6852
Athmane Madjoudj 7a6852
Athmane Madjoudj 7a6852
cp /etc/samba/smb.conf /etc/samba/smb.conf.orig
Athmane Madjoudj 7a6852
cat > /etc/samba/smb.conf <
Athmane Madjoudj 7a6852
[global] 
Athmane Madjoudj 7a6852
workgroup = wrkgrp 
Athmane Madjoudj 7a6852
netbios name = smbsrv 
Athmane Madjoudj 7a6852
security = share  
Athmane Madjoudj 7a6852
Athmane Madjoudj 7a6852
[testshare]
Athmane Madjoudj 7a6852
comment = Test share
Athmane Madjoudj 7a6852
path = /srv/smb
Athmane Madjoudj 7a6852
read only = yes
Athmane Madjoudj 7a6852
guest only = yes
Athmane Madjoudj 7a6852
EOF
Athmane Madjoudj 7a6852
Athmane Madjoudj 7a6852
# Reload the config
Athmane Madjoudj 7a6852
service smb restart
Athmane Madjoudj 7a6852
Athmane Madjoudj 7a6852
Athmane Madjoudj 7a6852
mkdir -p /srv/smb
Athmane Madjoudj 7a6852
echo "SMB test file" > /srv/smb/test.txt
Athmane Madjoudj 7a6852
mkdir /mnt/smb
Athmane Madjoudj 7a6852
Athmane Madjoudj 7a6852
# Fix SELinux context
Athmane Madjoudj 7a6852
chcon -R -t samba_share_t /srv/smb
Athmane Madjoudj 7a6852
Athmane Madjoudj 7a6852
# Mount the share
Athmane Madjoudj 7a6852
mount -t cifs -o guest,ro //127.0.0.1/testshare /mnt/smb
Athmane Madjoudj 7a6852
sleep 1
Athmane Madjoudj 7a6852
Athmane Madjoudj 7a6852
# Test 
Athmane Madjoudj 7a6852
cat /mnt/smb/test.txt | grep 'SMB test file' > /dev/null 2>&1
Athmane Madjoudj 7a6852
Athmane Madjoudj 7a6852
t_CheckExitStatus $?