2003-04-16 14:51:08 -04:00
|
|
|
#!/bin/sh
|
2003-06-27 13:18:01 -04:00
|
|
|
# $OpenBSD: INSTALL,v 1.3 2003/06/27 17:18:01 sturm Exp $
|
2003-04-16 14:51:08 -04:00
|
|
|
#
|
|
|
|
# Pre/post-installation setup of Bitlbee
|
|
|
|
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
|
|
|
PREFIX=${PKG_PREFIX:-/usr/local}
|
|
|
|
DB_DIR=${DB_DIR}
|
2003-06-22 06:09:57 -04:00
|
|
|
BITLBEEUSER=_bitlbee
|
|
|
|
BITLBEEGROUP=_bitlbee
|
|
|
|
ID=509
|
2003-04-16 14:51:08 -04:00
|
|
|
|
|
|
|
do_notice_existingdir() {
|
2003-06-27 13:18:01 -04:00
|
|
|
echo << EOF
|
2003-04-16 14:51:08 -04:00
|
|
|
|
|
|
|
+---------------"
|
|
|
|
| You appear to already have a Bitlbee-settings dir in $DB_DIR
|
|
|
|
|
|
|
|
|
| This directory has been preserved. If you want to start from
|
2003-06-27 13:18:01 -04:00
|
|
|
| from the default, you have to perform this step as root:
|
2003-04-16 14:51:08 -04:00
|
|
|
|
|
|
|
|
| # rm -rf $DB_DIR/*
|
|
|
|
|
|
|
|
|
+---------------
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
do_usergroup_install() {
|
2003-06-27 13:18:01 -04:00
|
|
|
# Create bitlbee user and group
|
|
|
|
if groupinfo -e $BITLBEEGROUP; then
|
|
|
|
echo "===> Using $BITLBEEGROUP group for bitlbee"
|
|
|
|
else
|
|
|
|
echo "===> Creating $BITLBEEGROUP group for bitlbee"
|
|
|
|
groupadd -g $ID $BITLBEEGROUP
|
|
|
|
fi
|
|
|
|
|
|
|
|
if userinfo -e $BITLBEEUSER; then
|
|
|
|
echo "===> Using $BITLBEEUSER user for bitlbee"
|
|
|
|
else
|
|
|
|
echo "===> Creating $BITLBEEUSER user for bitlbee"
|
|
|
|
useradd -g $BITLBEEGROUP \
|
|
|
|
-d /nonexistent \
|
|
|
|
-L daemon \
|
|
|
|
-c 'Bitlbee Account' \
|
|
|
|
-s /sbin/nologin \
|
|
|
|
-u $ID \
|
|
|
|
$BITLBEEUSER \
|
|
|
|
2>&1| grep nonexistant >&2
|
|
|
|
fi
|
2003-04-16 14:51:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
do_database_install() {
|
2003-06-27 13:18:01 -04:00
|
|
|
install -m 0770 -d -o ${BITLBEEUSER} -g ${BITLBEEGROUP} ${DB_DIR}
|
2003-04-16 14:51:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
do_manual_notice() {
|
2003-06-27 13:18:01 -04:00
|
|
|
cat << EOF
|
2003-04-16 14:51:08 -04:00
|
|
|
|
|
|
|
To enable bitlbee you have to add a line like:
|
|
|
|
|
2003-06-27 13:18:01 -04:00
|
|
|
127.0.0.1:6667 stream tcp nowait ${BITLBEEUSER} /usr/local/libexec/bitlbee bitlbee
|
2003-04-16 14:51:08 -04:00
|
|
|
|
|
|
|
to your /etc/inetd.conf and restart inetd with
|
|
|
|
|
|
|
|
# kill -HUP \`cat /var/run/inetd.pid\`
|
|
|
|
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2003-06-22 06:09:57 -04:00
|
|
|
do_warning() {
|
2003-06-27 13:18:01 -04:00
|
|
|
cat << EOF
|
2003-06-22 06:09:57 -04:00
|
|
|
+---------------
|
|
|
|
| WARNING!
|
|
|
|
|
|
|
|
|
| This port has changed the user/group it uses from bitlbee to ${BITLBEEUSER}.
|
|
|
|
| If you installed this port before, ensure all permissions are set correctly
|
|
|
|
| with:
|
|
|
|
|
|
|
|
|
| # ls -ld ${DB_DIR}
|
|
|
|
| # chown -R ${BITLBEEUSER}:${BITLBEEGROUP} ${DB_DIR}
|
|
|
|
|
|
|
|
|
| And don't forget to remove the old user/group.
|
|
|
|
+---------------
|
|
|
|
EOF
|
|
|
|
}
|
2003-04-16 14:51:08 -04:00
|
|
|
# Verify/process the command
|
|
|
|
#
|
|
|
|
case $2 in
|
|
|
|
PRE-INSTALL)
|
|
|
|
if [ -d $DB_DIR ]; then
|
2003-06-27 13:18:01 -04:00
|
|
|
do_notice_existingdir $1
|
2003-04-16 14:51:08 -04:00
|
|
|
fi
|
|
|
|
do_usergroup_install
|
|
|
|
;;
|
|
|
|
POST-INSTALL)
|
|
|
|
if [ ! -d $DB_DIR ]; then
|
2003-06-27 13:18:01 -04:00
|
|
|
do_database_install
|
2003-04-16 14:51:08 -04:00
|
|
|
fi
|
2003-06-27 13:18:01 -04:00
|
|
|
do_manual_notice
|
2003-06-22 06:09:57 -04:00
|
|
|
do_warning
|
2003-04-16 14:51:08 -04:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|