#!/bin/sh PATH=/bin:/usr/sbin SANDBOX_DIR="${PKG_PREFIX}" if [ -z "${BS_USER}" ]; then BS_USER=bs fi if [ -z "${BS_GROUP}" ]; then BS_GROUP=bs fi case $2 in PRE-INSTALL) UID=220 GID=${UID} if pw group show "${BS_GROUP}" 2>/dev/null; then echo "You already have a group \"${BS_GROUP}\", so I will use it." else if pw groupadd ${BS_GROUP} -g ${GID}; then echo "Added group \"${BS_GROUP}\." else echo "Adding group \"${BS_GROUP}\" failed." exit 1 fi fi if pw user show "${BS_USER}" 2>/dev/null; then echo "You already have a user \"${BS_USER}\", so I will use it." if pw usermod ${BS_USER} -d ${SANDBOX_DIR} then echo "Changed home directory of \"${BS_USER}\" to \"${SANDBOX_DIR}\"" else echo "Changing home directory of \"${BS_USER}\" to \"${SANDBOX_DIR}\" failed..." exit 1 fi else if pw useradd ${BS_USER} -u ${UID} -g ${BS_GROUP} -h - \ -d ${SANDBOX_DIR} -s /bin/sh -c "Big Sister" then echo "Added user \"${BS_USER}\"." else echo "Adding user \"${BS_USER}\" failed..." exit 1 fi fi ;; esac