All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Magnus Naeslund(k)" <mag@kite.se>
To: mlmmj@mlmmj.org
Subject: Re: Submitting patches, more automatic list creation
Date: Sun, 06 Aug 2006 17:15:58 +0000	[thread overview]
Message-ID: <44D623CE.7040101@kite.se> (raw)
In-Reply-To: <44D6222D.5020802@kite.se>

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

  reply	other threads:[~2006-08-06 17:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-06 17:09 Submitting patches, more automatic list creation Magnus Naeslund(k)
2006-08-06 17:15 ` Magnus Naeslund(k) [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44D623CE.7040101@kite.se \
    --to=mag@kite.se \
    --cc=mlmmj@mlmmj.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.