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"