# Depends on gnutls

# Exit on error:
set -e

wget ftp://ftp.mutt.org/pub/mutt/mutt-1.5.22.tar.gz
tar xf mutt-1.5.22.tar.gz
cd mutt-1.5.22

./configure \
    --prefix= \
    --with-gnutls \
    --enable-imap

# groupadd mail (as root) fixes:
# chgrp mail /bin/mutt_dotlock
# /bin/chgrp: invalid group: 'mail'

# Fix
# /bin/chgrp: changing group of '/bin/mutt_dotlock': Operation not permitted
sed -i.orig '1316,1320d' Makefile

make install
cd ..
rm -rf mutt-1.5.22
#rm mutt-1.5.22.tar.gz

echo Now, as root:
echo chgrp mail /bin/mutt_dotlock
echo chmod 2755 /bin/mutt_dotlock

exit 0
