mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-29 01:13:08 +00:00
9f7c6a243d
- Take maintainership PR: ports/93293 Submitted by: Anders Troback <freebsd@troback.com>
52 lines
1.1 KiB
Bash
52 lines
1.1 KiB
Bash
#!/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
|