adding asterisk to the group dialout

Tzafrir Cohen tzafrir.cohen@xorcom.com
Sun, 24 Apr 2005 21:52:56 +0300


--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Apr 14, 2005 at 01:55:38AM +0300, Tzafrir Cohen wrote:
> On Thu, Apr 14, 2005 at 12:19:32AM +0200, Kilian Krause wrote:
> > Hi Tzafrir,
> > 
> > > The postinst script of asterisk does not seem to add asterisk to the
> > > dialout group. Isn't that group the group for the zaptel devices?
> > 
> > 
> > yes it is. And that's a (known) bug Jose and I had already been talking
> > about. =)
> > 
> > Thanks for bringing it back onto the TODO!
> 
> Here's my current idea. I must admit I could not figure out what the 
> current lines do. There seem to be some typos. The TODO I've added is
> to handle the case of existing Rapid users. It may be less critical for
> existing Sid/Sarge users.

Current patch also updates existing users.
(just remove the two TODO lines after applying it :-)

-- 
Tzafrir Cohen     icq#16849755  +972-50-7952406
tzafrir.cohen@xorcom.com  http://www.xorcom.com

--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ast_dialout.diff"

--- /home/tzafrir/Proj/Alioth/pkg-voip/asterisk/trunk/debian/postinst	2005-02-19 10:14:20.000000000 +0200
+++ ../asterisk/asterisk-1.0.7/debian/postinst	2005-04-24 19:17:19.000000000 +0300
@@ -18,9 +18,16 @@
 		if [ "`getent passwd asterisk|awk -F: '{print $6}'`" = "/var/run/asterisk" ];then
 			usermod -d /var/lib/asterisk asterisk
 		fi
+                # is asterisk is not in the group dialout: add it
+		if [ "`groups asterisk |grep -w -v dialout`" != '' ];then
+			adduser asterisk dialout
+		fi
+		# TODO: check if not in group dialin and /dev/zap is in 
+		# group dialin and add me to group dialin.
 	else
-	    	adduser --system --group --home /var/lib/asterisk --gecos "Asterisk PBX daemon" asterisk
-		adduser asterisk audio
+	    	adduser --system --home /var/lib/asterisk \
+			--gecos "Asterisk PBX daemon" asterisk
+		usermod -G dialin,audio asterisk
 	fi
 	test -d /var/log/asterisk || mkdir /var/log/asterisk
 	test -d /var/log/asterisk/cdr-csv || mkdir /var/log/asterisk/cdr-csv

--82I3+IH0IqGh5yIs--