[arch-commits] Commit in tcsh/trunk (tcsh.install)

Lukas Fleischer lfleischer at archlinux.org
Sun Apr 17 06:36:36 UTC 2016


    Date: Sunday, April 17, 2016 @ 08:36:36
  Author: lfleischer
Revision: 171232

Fix sed issues (FS#45640).

Modified:
  tcsh/trunk/tcsh.install

--------------+
 tcsh.install |   24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

Modified: tcsh.install
===================================================================
--- tcsh.install	2016-04-17 04:41:06 UTC (rev 171231)
+++ tcsh.install	2016-04-17 06:36:36 UTC (rev 171232)
@@ -1,23 +1,13 @@
 post_install() {
-  if ! grep -q /bin/tcsh etc/shells; then
-    echo /bin/tcsh >> etc/shells
-    echo /bin/csh >> etc/shells
-    echo 'Added to /etc/shells.'
+  if ! grep -qe '^/bin/tcsh$' etc/shells; then
+    echo /bin/tcsh >>etc/shells
+    echo /bin/csh >>etc/shells
+    echo 'Added tcsh and csh to /etc/shells.'
   fi
 }
 
-post_upgrade() {
-  if grep -q /usr/bin/tcsh etc/shells; then
-    sed -i 's|/usr/bin/tcsh|/bin/tcsh|' etc/shells
-    sed -i 's|/usr/bin/csh|/bin/csh|' etc/shells
-    echo 'Fixed path in /etc/shells.'
-  fi
-}
-
 pre_remove() {
-  sed -i '\|/bin/tcsh|d' etc/shells
-  sed -i '\|/bin/csh|d' etc/shells
-  echo 'Removed from /etc/shells.'
+  sed -i -r '/^(\/usr)?\/bin\/tcsh$/d' /etc/shells
+  sed -i -r '/^(\/usr)?\/bin\/csh$/d' /etc/shells
+  echo 'Removed tcsh and csh from /etc/shells.'
 }
-
-# vim:set ts=2 sw=2 et:



More information about the arch-commits mailing list