1999-05-30 19:02:58 -04:00
|
|
|
#!/bin/sh
|
2003-05-12 14:02:44 -04:00
|
|
|
# $OpenBSD: INSTALL,v 1.3 2003/05/12 18:02:45 sturm Exp $
|
1999-05-30 19:02:58 -04:00
|
|
|
#
|
|
|
|
# Pre/post-installation setup of samba
|
|
|
|
|
|
|
|
# exit on errors, use a sane path and install prefix
|
|
|
|
#
|
|
|
|
set -e
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
|
|
|
PREFIX=${PKG_PREFIX:-/usr/local}
|
2003-05-12 14:02:44 -04:00
|
|
|
CONFIG_DIR=${CONFDIR}
|
2001-04-10 07:33:46 -04:00
|
|
|
CONFIG_FILE=$CONFIG_DIR/smb.conf
|
|
|
|
SAMPLE_CONFIG_DIR=$PREFIX/share/examples/samba
|
2002-02-09 09:15:08 -05:00
|
|
|
SAMBA_SPOOL=${SAMBA_SPOOL}
|
1999-05-30 19:02:58 -04:00
|
|
|
|
2001-12-03 19:41:46 -05:00
|
|
|
install -d -o root -g wheel -m 1755 $SAMBA_SPOOL
|
1999-05-30 19:02:58 -04:00
|
|
|
|
|
|
|
# Function: tell the user what s/he needs to do to use the port just installed
|
|
|
|
#
|
|
|
|
do_notice()
|
|
|
|
{
|
|
|
|
echo
|
|
|
|
echo "+---------------"
|
2001-04-10 07:33:46 -04:00
|
|
|
echo "| The existing $1 configuration files in $CONFIG_DIR,"
|
1999-05-30 19:02:58 -04:00
|
|
|
echo "| have NOT been changed. You may want to compare them to the"
|
2001-04-10 07:33:46 -04:00
|
|
|
echo "| current sample files, $SAMPLE_CONFIG_DIR,"
|
1999-05-30 19:02:58 -04:00
|
|
|
echo "| and update your configuration as needed."
|
|
|
|
echo "+---------------"
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
# Function: install the samba configuration files from the samples
|
|
|
|
#
|
|
|
|
do_install()
|
|
|
|
{
|
2001-04-10 07:33:46 -04:00
|
|
|
install -d -o root -g wheel -m 755 $CONFIG_DIR
|
|
|
|
cat /etc/passwd | $PREFIX/bin/mksmbpasswd.sh > $CONFIG_DIR/smbpasswd; \
|
|
|
|
chmod 600 $CONFIG_DIR/smbpasswd
|
|
|
|
install -o root -g wheel -m 644 $SAMPLE_CONFIG_DIR/smb.conf.default $CONFIG_FILE
|
1999-05-30 19:02:58 -04:00
|
|
|
echo
|
|
|
|
echo "+---------------"
|
2001-04-10 07:33:46 -04:00
|
|
|
echo "| The $1 configuration files in $CONFIG_DIR,"
|
1999-05-30 19:02:58 -04:00
|
|
|
echo "| have been installed. Please view these files and change"
|
2001-10-24 11:33:57 -04:00
|
|
|
echo "| the configuration to meet your needs."
|
1999-05-30 19:02:58 -04:00
|
|
|
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)
|
|
|
|
: nothing to pre-install for this port
|
|
|
|
;;
|
|
|
|
POST-INSTALL)
|
2001-04-10 07:33:46 -04:00
|
|
|
if [ ! -d $CONFIG_DIR ]; then
|
|
|
|
do_install $1
|
|
|
|
elif [ ! -f $CONFIG_FILE ]; then
|
|
|
|
do_install $1
|
|
|
|
else
|
|
|
|
do_notice $1
|
|
|
|
fi
|
1999-05-30 19:02:58 -04:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|