diff options
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 |