diff options
author | bapt <bapt@FreeBSD.org> | 2014-06-12 01:42:36 +0800 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2014-06-12 01:42:36 +0800 |
commit | 34700b93ee12d30f10194a378e6b917bcae13469 (patch) | |
tree | 8b56f25125b5be6dd05af340e094bb197df7f3bc /Keywords | |
parent | 4b5e6a9e5b199a91b87ca581df1d6829198009a8 (diff) | |
download | freebsd-ports-gnome-34700b93ee12d30f10194a378e6b917bcae13469.tar.gz freebsd-ports-gnome-34700b93ee12d30f10194a378e6b917bcae13469.tar.zst freebsd-ports-gnome-34700b93ee12d30f10194a378e6b917bcae13469.zip |
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
Diffstat (limited to 'Keywords')
-rw-r--r-- | Keywords/pkg_install.awk | 19 | ||||
-rw-r--r-- | Keywords/shell.yaml | 22 |
2 files changed, 41 insertions, 0 deletions
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 |