freebsd-ports/www/havp/files/pkg-install.in
Roman Bogorodskiy 60f68136a3 Update to 0.85.
PR:		110117
Submitted by:	Elisey Savateev (maintainer)
2007-03-15 07:01:04 +00:00

51 lines
1.1 KiB
Bash

#!/bin/sh
# $FreeBSD$
PREFIX=${PKG_PREFIX:-%%PREFIX%%}
HAVP_USER=havp
HAVP_GROUP=havp
LOG_DIR=%%LOG_DIR%%
TMP_DIR=%%TMP_DIR%%
RUN_DIR=%%RUN_DIR%%
if [ "$2" = "PRE-INSTALL" ]; then
if ! pw groupshow "$HAVP_GROUP" 2>/dev/null 1>&2; then
if pw groupadd $HAVP_GROUP; then
echo "=> Added group \"$HAVP_GROUP\"."
else
echo "=> Adding group \"$HAVP_GROUP\" failed..."
exit 1
fi
fi
if ! pw usershow "$HAVP_USER" 2>/dev/null 1>&2; then
if pw useradd $HAVP_USER -g $HAVP_GROUP -h - \
-s "/sbin/nologin" -d "/nonexistent" \
-c "havp daemon"; \
then
echo "=> Added user \"$HAVP_USER\"."
else
echo "=> Adding user \"$HAVP_USER\" failed..."
exit 1
fi
fi
elif [ "$2" = "POST-INSTALL" ]; then
if [ ! -d "$LOG_DIR" ]; then
mkdir -p "$LOG_DIR" || exit 1
chown "$HAVP_USER:$HAVP_GROUP" "$LOG_DIR" || exit 1
fi
if [ ! -d "$TMP_DIR" ]; then
mkdir -p "$TMP_DIR" || exit 1
chown "$HAVP_USER:$HAVP_GROUP" "$TMP_DIR" || exit 1
fi
if [ ! -d "$RUN_DIR" ]; then
mkdir -p "$RUN_DIR" || exit 1
chown "$HAVP_USER:$HAVP_GROUP" "$RUN_DIR" || exit 1
fi
fi
exit 0