9ba029ab5e
- new user naming schema - bump PKGNAME couderc@ ok
102 lines
2.5 KiB
Plaintext
102 lines
2.5 KiB
Plaintext
#!/bin/sh
|
|
# $OpenBSD: INSTALL,v 1.2 2003/06/23 19:08:52 sturm Exp $
|
|
#
|
|
# Pre/post-installation setup of vsftpd
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
|
PREFIX=${PKG_PREFIX:-/usr/local}
|
|
CONFIG_DIR=${SYSCONFDIR}
|
|
SAMPLE_CONFIG_DIR=$PREFIX/share/examples/vsftpd
|
|
VSFTPDUSER=_vsftpd
|
|
VSFTPDGROUP=_vsftpd
|
|
ID=513
|
|
|
|
do_usergroup_install()
|
|
{
|
|
# Create vsftpd user and group
|
|
groupinfo -e $VSFTPDGROUP
|
|
if [ $? -eq 0 ]; then
|
|
echo "===> Using $VSFTPDGROUP group for vsftpd"
|
|
else
|
|
echo "===> Creating $VSFTPDGROUP group for vsftpd"
|
|
groupadd -g $ID $VSFTPDGROUP
|
|
fi
|
|
userinfo -e $VSFTPDUSER
|
|
if [ $? -eq 0 ]; then
|
|
echo "===> Using $VSFTPDUSER user for vsftpd"
|
|
else
|
|
echo "===> Creating $VSFTPDUSER user for vsftpd"
|
|
useradd -g $VSFTPDGROUP -d /nonexistent -c 'vsftpd user' -s /sbin/nologin -u $ID $VSFTPDUSER
|
|
fi
|
|
}
|
|
|
|
do_notice()
|
|
{
|
|
echo
|
|
echo "+---------------"
|
|
echo "| The existing $1 configuration files in $CONFIG_DIR have NOT"
|
|
echo "| been changed. You may want to compare them to the current samples in"
|
|
echo "| $SAMPLE_CONFIG_DIR, and update your configuration"
|
|
echo "| files as needed."
|
|
echo "+---------------"
|
|
echo
|
|
}
|
|
|
|
do_install()
|
|
{
|
|
install -o root -g wheel -m 644 $SAMPLE_CONFIG_DIR/vsftpd.conf $CONFIG_DIR
|
|
echo
|
|
echo "+---------------"
|
|
echo "| The $1 configuration files have been installed in $CONFIG_DIR."
|
|
echo "| Please view these files and change the configuration to meet your needs."
|
|
echo "| You must also add one of the two folowing lines to your inetd.conf :"
|
|
echo "|"
|
|
echo "| ftp stream tcp nowait root ${PREFIX}/sbin/vsftpd vsftpd"
|
|
echo "|"
|
|
echo "| ftp stream tcp nowait root /usr/libexec/tcpd ${PREFIX}/sbin/vsftpd"
|
|
echo "|"
|
|
echo "| The second line is to use vsftpd with tcp-wrappers, see tcpd(8)."
|
|
echo "+---------------"
|
|
echo
|
|
}
|
|
|
|
do_warning()
|
|
{
|
|
echo "+---------------"
|
|
echo "| WARNING!"
|
|
echo "|"
|
|
echo "| This port has changed its user/group from 'vsftpd' to '_vsftpd'."
|
|
echo "| If you installed this port before, ensure all permissions are set"
|
|
echo "| correctly and then \"rmuser vsftpd\"."
|
|
echo "+---------------"
|
|
echo
|
|
}
|
|
# verify proper execution
|
|
#
|
|
if [ $# -ne 2 ]; then
|
|
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Verify/process the command
|
|
#
|
|
case $2 in
|
|
PRE-INSTALL)
|
|
do_usergroup_install
|
|
;;
|
|
POST-INSTALL)
|
|
if [ ! -f $CONFIG_DIR/vsftpd.conf ]; then
|
|
do_install $1
|
|
else
|
|
do_notice $1
|
|
fi
|
|
do_warning
|
|
;;
|
|
*)
|
|
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|