freebsd-ports/security/sfs/pkg-install
Matthew N. Dodd 02f34c6f5f A secure global network file system. SFS names FSs by public keys
PR:		ports/40455
Submitted by:	Michael Handler <handler@grendel.net>
2002-07-12 02:52:31 +00:00

59 lines
1.2 KiB
Bash

#!/bin/sh
if [ "$2" != "POST-INSTALL" ]; then
exit 0
fi
KEYFILE="$PKG_PREFIX/etc/sfs/sfs_host_key"
USER=sfs
GROUP=sfs
SFSDIR=/var/spool/sfs
echo -n "Checking for group '$GROUP'... "
if ! pw groupshow $GROUP >/dev/null 2>&1; then
echo "doesn't exist, adding."
pw groupadd $GROUP -g 71
else
echo "exists."
fi
echo -n "Checking for user '$USER'... "
if ! pw usershow $USER >/dev/null 2>&1; then
echo "doesn't exist, adding."
pw useradd $USER -u 71 -c 'Self-Certifying File System' -d /nonexistent -g $GROUP -s /sbin/nologin -h -
else
echo "exists."
fi
echo -n "Checking for SFS directory ($SFSDIR)... "
if [ -d "$SFSDIR" ]; then
echo "already exists."
else
echo "creating."
mkdir $SFSDIR
fi
chmod 750 $SFSDIR
chown $USER:$GROUP $SFSDIR
echo -n "Checking for SFS host key ($KEYFILE)... "
if [ -f "$KEYFILE" ]; then
echo "already exists, not generating."
else
echo "doesn't exist, generating."
echo "Starting sfscd for entropy services."
$PKG_PREFIX/sbin/sfscd
echo -n "Sleeping ten seconds to give sfscd time to start up... "
sleep 10
echo "done."
$PKG_PREFIX/bin/sfskey gen -KP -n `uname -n` $KEYFILE
echo -n "Key generation done, killing sfscd... "
kill -TERM `cat /var/run/sfscd.pid`
echo "done."
fi