#!/bin/sh
#==============================================================================
# mount_ehd
#   Copyright © W. Michael Petullo <mike@flyn.org>, 2003
#   Copyright © CC Computer Consultants GmbH, 2005 - 2006
#   Contact: Jan Engelhardt <jengelh [at] computergmbh de>
#
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License as
#   published by the Free Software Foundation; either version 2 of
#   the License, or (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#   General Public License for more details.
#
#   You should have received a copy of the GNU General Public
#   License along with this program; if not, write to:
#   Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
#   Boston, MA  02110-1301  USA
#
#   -- For details, see the file named "LICENSE.GPL2"
#==============================================================================
# Pam_mount executes local mount command with the following arguments:
# 1.  options specified in lclmount definition in pam_mount.conf
# 2.  -o some,options (as specified in volume definition in pam_mount.conf)
# 3.  name of volume
# 4.  name of mount point
#
# In order for this script to work correctly, number one should not
# be configured.  Number two should be set so that -o svnd? is passed
# (will be passed as $1 and $2.  This should result in $3 being the
# volume and $4 being the mount point.

[ -x /bin/bash ] && exec mount_ehd2;

ARCH=`uname`

if [ x${ARCH} = xOpenBSD ]; then
	echo /usr/sbin/vnconfig -k $2 $3
	/usr/sbin/vnconfig -k $2 $3
	echo /sbin/mount /dev/${2}c $4
	/sbin/mount /dev/${2}c $4
fi
