Command to remove a mailing list folder

This commit is contained in:
Bob Mottram 2015-04-03 23:23:32 +01:00
parent 99abdaff13
commit 11d451742f
15 changed files with 79 additions and 5 deletions

View File

@ -20,6 +20,7 @@ install:
install -m 755 src/${APP}-addlist ${DESTDIR}${PREFIX}/bin install -m 755 src/${APP}-addlist ${DESTDIR}${PREFIX}/bin
install -m 755 src/${APP}-addemail ${DESTDIR}${PREFIX}/bin install -m 755 src/${APP}-addemail ${DESTDIR}${PREFIX}/bin
install -m 755 src/${APP}-renew-cert ${DESTDIR}${PREFIX}/bin install -m 755 src/${APP}-renew-cert ${DESTDIR}${PREFIX}/bin
install -m 755 src/${APP}-rmlist ${DESTDIR}${PREFIX}/bin
mkdir -m 755 -p ${DESTDIR}${PREFIX}/share/man/man1 mkdir -m 755 -p ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}.1.gz ${DESTDIR}${PREFIX}/share/man/man1 install -m 644 man/${APP}.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-prep.1.gz ${DESTDIR}${PREFIX}/share/man/man1 install -m 644 man/${APP}-prep.1.gz ${DESTDIR}${PREFIX}/share/man/man1
@ -31,6 +32,7 @@ install:
install -m 644 man/${APP}-addlist.1.gz ${DESTDIR}${PREFIX}/share/man/man1 install -m 644 man/${APP}-addlist.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-addemail.1.gz ${DESTDIR}${PREFIX}/share/man/man1 install -m 644 man/${APP}-addemail.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-renew-cert.1.gz ${DESTDIR}${PREFIX}/share/man/man1 install -m 644 man/${APP}-renew-cert.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-rmlist.1.gz ${DESTDIR}${PREFIX}/share/man/man1
uninstall: uninstall:
rm -f ${PREFIX}/share/man/man1/${APP}.1.gz rm -f ${PREFIX}/share/man/man1/${APP}.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-prep.1.gz rm -f ${PREFIX}/share/man/man1/${APP}-prep.1.gz
@ -42,6 +44,7 @@ uninstall:
rm -f ${PREFIX}/share/man/man1/${APP}-addlist.1.gz rm -f ${PREFIX}/share/man/man1/${APP}-addlist.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-addemail.1.gz rm -f ${PREFIX}/share/man/man1/${APP}-addemail.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-renew-cert.1.gz rm -f ${PREFIX}/share/man/man1/${APP}-renew-cert.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-rmlist.1.gz
rm -rf ${PREFIX}/share/${APP} rm -rf ${PREFIX}/share/${APP}
rm -f ${PREFIX}/bin/${APP} rm -f ${PREFIX}/bin/${APP}
rm -f ${PREFIX}/bin/${APP}-prep rm -f ${PREFIX}/bin/${APP}-prep
@ -53,6 +56,7 @@ uninstall:
rm -f ${PREFIX}/bin/${APP}-addlist rm -f ${PREFIX}/bin/${APP}-addlist
rm -f ${PREFIX}/bin/${APP}-addemail rm -f ${PREFIX}/bin/${APP}-addemail
rm -f ${PREFIX}/bin/${APP}-renew-cert rm -f ${PREFIX}/bin/${APP}-renew-cert
rm -f ${PREFIX}/bin/${APP}-rmlist
clean: clean:
rm -f \#* \.#* debian/*.substvars debian/*.log rm -f \#* \.#* debian/*.substvars debian/*.log
rm -fr deb.* debian/${APP} rm -fr deb.* debian/${APP}

View File

@ -8,3 +8,4 @@ man/freedombone-addcert.1.gz
man/freedombone-addlist.1.gz man/freedombone-addlist.1.gz
man/freedombone-addemail.1.gz man/freedombone-addemail.1.gz
man/freedombone-renew-cert.1.gz man/freedombone-renew-cert.1.gz
man/freedombone-rmlist.1.gz

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
man/freedombone-rmlist.1.gz Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

67
src/freedombone-rmlist Executable file
View File

@ -0,0 +1,67 @@
#!/bin/bash
# Removes a mailing list to the email configuration
# License
# =======
#
# Copyright (C) 2015 Bob Mottram <bob@robotics.uk.to>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
MYUSERNAME=$USER
MAILINGLIST=
function show_help {
echo ''
echo 'freedombone-rmlist -u [username] -l [mailing list name]'
echo ''
exit 0
}
while [[ $# > 1 ]]
do
key="$1"
case $key in
-h|--help)
show_help
;;
-u|--user)
shift
MYUSERNAME="$1"
;;
-l|--list)
shift
MAILINGLIST="$1"
;;
*)
# unknown option
;;
esac
shift
done
if ! [[ $MYUSERNAME && $MAILINGLIST ]]; then
show_help
fi
MUTTRC=/home/$MYUSERNAME/.muttrc
MUTT_MAILBOXES=$(grep "mailboxes =" $MUTTRC)
if [[ $MUTT_MAILBOXES == *$MAILINGLIST* ]]; then
sed -i "s| =$MAILINGLIST||g" $MUTTRC
chown $MYUSERNAME:$MYUSERNAME $MUTTRC
fi
exit 0