aboutsummaryrefslogtreecommitdiff
path: root/Keywords
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2014-06-11 17:42:36 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2014-06-11 17:42:36 +0000
commit2bacde9c3b2c44465f7058cb9b4c6e7dc4700ac2 (patch)
tree8b56f25125b5be6dd05af340e094bb197df7f3bc /Keywords
parentde32df923135bbd415900176644d4602881f1f76 (diff)
downloadports-2bacde9c3b2c44465f7058cb9b4c6e7dc4700ac2.tar.gz
ports-2bacde9c3b2c44465f7058cb9b4c6e7dc4700ac2.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
Notes
Notes: svn path=/head/; revision=357511
Diffstat (limited to 'Keywords')
-rw-r--r--Keywords/pkg_install.awk19
-rw-r--r--Keywords/shell.yaml22
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