From 34700b93ee12d30f10194a378e6b917bcae13469 Mon Sep 17 00:00:00 2001 From: bapt Date: Wed, 11 Jun 2014 17:42:36 +0000 Subject: Add an @shell keyword to handle adding and remove a shell path in /etc/shell Bump port revision of all ports that were doing it wrong prior to the keyword CR: D208 Reviewed by: antoine With hat: portmgr --- Keywords/pkg_install.awk | 19 +++++++++++++++++++ Keywords/shell.yaml | 22 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 Keywords/shell.yaml (limited to 'Keywords') diff --git a/Keywords/pkg_install.awk b/Keywords/pkg_install.awk index e4207d744d03..c5bc96de82cf 100644 --- a/Keywords/pkg_install.awk +++ b/Keywords/pkg_install.awk @@ -14,6 +14,14 @@ # @exec if ! [ -f %D/etc/somefile.conf ]; then cp %D/etc/somefile.conf.sample %D/etc/somefile.conf; fi # @comment end @sample somefile.conf.sample # +## +# @shell bin/shell +# -> +# @comment begin @shell bin/shell +# @exec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak; echo %D/%F) >/etc/shells; rm -f /etc/shells.bak +# @unexec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak) >/etc/shells; rm -f /etc/shells.bak +# @comment end @shell bin/shell + $1 == "@sample" { sample_file=$2 # Take out .sample @@ -25,6 +33,17 @@ $1 == "@sample" { print "@comment end " $0 next } + +$1 == "@shell" { + shell_file=$2 + print "@comment begin " $0 + print shell_file + print "@exec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak; echo %D/%F) >/etc/shells; rm -f /etc/shells.bak" + print "@unexec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak) >/etc/shells; rm -f /etc/shells.bak" + print "@comment end " $0 + next +} + # Print everything else as-is { print $0 diff --git a/Keywords/shell.yaml b/Keywords/shell.yaml new file mode 100644 index 000000000000..0b373d1c52a0 --- /dev/null +++ b/Keywords/shell.yaml @@ -0,0 +1,22 @@ +# $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: | + cp /etc/shells /etc/shells.bak + (grep -v %D/%@ /etc/shells.bak; echo %D/%@) > /etc/shells + rm -f /etc/shells.bak +pre-deinstall: | + cp /etc/shells /etc/shells.bak + grep -v %D/%@ /etc/shells.bak > /etc/shells + rm -f /etc/shells.bak -- cgit