1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
#
# Copyright 2007-2009 Anibal Monsalve Salazar <anibal@debian.org>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program 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. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
ELIDAVERSION=0.3
BASENAME=${0##*/}
TMP=/tmp/$BASENAME-$$
LOGGER=/usr/bin/logger
_trapexit()
{
local rc=${1:-$?}
rm -f -- $TMP-*
$LOGGER -p syslog.info $BASENAME: exit rc=$rc
exit $rc
}
trap _trapexit 0 1 2 3 10 12 13 14 15
if [ -z "$ELIDAHOME" ]
then
$LOGGER -p syslog.crit $BASENAME: variable ELIDAHOME is empty
exit 1
fi
if [ -z "$USERNAME" ]
then
$LOGGER -p syslog.crit $BASENAME: variable USERNAME is empty
exit 1
fi
if [ -z "$FROM" ]
then
$LOGGER -p syslog.crit $BASENAME: variable FROM is empty
exit 1
fi
umask=002
ARCH=$(dpkg --print-architecture)
makedir()
{
if [ ! -d $1 ]
then
local perm=${2:-2775}
mkdir -m $perm $1
chown $USERNAME:$GROUPNAME $1
local rc=$?
if [ ! $rc ]
then
$LOGGER -p syslog.crit $BASENAME: error creating $1 rc=$rc
exit $rc
fi
fi
return 0
}
makedirs()
{
if [ "${ELIDAHOME:0:1}" != '/' ]
then
$LOGGER -p syslog.crit $BASENAME: ELIDAHOME=$ELIDAHOME does not start with /
exit 11
fi
makedir $ELIDAHOME
makedir $GPGHOMEDIR 2770
if [ ! -e $GPGHOMEDIR/pubring.gpg ]
then
touch $GPGHOMEDIR/pubring.gpg $GPGHOMEDIR/secring.gpg
chmod 660 $GPGHOMEDIR/pubring.gpg $GPGHOMEDIR/secring.gpg
chown $USERNAME:$GROUPNAME $GPGHOMEDIR/pubring.gpg $GPGHOMEDIR/secring.gpg
fi
for d in done inprogress ready result source pending
do
makedir $ELIDAHOME/$d
done
}
#run()
#{
# local tmp_in=$(mktemp $TMP-XXXXXX)
# local tmp_out=$(mktemp $TMP-XXXXXX)
# local tmp_err=$(mktemp $TMP-XXXXXX)
#
# cat > $tmp_in
#
# $@ < $tmp_in > $tmp_out 2> $tmp_err
# local rc=$?
#}
|