Only add rules if they don't already exist

This commit is contained in:
Bob Mottram 2015-04-03 23:30:26 +01:00
parent 11d451742f
commit 8d1240017b
2 changed files with 8 additions and 6 deletions

View File

@ -73,11 +73,13 @@ if [ ! -d "$LISTDIR" ]; then
mkdir -m 700 $LISTDIR/cur
fi
chown -R $MYUSERNAME:$MYUSERNAME $LISTDIR
echo "" >> $PM
echo ":0" >> $PM
echo " * ^From: $EMAILADDRESS" >> $PM
echo "$LISTDIR/new" >> $PM
chown $MYUSERNAME:$MYUSERNAME $PM
if ! grep -q "From: $EMAILADDRESS" $PM; then
echo "" >> $PM
echo ":0" >> $PM
echo " * ^From: $EMAILADDRESS" >> $PM
echo "$LISTDIR/new" >> $PM
chown $MYUSERNAME:$MYUSERNAME $PM
fi
if [ ! -f "$MUTTRC" ]; then
cp /etc/Muttrc $MUTTRC
chown $MYUSERNAME:$MYUSERNAME $MUTTRC

View File

@ -79,7 +79,7 @@ if [ ! -d "$LISTDIR" ]; then
fi
chown -R $MYUSERNAME:$MYUSERNAME $LISTDIR
if ! grep -q "$LISTDIR/new" $PM; then
if ! grep -q "Subject:.*()\[$SUBJECTTAG\]" $PM; then
echo "" >> $PM
echo ":0" >> $PM
echo " * ^Subject:.*()\[$SUBJECTTAG\]" >> $PM