From a83d2539ec7dbb6663444e88560e65db64bc8076 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Wed, 13 Jun 2012 11:27:54 +0530 Subject: hooks: Added fstab entry for samba share - Add fstab entry for samba shares exported via hooks only on successfully mounting - Remove fstab entry for samba export in samba-stop script - Fixed an unintentional use of 'function-local' variable in shell script which relies on bash's variable scope internals. Signed-off-by: Krishnan Parthasarathi Signed-off-by: Vijay Bellur --- extras/hook-scripts/stop/pre/S30samba-stop.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'extras/hook-scripts/stop') diff --git a/extras/hook-scripts/stop/pre/S30samba-stop.sh b/extras/hook-scripts/stop/pre/S30samba-stop.sh index 783171a437e..83659e4ff4f 100644 --- a/extras/hook-scripts/stop/pre/S30samba-stop.sh +++ b/extras/hook-scripts/stop/pre/S30samba-stop.sh @@ -37,6 +37,18 @@ function umount_volume () { umount -l $mnt_pre/$volname } +function remove_fstab_entry () { + volname=$1 + mntpt=$2 + mntent="`hostname`:/$volname $mntpt glusterfs defaults,transport=tcp 0 0" + esc_mntent=$(echo -e "$mntent" | sed 's/\//\\\//g') + exists=`grep "$mntent" /etc/fstab` + if [ "$exists" != " " ] + then + sed -i /"$esc_mntent"/d /etc/fstab + fi +} + function sighup_samba () { pid=`cat /var/run/smbd.pid` if [ $pid != " " ] @@ -50,4 +62,5 @@ function sighup_samba () { parse_args $@ del_samba_export $VOL umount_volume $VOL $MNT_PRE +remove_fstab_entry $VOL $MNT_PRE/$VOL sighup_samba -- cgit