ports/69335: Fix ports/irc/hybserv
Andrej Zverev
az at inec.ru
Tue Jul 20 09:10:28 UTC 2004
>Number: 69335
>Category: ports
>Synopsis: Fix ports/irc/hybserv
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Jul 20 09:10:27 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Andrej Zverev
>Release: FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD az.inec.ru 5.2-CURRENT FreeBSD 5.2-CURRENT #1: Wed Jul 14 14:46:11 MSD 2004 root at az.inec.ru:/usr/obj/usr/src/sys/az i386
>Description:
Fix HybServ. change pkg-install script, and add startup script to pkg-plist.
HybServ use interactive script to add user/group, but in batch mode script don't add
user/group and install fail
>How-To-Repeat:
>Fix:
If we need this user/group, why ask user add them or not ?! So remove checking and make
pkg-install script more silent.
--- hybserv-pkg-install.diff begins here ---
--- /usr/ports/irc/hybserv/pkg-install Wed Nov 12 05:31:18 2003
+++ pkg-install Tue Jul 20 12:08:47 2004
@@ -1,91 +1,42 @@
#!/bin/sh
-# This script is a slightly modified copy of the pkg-install script from the
-# original ircd-hybrid port, by desmo at bandwidth.org.
-
if [ "x$2" != "xPRE-INSTALL" ]; then
- exit 0;
+ exit 0;
fi
-ask() {
- local question default answer
-
- question=$1
- default=$2
- if [ -z "${PACKAGE_BUILDING}" ]; then
- read -p "${question} [${default}]? " answer
- fi
- if [ x${answer} = x ]; then
- answer=${default}
- fi
- echo ${answer}
-}
-
-yesno() {
- local dflt question answer
-
- question=$1
- dflt=$2
- while :; do
- answer=$(ask "${question}" "${dflt}")
- case "${answer}" in
- [Yy]*) return 0;;
- [Nn]*) return 1;;
- esac
- echo "Please answer yes or no."
- done
-}
-
-if which -s pw ; then
- :
-else
- cat <<EOF
-Your system does not include the "pw" utility. You should upgrade
-to a newer version of FreeBSD. Without "pw" this script will not
-run.
-EOF
- exit 1
-fi
-
-echo ""
-if pw groupshow hybserv 2> /dev/null ; then
- echo "You already have a group \"hybserv\", so I will use it."
-else
- if pw groupshow 73 2> /dev/null ; then
- echo "You already have a gid \"73\". Please create a user \"hybserv\""
- echo "with a default group of \"hybserv\"."
- exit 1
- fi
- echo "You need a group \"hybserv\"."
- if which -s pw && yesno "Would you like me to create it" y; then
- pw groupadd hybserv -g 73 || exit
- echo "Done."
+ USER=hybserv
+ GROUP=${USER}
+ UID=73
+ GID=${UID}
+ HOME_DIR="/nonexist"
+ if pw group show "${GROUP}" 2>/dev/null; then
+ echo "You already have a group \"${GROUP}\", so I will use it."
else
- echo "Please create it, and try again."
- if ! pw usershow hybserv 2> /dev/null ; then
- echo "While you're at it, please create a user \"hybserv\""
- echo 'too, with a default group of "hybserv".'
+ if pw groupadd ${GROUP} -g ${GID}; then
+ echo "Added group \"${GROUP}\"."
+ else
+ echo "Adding group \"${GROUP}\" failed..."
+ exit 1
fi
- exit 1
fi
-fi
-if pw usershow hybserv 2> /dev/null ; then
- echo "You already have a user \"hybserv\", so I will use it."
-else
- if pw usershow 73 2> /dev/null ; then
- echo "You already have a uid \"73\". Please create a user \"irc
-d\""
- echo "with a default group of \"hybserv\"."
- exit 1
- fi
- echo "You need a user \"hybserv\"."
- if which -s pw && yesno "Would you like me to create it" y; then
- pw useradd hybserv -g hybserv -u 73 -h - -d /nonexistent \
- -s /nonexistent -c "IRC Daemon" || exit
- echo "Done."
+ if pw user show "${USER}" 2>/dev/null; then
+ echo "You already have a user \"${USER}\", so I will use it."
+ if pw usermod ${USER} -d ${HOME_DIR}
+ then
+ echo "Changed home directory of \"${USER}\" to \"${HOME_DIR}\""
+ else
+ echo "Changing home directory of \"${USER}\" to \"${HOME_DIR}\" failed..."
+ exit 1
+ fi
else
- echo "Please create it, and try again."
- exit 1
+ if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
+ -d ${HOME_DIR} -s /sbin/nologin -c "HybServ Daemon"
+ then
+ echo "Added user \"${USER}\"."
+ else
+ echo "Adding user \"${USER}\" failed..."
+ exit 1
+ fi
fi
-fi
+
--- hybserv-pkg-install.diff ends here ---
--- hybserv-pkg-plist.diff begins here ---
--- /usr/ports/irc/hybserv/pkg-plist Tue Jul 20 12:28:58 2004
+++ pkg-plist Tue Jul 20 12:26:13 2004
@@ -1,3 +1,4 @@
+etc/rc.d/hybserv.sh
hybserv/hybserv
hybserv/cleandb
hybserv/encryptconf
--- hybserv-pkg-plist.diff ends here ---
--- hybserv-Makefile.diff begins here ---
--- /usr/ports/irc/hybserv/Makefile Tue Jun 22 01:27:27 2004
+++ Makefile Tue Jul 20 12:12:02 2004
@@ -19,18 +19,8 @@
WRKSRC= ${WRKDIR}/hybserv
-.if !defined(PACKAGE_BUILDING) && !defined(BATCH)
-IS_INTERACTIVE= yes
-.endif
-
-BROKEN= "Does not install"
-EXPIRATION_DATE=2004-08-20
-DEPRECATED= ${BROKEN}
-
pre-install:
-.if !defined(PACKAGE_BUILDING) && !defined(BATCH)
@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
-.endif
post-install:
@${SED} -e "s#%PREFIX%#${PREFIX}#" ${FILESDIR}/hybserv.sh \
--- hybserv-Makefile.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list