summaryrefslogtreecommitdiff
path: root/mutt_install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mutt_install.sh')
-rwxr-xr-xmutt_install.sh28
1 files changed, 17 insertions, 11 deletions
diff --git a/mutt_install.sh b/mutt_install.sh
index c9ac842..53be42b 100755
--- a/mutt_install.sh
+++ b/mutt_install.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+
muttdir="$HOME/.config/mutt/"
mkdir -p ~/.config/mutt/credentials
@@ -16,13 +17,15 @@ fulladdr=$(\
# Check to see if domain is in domain list
serverinfo=$(cat autoconf/domains.csv | grep -w ^${fulladdr##*@})
-if [ -z "$serverinfo" ]; then echo No suitable match. && exit; fi
-
+if [ -z "$serverinfo" ];
+ then
+ echo No suitable match. && exit
+ else
# Read in server data as variables
IFS=, read service imap iport smtp sport spoolfile postponed record <<EOF
$serverinfo
EOF
-clear
+fi
realname=$(\
dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Enter the full name you'd like to be identified by on this email account." 10 60 \
@@ -61,20 +64,23 @@ replacement="
/$delet/d"
+
addAccount() {
+ # First, adding the encrypted password.
+ dialog --title "Luke's mutt/offlineIMAP password wizard" --passwordbox "Enter the password for the \"$title\" account." 10 60 2> /tmp/$title
+ gpg -r $youremail --encrypt /tmp/$title
+ shred -u /tmp/$title && echo "Password encrypted and memory shredded."
+ mv /tmp/$title.gpg ~/.config/mutt/credentials/
+
+ # Creating the offlineimaprc if it doesn't exist already.
if [ ! -f ~/.offlineimaprc ]; then cp "$muttdir"autoconf/offlineimap_header ~/.offlineimaprc; fi
cat "$muttdir"autoconf/offlineimap_profile | sed -e "$replacement" >> ~/.offlineimaprc
+
# Add the mutt profile.
cat "$muttdir"autoconf/mutt_profile | sed -e "$replacement" > "$muttdir"accounts/$title.muttrc
+
# Add on offlineimaprc sync list.
sed -i "s/^accounts =.*[a-zA-Z]$/&, $title/g;s/^accounts =$/accounts = $title/g" ~/.offlineimaprc ;}
addAccount
-
-dialog --title "Luke's mutt/offlineIMAP password wizard" --passwordbox "Enter the password for the \"$title\" account." 10 60 2> /tmp/$title
-gpg -r $youremail --encrypt /tmp/$title
-shred -u /tmp/$title && echo "Password encrypted and memory shredded."
-mv /tmp/$title.gpg ~/.config/mutt/credentials/
-
-echo Done lmao.
-exit
+clear