diff --git a/import_mbox.sh b/import_mbox.sh index 167c8e428adbb0b3c4e19dded2f7c66471c47345..a3ad0ac9aeaaf355a7e6f846e322f0180ff5559f 100755 --- a/import_mbox.sh +++ b/import_mbox.sh @@ -37,11 +37,16 @@ if [ ! -f "$MBOX_FILE" ]; then echo "$SYNTAX" >&2 exit 1 fi -if [ ! -d "$SYMPA_ROOT/list_data/$SYMPA_DOMAIN/$LIST_NAME" ]; then +if [ ! -d $SYMPA_ROOT/list_data/$SYMPA_DOMAIN/$LIST_NAME ]; then echo "Missing or invalid list name!" >&2 echo "$SYNTAX" >&2 exit 1 fi +arcdir=$SYMPA_ROOT/arc/$LIST_NAME@$SYMPA_DOMAIN +if [ -e $arcdir ]; then + echo "ERROR: arc dir '$arcdir' already exists, please clean up first" >&2 + exit 1 +fi # Create archives directory if not yet done mkdir -p "$SYMPA_ROOT/list_data/$SYMPA_DOMAIN/$LIST_NAME/archives" @@ -61,7 +66,7 @@ pushd "$SYMPA_ROOT/list_data/$SYMPA_DOMAIN/$LIST_NAME/archives" # Convert to Sympa text archives echo "Step 2: converting $MBOX_BACKUP into .log files" >&2 $base/mbox2sympa.pl $MBOX_BACKUP -rm $MBOX_BACKUP +rm -f $MBOX_BACKUP chown -R $SYMPA_USER "$SYMPA_ROOT/list_data/$SYMPA_DOMAIN/$LIST_NAME/archives" chmod -R g=rX,o= "$SYMPA_ROOT/list_data/$SYMPA_DOMAIN/$LIST_NAME/archives" diff --git a/mm2sympa.sh b/mm2sympa.sh index 043941a40824b49f7e25c9bbcb26014509794b6e..ef8f550c8a59707f4c81f216fcdb151eb5ffa6c0 100755 --- a/mm2sympa.sh +++ b/mm2sympa.sh @@ -11,8 +11,12 @@ if [ -z "$mailmanlist" ]; then fi mmlistname=${mailmanlist%@*} mmdomain=${mailmanlist#*@} -robot=${mmdomain/lists/sympa} sympalistname=$mmlistname +robot=${mmdomain/lists/sympa} +if [ -n "$2" ]; then + sympalistname=${2%@*} + robot=${2#*@} +fi mmarchive=/var/lib/mailman/archives/private/$mmlistname.mbox/$mmlistname.mbox if [ ! -f "/etc/sympa/$robot/robot.conf" ]; then @@ -20,6 +24,11 @@ if [ ! -f "/etc/sympa/$robot/robot.conf" ]; then exit 1 fi +if [ -z "$MMPW" ]; then + echo "Please set MMPW to the listadmin password of $mmdomain!" >&2 + exit 1 +fi + function sshml() { ssh -o ControlPath="~/.ssh/cp-$MPI_ROOT-%C" -o ControlMaster=auto -o ControlPersist=600s $mmdomain -l root "$@" } @@ -33,7 +42,7 @@ tmpdir=$(mktemp -t -d mm2sympa.${mailmanlist/@/AT}.XXXXXXXX) chmod go+rx $tmpdir trap "rm -rf $tmpdir" 0 1 2 5 15 EXIT -set -x +#set -x # create list based on mailman config inputpy=$tmpdir/input.py