#!/bin/sh # $OpenBSD: INSTALL,v 1.2 2002/09/14 15:21:14 naddy Exp $ # # Mixmaster installation script, using many ideas from # Adam Shostack's Install-Mix. # use a sane path and install prefix PATH=/bin:/usr/bin:/sbin:/usr/sbin PREFIX=${PKG_PREFIX:-/usr/local} MIXMASTER_BIN=${PREFIX}/sbin/mixmaster MIXDIR=${PREFIX}/share/examples/mixmaster MIXDEST=${SYSCONFDIR}/mixmaster MIXSPOOL=/var/spool/mixmaster # verify proper execution # if [ $# -ne 2 ]; then echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2 exit 1 fi # Function: set up mixmaster user account. # do_accts() { groupinfo -e mixmaster if [ $? -eq 0 ]; then echo "===> Using existing group 'mixmaster'" else echo "===> Creating group 'mixmaster'" groupadd mixmaster fi userinfo -e mixmaster if [ $? -eq 0 ]; then echo "===> Using existing account 'mixmaster'" else echo "===> Creating user 'mixmaster'" useradd \ -g mixmaster \ -c "Anonymous Remailer" \ -m -d $MIXDEST \ -s /sbin/nologin \ -p \* \ mixmaster fi } last_message() { echo "| Installation of mixmaster client complete." echo "|" echo "| The binary is suid 'mixmaster' and can only be executed by members of" echo "| the group 'mixmaster'. Add all users to that group, that are allowed" echo "| sending anonymous mail via the mixmaster network." echo "+---------------" echo "" exit 0 } # install client config files do_install() { echo "" echo "+---------------" if [ ! -d $MIXDEST ] then install -d -o mixmaster -g mixmaster -m 0710 $MIXDEST elif [ -f $MIXDEST/mix.cfg ] then echo "| $MIXDEST/mix.cfg does already exist. It will not be updated by this" echo "| script. If this is not your intention, please deinstall mixmaster," echo "| delete $MIXDEST and reinstall." echo "|" last_message fi if [ ! -d $MIXDEST ] then echo "Cannot create $MIXDEST" exit 1 fi cd $MIXDIR for i in "mix.cfg mlist.txt pubring.mix type2.list *.blk" do install -o mixmaster -g mixmaster -m 0640 $i $MIXDEST done if [ ! -d $MIXSPOOL ] then install -d -o mixmaster -g mixmaster -m 0770 $MIXSPOOL fi ln -s $MIXSPOOL $MIXDEST/pool chmod 0770 $MIXDEST/pool last_message } # Verify/process the command # case $2 in PRE-INSTALL) do_accts exit 0 ;; POST-INSTALL) : install config files, see below chown mixmaster.mixmaster $MIXMASTER_BIN chmod 4550 $MIXMASTER_BIN do_install exit 0 ;; *) echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2 exit 1 ;; esac