freebsd-ports/Keywords/shell.ucl
Mark Johnston 0cebfcf22e When updating /etc/shells, only remove existing entries that match the new
entry exactly. Otherwise we may clobber entries that contain the new entry
as a substring.

Reviewed by:	bdrewery
Approved by:	bdrewery
Sponsored by:	EMC / Isilon Storage Division
2015-02-16 21:34:46 +00:00

32 lines
936 B
Text

# $FreeBSD$
#
# MAINTAINER: portmgr@FreeBSD.org
#
# @shell bin/shell
#
# Handle adding and remove a path to a shell binary into /etc/shells
# it replaces the following code:
#
# bin/shell
# @exec echo "Updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak; echo %D/%F) >/etc/shells; rm -f /etc/shells.bak
# @unexec echo "Updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak) >/etc/shells; rm -f /etc/shells.bak
actions: [file]
post-install: <<EOD
case "%@" in
/*) file="%@" ;;
*) file="%D/%@" ;;
esac
cp /etc/shells /etc/shells.bak
(grep -v "^${file}$" /etc/shells.bak; echo ${file}) > /etc/shells
rm -f /etc/shells.bak
EOD
pre-deinstall: <<EOD
case "%@" in
/*) file="%@" ;;
*) file="%D/%@" ;;
esac
cp /etc/shells /etc/shells.bak
grep -v "^${file}$" /etc/shells.bak > /etc/shells
rm -f /etc/shells.bak
EOD