#!/bin/bash

PINERC=$HOME/.pinerc

case $0 in
	pinepgp26x-install)	PGPVER="26x";;
	pinepgp50-install)	PGPVER="50";;
esac

if [ ! -f $PINERC ]; then
	echo -e "You have no .pinerc file"
else

cp $PINERC $PINERC.old

sed -e '
s/^display-filters=/display-filters=_LEADING(\"-----BEGIN PGP MESSAGE-----\")_ pgp$PGPVER-check,\
        _LEADING(\"-----BEGIN PGP SIGNED MESSAGE-----\")_ pgp$PGPVER-check,\
        /
s/^sending-filters=/sending-filters=pgp$PGPVER-sign,\
        pgp$PGPVER-encrypt _RECIPIENTS_,\
        pgp$PGPVER-sign+encrypt _RECIPIENTS_,\
        /
s/^display-filters=$/display-filters=_LEADING(\"-----BEGIN PGP MESSAGE-----\")_ pgp$PGPVER-check,\
        _LEADING(\"-----BEGIN PGP SIGNED MESSAGE-----\")_ pgp$PGPVER-check\
        /
s/^sending-filters=$/sending-filters=pgp$PGPVER-sign,\
        pgp$PGPVER-encrypt _RECIPIENTS_,\
        pgp$PGPVER-sign+encrypt _RECIPIENTS_\
        /
' $PINERC.old | uniq > $PINERC

fi
