3 # Requires the pre-configured samba machine
20 do_node $smbsrv "service smb status" || rc=$?
34 smbconf=$(do_node $smbsrv \
35 smbd -b | grep CONFIGFILE | sed -re 's/\s+CONFIGFILE: //g')
36 grep -q $smbshare $smbconf && return
38 do_node $smbsrv "cp $smbconf $smbconftmp"
39 do_node $smbsrv "cat <<EOF >> $smbconf
47 # The samba daemons are constantly (once every 60 seconds) checking the
48 # smb.conf file, so it is good practice to keep this file small.
49 local smbsmall=$(do_nodes $smbsrv "mktemp -t smb.conf.small.XXX")
50 do_node $smbsrv "testparm -s >$smbsmall"
51 do_node $smbsrv "testparm -s $smbsmall >$smbconf"
53 do_node $smbsrv "echo $smbpasswd | tee - | smbpasswd -a $smbuser -s"
56 restore_config_smb() {
61 smbconf=$(do_node $smbsrv \
62 smbd -b | grep CONFIGFILE | sed -re 's/\s+CONFIGFILE: //g')
64 echo -e "\nRestoring smb config from $smbconftmp ..."
65 do_node $smbsrv "cp $smbconftmp $smbconf"
71 local smbclimntpt=${3}
76 do_node $smbsrv "service smb restart" || return 1
77 local parameter_path=$(do_node $smbsrv \
78 "testparm -s --section-name $smbshare --parameter-name path 2> /dev/null")
79 [[ -z $parameter_path ]] && return 1
80 do_nodesv $smbsrv "chmod a+xrw $parameter_path"
81 do_nodesv $smbsrv "ls -ald $parameter_path"
83 local cmd="mount -t cifs //$smbsrv/$smbshare $smbclimntpt -o user=$smbuser,pass=$smbpasswd"
84 echo -e "\nMounting CIFS clients $smbclients : $cmd"
85 do_nodesv $smbclients "$cmd" || return 1
86 do_nodesv $smbclients mount | grep $smbclimntpt
91 local smbclimntpt=${2}
94 echo -e "\nUnmounting CIFS clients..."
95 do_nodes $smbclients "umount -f $smbclimntpt" || return 1
96 do_node $smbsrv "service smb stop"