All of lore.kernel.org
 help / color / mirror / Atom feed
* Submitting patches, more automatic list creation
@ 2006-08-06 17:09 Magnus Naeslund(k)
  2006-08-06 17:15 ` Magnus Naeslund(k)
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Magnus Naeslund(k) @ 2006-08-06 17:09 UTC (permalink / raw)
  To: mlmmj

Are patches welcome, or.. is this patch of any interest?
I'm trying to automate list creatation when mlmmj-make-ml.sh is used in
another script.
I've added some options to mlmmj-make-ml.sh to make it easier for us to
use it.
I'm also considering to add an alternate listdir :
/var/spool/mlmmj/$LISTNAME@$FQDN, would that be of interest to have in a
switch?

I'm pasting in this patch into thunderbird, I hope it doesn't get garbeled.

Regards,
Magnus

--- mlmmj-make-ml.sh.in.orig	2006-08-06 18:15:58.000000000 +0200
+++ mlmmj-make-ml.sh.in	2006-08-06 18:43:57.000000000 +0200
@@ -6,6 +6,7 @@
 VERSION="0.1"
 DEFAULTDIR="/var/spool/mlmmj"
 ALIASFILE=/etc/aliases
+TEXTPATHDEF="@textlibdir@"
 
 USAGE="mlmmj-make-ml "$VERSION"
 "$0" [OPTIONS]
@@ -14,10 +15,14 @@
 -L	the name of the mailinglist
 -s	your spool directory if not "$DEFAULTDIR"
 -a	create the needed entrys in your $ALIASFILE file
+-d	domain for the list
+-o	owner of the list
+-y	assume Yes and default options on most questions
+-t	text/language template directory (default: "$TEXTPATHDEF")
 -z	nuffn for now
 -c	chown the spool dir"
 
-while getopts ":hL:s:azc:" Option
+while getopts ":yhL:s:azc:d:s:o:s:t:s" Option
 do
 case "$Option" in 
 	h )
@@ -37,6 +42,18 @@
 	a )
 	A_CREATE="YES"
 	;;
+	d )
+	FQDN="$OPTARG"
+	;;
+	o )
+	OWNER="$OPTARG"
+	;;
+	t )
+	TEXTPATH="$OPTARG"
+	;;
+	y )
+	ALLYES="YES"
+	;;
 	c )
 	DO_CHOWN=1
 	CHOWN="$OPTARG"
@@ -59,7 +76,7 @@
 	echo -n "What should the name of the Mailinglist be? [mlmmj-test] : "
 	read LISTNAME
 	if [ -z "$LISTNAME" ]; then
-	LISTNAME="mlmmj-test"
+		LISTNAME="mlmmj-test"
 	fi
 fi
 
@@ -76,35 +93,54 @@
 
 test -f "$LISTDIR"/index || touch "$LISTDIR"/index
 
-echo -n "The Domain for the List? [] : "
-read FQDN
 if [ -z "$FQDN" ]; then
-	FQDN=`domainname -f`
+	if which domainname >/dev/null 2>&1 ; then
+		FQDN_SYSTEM=`domainname -f`
+	else
+		FQDN_SYSTEM=`dnsdomainname -f`
+	fi	
+	
+	echo -n "The Domain for the List? [$FQDN_SYSTEM] : "
+	[ -z "$ALLYES" ] && read FQDN
+	if [ -z "$FQDN" ]; then
+		FQDN="$FQDN_SYSTEM"
+	fi
 fi
 
-echo -n "The emailaddress of the list owner? [postmaster] : "
-read OWNER
 if [ -z "$OWNER" ]; then
-	OWNER="postmaster"
-fi
+	echo -n "The emailaddress of the list owner? [postmaster] : "
+	if [ -z "$ALLYES" ]; then
+		read OWNER
+	else
+		echo
+	fi
+	if [ -z "$OWNER" ]; then
+		OWNER="postmaster"
+	fi
+fi	
 echo "$OWNER" > "$LISTDIR"/"control/owner"
 
-TEXTPATHDEF=@textlibdir@
-echo -n "The path to texts for the list? [$TEXTPATHDEF] : "
-read TEXTPATHIN
-if [ -z "$TEXTPATHIN" ] ; then
-	TEXTPATH=$TEXTPATHDEF
-else
-	TEXTPATH=$TEXTPATHIN
-fi
-if [ ! -d "$TEXTPATH" ]; then
-	echo
-        echo "**NOTE** Could not copy the texts for the list"
-        echo "Please manually copy the files from the listtexts/ directory"
-        echo "in the source distribution of mlmmj."
-	sleep 2
-else
-        cp "$TEXTPATH"/* "$LISTDIR"/"text"
+if [ -z "$TEXTPATH" ] ; then
+	echo -n "The path to texts for the list? [$TEXTPATHDEF] : "
+	if [ -z "$ALLYES" ]; then
+		read TEXTPATHIN
+	else
+		echo
+	fi
+	if [ -z "$TEXTPATHIN" ] ; then
+		TEXTPATH=$TEXTPATHDEF
+	else
+		TEXTPATH=$TEXTPATHIN
+	fi
+	if [ ! -d "$TEXTPATH" ]; then
+		echo
+	        echo "**NOTE** Could not copy the texts for the list"
+	        echo "Please manually copy the files from the listtexts/ directory"
+	        echo "in the source distribution of mlmmj."
+		sleep 2
+	else
+	        cp "$TEXTPATH"/* "$LISTDIR"/"text"
+	fi
 fi
 
 LISTADDRESS="$LISTNAME@$FQDN"
@@ -120,15 +156,20 @@
 	MLMMJMAINTD="/path/to/mlmmj-maintd"
 fi
 
-ALIAS="$LISTNAME:  \"|$MLMMJRECIEVE -L $SPOOLDIR/$LISTNAME/\""
-CRONENTRY="0 */2 * * * \"$MLMMJMAINTD -F -L $SPOOLDIR/$LISTNAME/\""
+ALIAS="$LISTNAME:  \"|$MLMMJRECIEVE -L $LISTDIR/\""
+CRONENTRY="0 */2 * * * \"$MLMMJMAINTD -F -L $LISTDIR/\""
 
 if [ -n "$A_CREATE" ]; then
 	echo "I want to add the following to your $ALIASFILE file:"
 	echo "$ALIAS"
 
 	echo -n "is this ok? [y/N] : "
-	read OKIDOKI
+	if [ -z "$ALLYES" ] ; then
+		read OKIDOKI
+	else
+		OKIDOKI="Y"
+		echo "Y"
+	fi
 	case $OKIDOKI in
 		y|Y)
 		echo "$ALIAS" >> $ALIASFILE
@@ -147,11 +188,16 @@
 
 if [ "$DO_CHOWN" ] ; then
 	echo
-	echo -n "chown -R $CHOWN $SPOOLDIR/$LISTNAME? [y/n]: "
-	read OKIDOKI
+	echo -n "chown -R $CHOWN $LISTDIR? [y/n]: "
+	if [ -z "$ALLYES" ] ; then
+		read OKIDOKI
+	else
+		OKIDOKI="Y"
+		echo "Y"
+	fi
 	case $OKIDOKI in
 		y|Y)
-			chown -R $CHOWN $SPOOLDIR/$LISTNAME
+			chown -R "$CHOWN" "$LISTDIR"
 		;;
 		n|N)
 			exit 0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Submitting patches, more automatic list creation
  2006-08-06 17:09 Submitting patches, more automatic list creation Magnus Naeslund(k)
@ 2006-08-06 17:15 ` Magnus Naeslund(k)
  2006-08-08 17:17 ` Magnus Naeslund(k)
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Magnus Naeslund(k) @ 2006-08-06 17:15 UTC (permalink / raw)
  To: mlmmj

Magnus Naeslund(k) wrote:
> Are patches welcome, or.. is this patch of any interest?

Here's an updated patch that fixes some display issues on -y.
Also I forgot to mention that this contains a bugfix that makes 
the script look for the dnsdomainname program if domainname doesn't
exists, as is the case on many linux systems.

Regards,
Magnus

--- mlmmj-make-ml.sh.in.orig	2006-08-06 18:15:58.000000000 +0200
+++ mlmmj-make-ml.sh.in	2006-08-06 19:11:54.000000000 +0200
@@ -6,6 +6,7 @@
 VERSION="0.1"
 DEFAULTDIR="/var/spool/mlmmj"
 ALIASFILE=/etc/aliases
+TEXTPATHDEF="@textlibdir@"
 
 USAGE="mlmmj-make-ml "$VERSION"
 "$0" [OPTIONS]
@@ -14,10 +15,14 @@
 -L	the name of the mailinglist
 -s	your spool directory if not "$DEFAULTDIR"
 -a	create the needed entrys in your $ALIASFILE file
+-d	domain for the list
+-o	owner of the list
+-y	assume Yes and default options on most questions
+-t	text/language template directory (default: "$TEXTPATHDEF")
 -z	nuffn for now
 -c	chown the spool dir"
 
-while getopts ":hL:s:azc:" Option
+while getopts ":yhL:s:azc:d:s:o:s:t:s" Option
 do
 case "$Option" in 
 	h )
@@ -37,6 +42,18 @@
 	a )
 	A_CREATE="YES"
 	;;
+	d )
+	FQDN="$OPTARG"
+	;;
+	o )
+	OWNER="$OPTARG"
+	;;
+	t )
+	TEXTPATH="$OPTARG"
+	;;
+	y )
+	ALLYES="YES"
+	;;
 	c )
 	DO_CHOWN=1
 	CHOWN="$OPTARG"
@@ -59,7 +76,7 @@
 	echo -n "What should the name of the Mailinglist be? [mlmmj-test] : "
 	read LISTNAME
 	if [ -z "$LISTNAME" ]; then
-	LISTNAME="mlmmj-test"
+		LISTNAME="mlmmj-test"
 	fi
 fi
 
@@ -76,35 +93,58 @@
 
 test -f "$LISTDIR"/index || touch "$LISTDIR"/index
 
-echo -n "The Domain for the List? [] : "
-read FQDN
 if [ -z "$FQDN" ]; then
-	FQDN=`domainname -f`
+	if which domainname >/dev/null 2>&1 ; then
+		FQDN_SYSTEM=`domainname -f`
+	else
+		FQDN_SYSTEM=`dnsdomainname -f`
+	fi	
+	
+	echo -n "The Domain for the List? [$FQDN_SYSTEM] : "
+	if [ -z "$ALLYES" ]; then
+		read FQDN
+	else
+		echo
+	fi
+	if [ -z "$FQDN" ]; then
+		FQDN="$FQDN_SYSTEM"
+	fi
 fi
 
-echo -n "The emailaddress of the list owner? [postmaster] : "
-read OWNER
 if [ -z "$OWNER" ]; then
-	OWNER="postmaster"
-fi
+	echo -n "The emailaddress of the list owner? [postmaster] : "
+	if [ -z "$ALLYES" ]; then
+		read OWNER
+	else
+		echo
+	fi
+	if [ -z "$OWNER" ]; then
+		OWNER="postmaster"
+	fi
+fi	
 echo "$OWNER" > "$LISTDIR"/"control/owner"
 
-TEXTPATHDEF=@textlibdir@
-echo -n "The path to texts for the list? [$TEXTPATHDEF] : "
-read TEXTPATHIN
-if [ -z "$TEXTPATHIN" ] ; then
-	TEXTPATH=$TEXTPATHDEF
-else
-	TEXTPATH=$TEXTPATHIN
-fi
-if [ ! -d "$TEXTPATH" ]; then
-	echo
-        echo "**NOTE** Could not copy the texts for the list"
-        echo "Please manually copy the files from the listtexts/ directory"
-        echo "in the source distribution of mlmmj."
-	sleep 2
-else
-        cp "$TEXTPATH"/* "$LISTDIR"/"text"
+if [ -z "$TEXTPATH" ] ; then
+	echo -n "The path to texts for the list? [$TEXTPATHDEF] : "
+	if [ -z "$ALLYES" ]; then
+		read TEXTPATHIN
+	else
+		echo
+	fi
+	if [ -z "$TEXTPATHIN" ] ; then
+		TEXTPATH=$TEXTPATHDEF
+	else
+		TEXTPATH=$TEXTPATHIN
+	fi
+	if [ ! -d "$TEXTPATH" ]; then
+		echo
+	        echo "**NOTE** Could not copy the texts for the list"
+	        echo "Please manually copy the files from the listtexts/ directory"
+	        echo "in the source distribution of mlmmj."
+		sleep 2
+	else
+	        cp "$TEXTPATH"/* "$LISTDIR"/"text"
+	fi
 fi
 
 LISTADDRESS="$LISTNAME@$FQDN"
@@ -120,15 +160,20 @@
 	MLMMJMAINTD="/path/to/mlmmj-maintd"
 fi
 
-ALIAS="$LISTNAME:  \"|$MLMMJRECIEVE -L $SPOOLDIR/$LISTNAME/\""
-CRONENTRY="0 */2 * * * \"$MLMMJMAINTD -F -L $SPOOLDIR/$LISTNAME/\""
+ALIAS="$LISTNAME:  \"|$MLMMJRECIEVE -L $LISTDIR/\""
+CRONENTRY="0 */2 * * * \"$MLMMJMAINTD -F -L $LISTDIR/\""
 
 if [ -n "$A_CREATE" ]; then
 	echo "I want to add the following to your $ALIASFILE file:"
 	echo "$ALIAS"
 
 	echo -n "is this ok? [y/N] : "
-	read OKIDOKI
+	if [ -z "$ALLYES" ] ; then
+		read OKIDOKI
+	else
+		OKIDOKI="Y"
+		echo "Y"
+	fi
 	case $OKIDOKI in
 		y|Y)
 		echo "$ALIAS" >> $ALIASFILE
@@ -147,11 +192,16 @@
 
 if [ "$DO_CHOWN" ] ; then
 	echo
-	echo -n "chown -R $CHOWN $SPOOLDIR/$LISTNAME? [y/n]: "
-	read OKIDOKI
+	echo -n "chown -R $CHOWN $LISTDIR? [y/n]: "
+	if [ -z "$ALLYES" ] ; then
+		read OKIDOKI
+	else
+		OKIDOKI="Y"
+		echo "Y"
+	fi
 	case $OKIDOKI in
 		y|Y)
-			chown -R $CHOWN $SPOOLDIR/$LISTNAME
+			chown -R "$CHOWN" "$LISTDIR"
 		;;
 		n|N)
 			exit 0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Submitting patches, more automatic list creation
  2006-08-06 17:09 Submitting patches, more automatic list creation Magnus Naeslund(k)
  2006-08-06 17:15 ` Magnus Naeslund(k)
@ 2006-08-08 17:17 ` Magnus Naeslund(k)
  2006-08-08 17:56 ` Mads Martin Joergensen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Magnus Naeslund(k) @ 2006-08-08 17:17 UTC (permalink / raw)
  To: mlmmj

Magnus Naeslund(k) wrote:
> Are patches welcome, or.. is this patch of any interest?
> I'm trying to automate list creatation when mlmmj-make-ml.sh is used in
> another script.
[snip]

I take it the patch wasn't of any use?
Will mlmmj developers accept patches at all (given they meet your standard whatever that is), or is it more of cathedral style of delvelopment?
Is there a CVS repository that one could check for latest updates?

Regards,
Magnus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Submitting patches, more automatic list creation
  2006-08-06 17:09 Submitting patches, more automatic list creation Magnus Naeslund(k)
  2006-08-06 17:15 ` Magnus Naeslund(k)
  2006-08-08 17:17 ` Magnus Naeslund(k)
@ 2006-08-08 17:56 ` Mads Martin Joergensen
  2006-08-08 20:51 ` Magnus Naeslund(k)
  2006-08-09  7:30 ` Mads Martin Joergensen
  4 siblings, 0 replies; 6+ messages in thread
From: Mads Martin Joergensen @ 2006-08-08 17:56 UTC (permalink / raw)
  To: mlmmj

* Magnus Naeslund(k) <mag@kite.se> [Aug 08. 2006 19:17]:
> Magnus Naeslund(k) wrote:
> > Are patches welcome, or.. is this patch of any interest?
> > I'm trying to automate list creatation when mlmmj-make-ml.sh is used in
> > another script.
> [snip]
> 
> I take it the patch wasn't of any use?

Patience, please :-) I just started a new job.

> Will mlmmj developers accept patches at all (given they meet your
> standard whatever that is), or is it more of cathedral style of
> delvelopment?  Is there a CVS repository that one could check for
> latest updates?

Your patch will be applied, thanks!

-- 
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic
 and totally illogical, with just a little bit more effort?"
                                 -- A. P. J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Submitting patches, more automatic list creation
  2006-08-06 17:09 Submitting patches, more automatic list creation Magnus Naeslund(k)
                   ` (2 preceding siblings ...)
  2006-08-08 17:56 ` Mads Martin Joergensen
@ 2006-08-08 20:51 ` Magnus Naeslund(k)
  2006-08-09  7:30 ` Mads Martin Joergensen
  4 siblings, 0 replies; 6+ messages in thread
From: Magnus Naeslund(k) @ 2006-08-08 20:51 UTC (permalink / raw)
  To: mlmmj

Mads Martin Joergensen wrote:
> 
> Patience, please :-) I just started a new job.
> 

Oh sorry, I didn't mean to stress you!
I didn't realize it was only two days ago I sent the patch.
Hey, congratulations on the new job...


> Your patch will be applied, thanks!
> 

Nice!
Just let me know if I'm doing anything the wrong way,
I'm not familiar with this project... Yet.

Regards,
Magnus


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Submitting patches, more automatic list creation
  2006-08-06 17:09 Submitting patches, more automatic list creation Magnus Naeslund(k)
                   ` (3 preceding siblings ...)
  2006-08-08 20:51 ` Magnus Naeslund(k)
@ 2006-08-09  7:30 ` Mads Martin Joergensen
  4 siblings, 0 replies; 6+ messages in thread
From: Mads Martin Joergensen @ 2006-08-09  7:30 UTC (permalink / raw)
  To: mlmmj

* Magnus Naeslund(k) <mag@kite.se> [Aug 08. 2006 22:51]:
> Oh sorry, I didn't mean to stress you!
> I didn't realize it was only two days ago I sent the patch.
> Hey, congratulations on the new job...

Thanks!

> > Your patch will be applied, thanks!
> 
> Nice!
> Just let me know if I'm doing anything the wrong way,
> I'm not familiar with this project... Yet.

Oh I will, and already did to the mail you sent with the Subject:
"Bug in subscriber searching function is_subbed_in()" :-)

-- 
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic
 and totally illogical, with just a little bit more effort?"
                                 -- A. P. J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-08-09  7:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-06 17:09 Submitting patches, more automatic list creation Magnus Naeslund(k)
2006-08-06 17:15 ` Magnus Naeslund(k)
2006-08-08 17:17 ` Magnus Naeslund(k)
2006-08-08 17:56 ` Mads Martin Joergensen
2006-08-08 20:51 ` Magnus Naeslund(k)
2006-08-09  7:30 ` Mads Martin Joergensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.