2 # 2011 markus schnalke <meillo@marmaro.de>
4 # replacement for install-mh(1)
5 # set up mmh for the user
9 # Todo: use chmod or set umask for created files?
10 # Todo: install signal handlers and tell how to abort
13 # the following constants must match the values in config/config.c
22 while [ $# -ge 1 ] ; do
25 # check if mmh is set up
26 # Note: The mail storage dir gets silently created if
27 # everything else is properly set up.
28 # (folder will always create the folder if input is no tty!)
29 echo | folder >/dev/null 2>&1
33 echo "mmh has no own version number, thus this instead:"
38 echo "Usage: $0 -- set up mmh for you" >&2
39 echo " $0 -c -- check if mmh is set up for you" >&2
47 Welcome to mmh, meillo's MH version
48 ===================================
49 This program does only one small, but important task: it sets up mmh for your
50 user account. Afterwards you can access the functions of mmh by using any of
51 the specialized tools from the mmh toolchest. The man page mmh(1) lists them.
52 Consult the man pages of the individual programs for further documentation.
54 But now, let's set up mmh for you ...
65 echo "Path: $mailstore" >"$profile"
77 mmhdir="${MMH:=$mmhdir}"
80 if [ -d "$mmhdir" ] ; then
81 echo "--> Using existing mmh directory $mmhdir"
83 mkdir "$mmhdir" && echo "--> Created mmh directory $mmhdir"
92 profile="${MMHP:=$profile}" # relative to $mmhpath
93 if [ -f "$profile" ] ; then
95 echo "You already have an mmh profile."
96 printf "Do you want to edit the file now? [Y/n] "
101 ${VISUAL:-${EDITOR:-vi}} "$profile"
120 echo "Mmh needs a mail storage."
121 cd # relative to HOME
122 if [ -d "$mailstore" ] ; then
123 echo "The suggested directory `pwd`/$mailstore already exists."
124 printf "Do you want to use it for mmh? [Y/n] "
129 echo "--> Using existing directory $mailstore"
135 printf "Where do you want it to be located? [`pwd`/Mail] "
137 if [ -z "$answ" ] ; then
140 mkdir "$answ" && echo "--> Created $answ"