jaromail

a commandline tool to easily and privately handle your e-mail
git clone git://parazyd.org/jaromail.git
Log | Files | Refs | Submodules | README

commit 8268da1075fc85c5f793d7ce9a55aa3461aa7bce
parent 55a9ac66c0729f6a9f6649f9164edc823f17904a
Author: Jaromil <jaromil@dyne.org>
Date:   Fri, 11 May 2012 22:28:29 +0200

fixing for gnu/linux install

Diffstat:
Minstall.sh | 44++++++++++++++++++++++++++++++--------------
Msrc/postino | 29+++++++++++++++++++++++++----
2 files changed, 55 insertions(+), 18 deletions(-)

diff --git a/install.sh b/install.sh @@ -140,6 +140,7 @@ for sh in lbdb-fetchaddr.sh.in lbdb-munge.sh.in lbdb_lib.sh.in lbdbq.sh.in; do dst=`echo $sh | sed -e 's/.sh.in$//'` cat share/lbdb/$sh \ | sed -e "s&@SH@&/usr/bin/env zsh&g" \ + | sed -e "s&@DOTLOCK@&${WORKDIR}/tmp/.lbdb.lock&g" \ | sed -e "s&@LBDB_VERSION@&0.38-postino&g" \ | sed -e "s&@prefix@&${WORKDIR}/.lbdb&g" \ | sed -e "s&@exec_prefix@&${WORKDIR}/.lbdb&g" \ @@ -162,7 +163,16 @@ done chmod +x $WORKDIR/.lbdb/* ln -sf $WORKDIR/.lbdb/lbdb-fetchaddr $WORKDIR/bin/ ln -sf $WORKDIR/.lbdb/lbdbq $WORKDIR/bin/ -cp share/lbdb/lbdb.rc.in ${WORKDIR}/.lbdb/lbdb.rc + +case $OS in + GNU) + echo "METHODS=(m_inmail)" > ${WORKDIR}/.lbdb/lbdb.rc + ;; + MAC) + # use ABQuery on mac + echo "METHODS=(m_inmail m_osx_addressbook)" > ${WORKDIR}/.lbdb/lbdb.rc + ;; +esac ln -sf $WORKDIR/.lbdb $HOME/ #### @@ -171,28 +181,34 @@ ln -sf $WORKDIR/.lbdb $HOME/ src/postino update -case `uname -s` in - Darwin) - if [ -r build/osx ]; then - cp -a build/osx/* $WORKDIR/bin - fi - touch $HOME/.profile - cat $HOME/.profile | grep '^# Postino' > /dev/null - if [ $? != 0 ]; then - cat <<EOF >> $HOME/.profile +case $OS in + GNU) + if [ -r build/osx ]; then + cp -a build/osx/* $WORKDIR/bin + fi + touch $HOME/.profile + cat $HOME/.profile | grep '^# Postino' > /dev/null + if [ $? != 0 ]; then + cat <<EOF >> $HOME/.profile # Postino Installer addition on `date` export PATH=$WORKDIR/bin:\$PATH # Finished adapting your PATH EOF - fi + fi ;; - Linux) + MAC) # TODO ;; esac notice "Installation completed, now edit your personal settings:" act "$MAILDIRS/Configuration.txt" -if [ `uname -s` = Darwin ]; then +case $OS in + GNU) + ;; + MAC) open /Applications/TextEdit.app $MAILDIRS/Configuration.txt -fi + ;; + *) + ;; +esac diff --git a/src/postino b/src/postino @@ -32,8 +32,12 @@ for arg in ${argv}; do OLDARGS+=($arg); done QUIET=0 DEBUG=1 + + # which command to use when creating dirs -mkdir="mkdir -m 700 -p" +mkdir="`which mkdir` -m 700 -p" + + ########################## @@ -58,6 +62,20 @@ act() { fi } +# what operating system are we in? use os_detect() +# simplifying modes of operation: GNU or MAC +case $(uname) in + Linux) OS=GNU + act "Running on GNU/Linux" ;; + + Apple) OS=MAC + act "Running on Mac/OSX" ;; + + *) OS=GNU # default + error "Running on an unknown operating system, assuming GNU" ;; +esac + + if ! [ -r $HOME/Mail/Configuration.txt ]; then return; fi source $HOME/Mail/Configuration.txt @@ -106,6 +124,9 @@ GETPIN EOF } +# retrieve a password for user @ domain +# put it in variable password +# up to the caller to unset it after use ask_password() { func "Looking for password in keyring: $1 @ $2" security find-internet-password -a $1 -s $2 > /dev/null @@ -152,9 +173,9 @@ maildirmake() { return fi - $mkdir -p ${1}/cur - $mkdir -p ${1}/new - $mkdir -p ${1}/tmp + $mkdir ${1}/cur + $mkdir ${1}/new + $mkdir ${1}/tmp }