@@ -2,9 +2,9 @@ | |||||
OS = $(shell uname -s) | OS = $(shell uname -s) | ||||
ifeq ($(OS), Darwin) | ifeq ($(OS), Darwin) | ||||
PREFIX = /usr/local | |||||
PREFIX ?= /usr/local | |||||
else | else | ||||
PREFIX = /usr | |||||
PREFIX ?= /usr | |||||
endif | endif | ||||
MANPREFIX = $(PREFIX)/share/man | MANPREFIX = $(PREFIX)/share/man | ||||
@@ -18,10 +18,7 @@ install: | |||||
for shared in share/*; do \ | for shared in share/*; do \ | ||||
cp -f $$shared $(DESTDIR)$(PREFIX)/share/mutt-wizard; \ | cp -f $$shared $(DESTDIR)$(PREFIX)/share/mutt-wizard; \ | ||||
done | 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 | |||||
sed -i 's,/usr,$(PREFIX),' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; | |||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1 | mkdir -p $(DESTDIR)$(MANPREFIX)/man1 | ||||
cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 | cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 | ||||
@@ -30,5 +27,6 @@ uninstall: | |||||
rm -f $(DESTDIR)$(PREFIX)/$$script; \ | rm -f $(DESTDIR)$(PREFIX)/$$script; \ | ||||
done | done | ||||
rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard | rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard | ||||
rm -rf $(DESTDIR)$(MANPREFIX)/man1/mw.1 | |||||
.PHONY: install uninstall | .PHONY: install uninstall |
@@ -1,14 +1,16 @@ | |||||
#!/bin/sh | #!/bin/sh | ||||
if [ -z "$prefix" ]; then | |||||
case "$(uname)" in | |||||
Linux) prefix="/usr" ;; | |||||
*) prefix="/usr/local" ;; | |||||
esac | |||||
fi | |||||
VERSION="2.0" | VERSION="2.0" | ||||
if [ "${BASH_SOURCE[0]}" = "${0}" ]; then | |||||
prefix=${0} | |||||
else | |||||
prefix="$BASH_SOURCE" | |||||
fi | |||||
[ ! ${prefix::1} = "/" ] && prefix="$PWD/$prefix" | |||||
prefix="${prefix%/bin/*}" | |||||
mwbin="$prefix/bin/mw" | |||||
_MW_="mutt-wizard" | _MW_="mutt-wizard" | ||||
_MW_generated="mutt-wizard-generated" | _MW_generated="mutt-wizard-generated" | ||||
@@ -428,7 +430,7 @@ _mwcron() { | |||||
read -r mwcronminutes | read -r mwcronminutes | ||||
printf "\033[0m" | printf "\033[0m" | ||||
done | done | ||||
(crontab -l; echo "*/$mwcronminutes * * * * export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus; export DISPLAY=:0; $(type mw | cut -d' ' -f3) sync") \ | |||||
(crontab -l; echo "*/$mwcronminutes * * * * export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus; export DISPLAY=:0; $mwbin sync") \ | |||||
| crontab - && echo "mw cronjob added. Mail will sync every $mwcronminutes minutes. Be sure you have your cron manager running." | | crontab - && echo "mw cronjob added. Mail will sync every $mwcronminutes minutes. Be sure you have your cron manager running." | ||||
} | } | ||||
@@ -645,7 +647,7 @@ _mwsyncandnotify() { | |||||
else | else | ||||
$mwmbsyncbin $mwaddr | $mwmbsyncbin $mwaddr | ||||
fi | fi | ||||
[ -z "$mwnono" ] && return | |||||
[ -n "$mwnono" ] && return | |||||
mwlastrun="$mwaccmaildir/.mw.lastrun" | mwlastrun="$mwaccmaildir/.mw.lastrun" | ||||
mwnew=$(find "$mwaccmaildir/INBOX/new/" "$mwaccmaildir/Inbox/new/" "$mwaccmaildir/inbox/new/" -type f -newer "$mwlastrun" 2> /dev/null) | mwnew=$(find "$mwaccmaildir/INBOX/new/" "$mwaccmaildir/Inbox/new/" "$mwaccmaildir/inbox/new/" -type f -newer "$mwlastrun" 2> /dev/null) | ||||
newcount=$(echo "$mwnew" | sed '/^\s*$/d' | wc -l) | newcount=$(echo "$mwnew" | sed '/^\s*$/d' | wc -l) | ||||
@@ -7,9 +7,7 @@ bats --tap test_mw.bats | |||||
echo | echo | ||||
echo "Integration tests need working email $mwaddr" | echo "Integration tests need working email $mwaddr" | ||||
echo "CTRL-C to skip" | |||||
#modify | |||||
if [ -z "$MAILDIR" ] || [ -z "$mwaddr" ]; then | if [ -z "$MAILDIR" ] || [ -z "$mwaddr" ]; then | ||||
echo "First do:" | echo "First do:" | ||||
[ -z "$MAILDIR" ] && echo "export MAILDIR=..." | [ -z "$MAILDIR" ] && echo "export MAILDIR=..." | ||||
@@ -17,11 +15,15 @@ if [ -z "$MAILDIR" ] || [ -z "$mwaddr" ]; then | |||||
exit | exit | ||||
fi | fi | ||||
cd .. && sudo make install && OK="OK" | |||||
export PREFIX=$PWD/mwtesttmp | |||||
export PATH=$PATH:$PREFIX/bin | |||||
cd .. && make install && OK="OK" | |||||
if [ "$OK" = "OK" ]; then | if [ "$OK" = "OK" ]; then | ||||
echo "Warning: Out with CTRL-C if your mail (config) files are important here." | echo "Warning: Out with CTRL-C if your mail (config) files are important here." | ||||
read | |||||
export mwmaildir=$MAILDIR | export mwmaildir=$MAILDIR | ||||
export mwname='r n' | export mwname='r n' | ||||
@@ -34,6 +36,7 @@ if [ "$OK" = "OK" ]; then | |||||
[ -f "${PASSWORD_STORE_DIR:-~/.password-store}/$mwpass.gpg" ] || pass insert $mwpass | [ -f "${PASSWORD_STORE_DIR:-~/.password-store}/$mwpass.gpg" ] || pass insert $mwpass | ||||
echo "= Test 1 =" | echo "= Test 1 =" | ||||
echo $PATH | |||||
mwtype=online mw add | mwtype=online mw add | ||||
echo "=> In another prompt, start mutt and verify that mails are shown" | echo "=> In another prompt, start mutt and verify that mails are shown" | ||||
echo "=> Then answer with N" | echo "=> Then answer with N" | ||||
@@ -53,3 +56,6 @@ if [ "$OK" = "OK" ]; then | |||||
fi | fi | ||||
cd $CD | cd $CD | ||||
rm -rf $PREFIX | |||||
@@ -20,7 +20,6 @@ setup() | |||||
XDG_CONFIG_HOME=mwtesttmp/config \ | XDG_CONFIG_HOME=mwtesttmp/config \ | ||||
MAILDIR=mwtesttmp/share/mail \ | MAILDIR=mwtesttmp/share/mail \ | ||||
XDG_CACHE_HOME=mwtesttmp/cache \ | XDG_CACHE_HOME=mwtesttmp/cache \ | ||||
prefix="$PWD" \ | |||||
source ../bin/mw | source ../bin/mw | ||||
export NOTMUCH_CONFIG=mwtesttmp/config/notmuch-config | export NOTMUCH_CONFIG=mwtesttmp/config/notmuch-config | ||||
export mwname="real name" | export mwname="real name" | ||||