From 190b8abf3f0c3ad799d8eedc30c52fb5b6e8ad39 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sun, 17 Dec 2017 08:49:36 -0500 Subject: [PATCH] samba fix for user homes should work now. --- scripts/site_avenger/revamp_cakelampvm.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/site_avenger/revamp_cakelampvm.sh b/scripts/site_avenger/revamp_cakelampvm.sh index 9afd9214..a9016d8c 100644 --- a/scripts/site_avenger/revamp_cakelampvm.sh +++ b/scripts/site_avenger/revamp_cakelampvm.sh @@ -176,13 +176,22 @@ fi # fix samba configuration for (ass-headed) default of read-only in user homes. # why add a necessary feature if you're just going to cripple it by default? -search_replace a b -/etc/samba/smb.conf  +pattern="[#;][[:blank:]]*read only = yes" +replacement="read only = no" + +# first see if we've already done this. +# if we find any occurrence of the replacement, we assume we already did it. +# ** we're assuming a lot about the structure of the samba config file! +grep -q "$replacement" /etc/samba/smb.conf  if [ $? -ne 0 ]; then - echo "the samba configuration has already been fixed for user homes, so that's fine." + echo "the samba configuration has already been fixed for user homes, s'cool." else + # so not there yet; we need to make the replacement. + sed -i "0,/$pattern/{s/$pattern/$replacement/}" /etc/samba/smb.conf + test_or_die "patching samba configuration to enable write acccess on user home dirs" + # sweet, looks like that worked... restart_samba - echo successfully patched the samba configuration to enable writes on user home directories. super cool. + echo successfully patched the samba configuration to enable writes on user home directories. way cool. fi ############## -- 2.34.1