Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make user able to change USER & GROUP, and change default USER. (Bump PORTREVISION) * Cleanup do-install code. PR: 73713 Submitted by: Gea-Suan Lin <gslin@netnews.NCTU.edu.tw>
- Loading branch information
ijliao
authored and
ijliao
committed
Nov 9, 2004
1 parent
6a559a9
commit 37e8112
Showing
2 changed files
with
43 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,36 @@ | ||
#!/bin/sh | ||
# $FreeBSD$ | ||
# $FreeBSD: ports/net-mgmt/cricket/pkg-install,v 1.1 2002/06/08 22:25:17 petef Exp $ | ||
# | ||
|
||
if [ "$2" != "PRE-INSTALL" ]; then | ||
exit 0 | ||
fi | ||
|
||
USER=cricket | ||
#group selected to be www since the webserver has to be able to serve it | ||
GROUP=www | ||
if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then | ||
echo "You already have a group \"${GROUP}\", so I will use it." | ||
else | ||
if /usr/sbin/pw groupadd ${GROUP} -g ${GID} | ||
then | ||
echo "Added group \"${GROUP}\"." | ||
else | ||
echo "Adding group \"${GROUP}\" failed..." | ||
echo "Please create it, and try again." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
if ! pw usershow "${USER}" 2>/dev/null 1>&2; then | ||
if pw useradd ${USER} -g ${GROUP} -h - \ | ||
-s "/sbin/nologin" -d "${PREFIX}/cricket" \ | ||
-c "Cricket Monitoring Owner"; \ | ||
then | ||
echo "Added user \"${USER}\"." | ||
else | ||
echo "Adding user \"${USER}\" failed..." | ||
exit 1 | ||
fi | ||
if /usr/sbin/pw user show "${USER}" 2>/dev/null; then | ||
echo "You already have a user \"${USER}\", so I will use it." | ||
else | ||
if /usr/sbin/pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ | ||
-d /usr/local/www -s /bin/sh -c "WWW Administrator" | ||
then | ||
echo "Added user \"${USER}\"." | ||
else | ||
echo "Adding user \"${USER}\" failed..." | ||
echo "Please create it, and try again." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
exit 0 |