freebsd-ports/sysutils/e2fsprogs/pkg-install
Pav Lucistnik a000f4798b - Update to 1.39
PR:		ports/98847
Submitted by:	Matthias Andree <matthias.andree@gmx.de> (maintainer)
2006-06-12 12:13:09 +00:00

79 lines
2.3 KiB
Text

# $FreeBSD$
#
# ports/sysutils/e2fsprogs/pkg-install - (C) 2006 by Matthias Andree
# redistributable under the modified BSD license
#
# ask() and yesno() based on ports/mail/postfix/pkg-install
PKG_PREFIX=${PKG_PREFIX:=/usr/local}
BATCH=${BATCH:=no}
ask() {
local question default answer
question=$1
default=$2
if [ -z "${PACKAGE_BUILDING}" -a x${BATCH} = xno ]; then
read -p "${question} [${default}]? " answer
fi
if [ x${answer} = x ]; then
answer=${default}
fi
echo ${answer}
}
yesno() {
local question default answer
question=$1
default=$2
while :; do
answer=$(ask "${question}" "${default}")
case "${answer}" in
[Yy][Ee][SsPp]|[Yy]) return 0;;
[Nn]|[Nn][Oo]) return 1;;
esac
echo "Please answer yes or no."
done
}
if [ "x$2" = xPOST-INSTALL ] && [ -z "${PACKAGE_BUILDING}" ]; then
cat <<_EOF
To have your ext2 and ext3 filesystems fsck'ed correctly without explicitly
invoking the fsck_ext2fs utility installed by this port you will need to
create links or copy the fsck utilities installed by this port in/to /sbin, e.g.
ln -f "${PKG_PREFIX}/sbin/fsck_ext2fs" /sbin/ 2>/dev/null \\
|| install -m755 "${PKG_PREFIX}/sbin/fsck_ext2fs" /sbin/
ln -f "${PKG_PREFIX}/sbin/e2fsck" /sbin/e2fsck 2>/dev/null \\
|| install -m755 "${PKG_PREFIX}/sbin/e2fsck" /sbin/e2fsck
IMPORTANT: you also need to repeat the steps above after a port upgrade!
_EOF
if yesno "Shall I create the links now?" yes ; then
echo "Installing /sbin/fsck_ext2fs and /sbin/e2fsck."
ln -f "${PKG_PREFIX}/sbin/fsck_ext2fs" /sbin/ 2>/dev/null \
|| install -m755 "${PKG_PREFIX}/sbin/fsck_ext2fs" /sbin/
ln -f "${PKG_PREFIX}/sbin/e2fsck" /sbin/e2fsck 2>/dev/null \
|| install -m755 "${PKG_PREFIX}/sbin/e2fsck" /sbin/e2fsck
fi
fi
if [ "x$2" = xDEINSTALL ] ; then
cat <<_EOF
If you are deinstalling the e2fsprogs port for good, rather than upgrading it,
remember to remove the files you may have installed into /sbin, example:
rm -f /sbin/fsck_ext2fs /sbin/e2fsck
_EOF
if yesno "Shall I remove the links now?" yes ; then
echo "Removing /sbin/fsck_ext2fs and /sbin/e2fsck."
rm -f /sbin/fsck_ext2fs /sbin/e2fsck
fi
fi