#!/bin/sh # $FreeBSD: head/www/havp/files/pkg-install.in 340719 2014-01-22 15:52:06Z mat $ 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