From cd5fd9bde283454bb64549bb064ecd3d50500d23 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 1 Jul 2019 18:14:16 -0400 Subject: [PATCH 1/2] Make use of PREFIX environment variable This patch puts the environment variable PREFIX in more use. If specified, mull-wizard Makefile substitute all instances of prefix with the provided environment variable. Signed-off-by: Ayman Bagabas --- Makefile | 16 +++++++++------- bin/mw | 6 +----- mw.1 | 6 +++--- share/mutt-wizard.muttrc | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 68db4ff..c0a6a05 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,8 @@ .POSIX: OS = $(shell uname -s) -ifeq ($(OS), Darwin) +ifndef PREFIX PREFIX = /usr/local -else - PREFIX = /usr endif MANPREFIX = $(PREFIX)/share/man @@ -18,12 +16,16 @@ install: for shared in share/*; do \ cp -f $$shared $(DESTDIR)$(PREFIX)/share/mutt-wizard; \ done - if [ "$(OS)" = "Darwin" ]; then \ - sed -iba 's/\/usr\//\/usr\/local\//' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ - rm $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \ - fi mkdir -p $(DESTDIR)$(MANPREFIX)/man1 cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 + if [ "$(PREFIX)" ]; then \ + sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ + sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/bin/mw; \ + sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(MANPREFIX)/man1/mw.1; \ + fi + if [ "$(OS)" = "Darwin" ]; then \ + rm $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \ + fi uninstall: for script in bin/*; do \ diff --git a/bin/mw b/bin/mw index 651dd90..3268fa5 100755 --- a/bin/mw +++ b/bin/mw @@ -8,11 +8,7 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" } ! command -v mbsync >/dev/null && printf "\`mbsync\` must be installed to run mutt-wizard.\\n" && exit -case "$(uname)" in - Linux) prefix="/usr" ;; - *) prefix="/usr/local" ;; -esac - +prefix="/usr/local" muttdir="$HOME/.config/mutt" # Main mutt config location accdir="$muttdir/accounts" # Directory for account settings maildir="$HOME/.local/share/mail" # Location of mail storage diff --git a/mw.1 b/mw.1 index b60cbf8..2f04a48 100644 --- a/mw.1 +++ b/mw.1 @@ -60,10 +60,10 @@ will delete downloaded mail for for safety (and time)'s sake. If you want to del .TP .B Default settings The mutt-wizard has many default settings that focus on making it aesthetically pleasing and supplying more vim-like bindings. These can be found in -.I /usr/share/mutt-wizard/mutt-wizard.muttrc +.I /usr/local/share/mutt-wizard/mutt-wizard.muttrc and the default mailcap file can be found in .I -/usr/share/mutt-wizard/mailcap. +/usr/local/share/mutt-wizard/mailcap. Any of these settings can be overwritten in .I ~/.config/mutt/muttrc, but be mindful that your overriding binds should appear after the @@ -73,7 +73,7 @@ file is sourced. .TP .B Detecting server settings mutt-wizard has a repository of email services and their server information kept in -.I /usr/share/mutt-wizard/domains.csv +.I /usr/local/share/mutt-wizard/domains.csv which is used to automatically configure email settings. If your email provider is not found there, it will prompt you to input your email service's IMAP and SMTP server information which can usually be found by searching online. diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 1ca0503..bd20d50 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -3,7 +3,7 @@ # mutt-wizard will have this file sourced from your muttrc. # In the interest of seamless updating, do not edit this file. # If you want to override any settings, set those in your muttrc. -set mailcap_path = /usr/share/mutt-wizard/mailcap +set mailcap_path = /usr/local/share/mutt-wizard/mailcap set certificate_file = ~/.cache/mutt-wizard/certificates set date_format="%y/%m/%d %I:%M%p" set index_format="%2C %zs %?X?A& ? %D %-15.15F %s (%-4.4c)" From 04528a0fb92ea57be040a7ed87901d8186c970ff Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 1 Jul 2019 19:18:36 -0400 Subject: [PATCH 2/2] Fix make uninstall for loop directory wildcard includes the directory name. No need to specify the dir name when removing file. Signed-off-by: Ayman Bagabas --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c0a6a05..7c95b7f 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ install: uninstall: for script in bin/*; do \ - rm -f $(DESTDIR)$(PREFIX)/bin/$$script; \ + rm -f $(DESTDIR)$(PREFIX)/$$script; \ done rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard