commit 41fc9d9b7f1daa257981a1e83889bafdab2a8a9a
parent c4c9689412bd998698783a3cdb2444c9da16f24b
Author: Jaromil <jaromil@dyne.org>
Date: Tue, 4 Mar 2014 23:27:07 +0100
new install and init system for gnu usage
Diffstat:
5 files changed, 130 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,3 +1,6 @@
all:
@cd build && ./build-gnu.sh && cd -
+install:
+ @build/install-gnu.sh
+
diff --git a/build/build-gnu.sh b/build/build-gnu.sh
@@ -198,10 +198,10 @@ mkdir -p build/gnu
}
-
-print "Done compiling."
-print "Now run ./install.sh and Jaro Mail will be ready in ~/Mail"
-print "or \"./install.sh path\" to install it somewhere else."
-
+print
+print "Done building JaroMail!"
+print "Now run 'make install' as root to install jaromail in /usr/local"
+print "use PREFIX=/home/private/jaromail to avoid system-wide installation."
+print
popd
diff --git a/build/install-gnu.sh b/build/install-gnu.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env zsh
+
+{ test "$PREFIX" = "" } && { PREFIX=/usr/local }
+
+# TODO: separate libexec from share
+JARO_LIBEXEC=$PREFIX/share/jaromail
+JARO_SHARE=$PREFIX/share/jaromail
+
+mkdir -p $JARO_SHARE
+{ test $? = 0 } || {
+ print "No permissions to install system-wide."; return 1 }
+
+mkdir -p $JARO_LIBEXEC
+
+{ test -r doc } && { srcdir=. }
+{ test -r install-gnu.sh } && { srcdir=.. }
+
+cp -ra $srcdir/doc/* $JARO_SHARE/
+cp -ra $srcdir/src/procmail $JARO_SHARE/.procmail
+cp -ra $srcdir/src/mutt $JARO_SHARE/.mutt
+cp -ra $srcdir/src/stats $JARO_SHARE/.stats
+
+{ test -r $srcdir/build/gnu/fetchaddr } || {
+ print "Error: first build, then install."; return 1 }
+
+# copy the executables
+cp -ra $srcdir/build/gnu/* $JARO_LIBEXEC/
+cp -ra $srcdir/src/zlibs $JARO_LIBEXEC/
+cp $srcdir/src/jaro $JARO_LIBEXEC/
+
+cat <<EOF > $PREFIX/bin/jaro
+#!/usr/bin/env zsh
+export JAROWORKDIR=${JARO_SHARE}
+${JARO_SHARE}/jaro \${=@}
+EOF
+chmod +x $PREFIX/bin/jaro+
\ No newline at end of file
diff --git a/src/jaro b/src/jaro
@@ -359,7 +359,8 @@ check_bin() {
exit 1
fi
func "Mutt binary: $mutt"
-
+ # make sure there is always a muttpass file even if empty
+ touch $TMPDIR/muttpass
return 0
}
@@ -476,7 +477,6 @@ Website on <http://jaromail.dyne.org> Report bugs to <https://bugs.dyne.org>
EOF
}
-# TODO: For more information on Jaro Mail read the manual: man jaro
typeset -A subcommands_opts
main()
@@ -536,6 +536,8 @@ main()
subcommands_opts[isonline]=""
+ subcommands_opts[init]=""
+
### Detect subcommand
local -aU every_opts #every_opts behave like a set; that is, an array with unique elements
for optspec in $subcommands_opts$main_opts; do
@@ -667,6 +669,8 @@ main()
isonline) is_online ${=PARAM}; exitcode=$? ;;
+ 'init') CLEANEXIT=0; maildir_init "`pwd`" ;;
+
'source') CLEANEXIT=0; return 0 ;;
__default) func "no command provided"
autostart ${PARAM}
diff --git a/src/zlibs/init b/src/zlibs/init
@@ -0,0 +1,78 @@
+#!/usr/bin/env zsh
+#
+# Jaro Mail, your humble and faithful electronic postman
+#
+# a tool to easily and privately handle your e-mail communication
+#
+# Copyleft (C) 2010-2014 Denis Roio <jaromil@dyne.org>
+#
+# This source code is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This source code is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# Please refer to the GNU Public License for more details.
+#
+# You should have received a copy of the GNU Public License along with
+# this source code; if not, write to:
+# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+maildir_init() {
+
+ # source functions
+ source $WORKDIR/jaro source
+
+ notice "Initializing current directory for Jaro Mail"
+ MAILDIRS=${1}
+ ${=mkdir} $MAILDIRS/tmp $MAILDIRS/cache
+
+
+ # copy defaults if missing
+ if ! [ -r $MAILDIRS/Filters.txt ]; then
+ cp -v $WORKDIR/Filters.txt $MAILDIRS/Filters.txt
+ act "Default filters created"
+ else
+ error "Existing configuration $MAILDIRS/Filters.txt skipped"
+ fi
+
+
+ if ! [ -r $MAILDIRS/Applications.txt ]; then
+ cp -v $WORKDIR/Applications.txt $MAILDIRS/Applications.txt
+ act "Default helper applications settings created"
+ else
+ error "Existing configuration $MAILDIRS/Applications.txt skipped"
+ fi
+
+ if ! [ -r $MAILDIRS/Mutt.txt ]; then
+ cp -v $WORKDIR/Mutt.txt $MAILDIRS/Mutt.txt
+ act "Default Mutt configuration template created"
+ else
+ error "Existing configuration $MAILDIRS/Mutt.txt skipped"
+ fi
+
+ if ! [ -r $MAILDIRS/Accounts ]; then
+ cp -v -r $WORKDIR/Accounts $MAILDIRS/Accounts
+ act "Default accounts directory created"
+ else
+ error "Existing configuration $MAILDIRS/Accounts skipped"
+ fi
+
+ { test -r $MAILDIRS/Manual.pdf } || {
+ cp -f $WORKDIR/jaromail-manual.pdf $MAILDIRS/Manual.pdf }
+
+ # update the settings
+ JAROMAILDIR=$MAILDIRS JAROWORKDIR=$WORKDIR $WORKDIR/jaro update -q
+
+ # create a startup wrapper
+ cat <<EOF > $MAILDIRS/jaro
+#!/usr/bin/env zsh
+export JAROWORKDIR=${WORKDIR}
+export JAROMAILDIR=${MAILDIRS}
+${WORKDIR}/jaro \${=@}
+EOF
+ chmod +x $MAILDIRS/jaro
+
+}+
\ No newline at end of file