From 36c84fe45b1bf4203af30e9cf22477d7ab43beac Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Wed, 6 May 2009 07:17:33 +0200
Subject: [PATCH] dash: some fixes for /bin/sh symlink.

1) Always create /bin/sh symlink at post-installation.
2) If dash is going to be removed, make /bin/sh a symlink
   to /bin/bash, if it exists otherwise it will be dangled.

This fixes the update of the dash package.

Bump revision.

--HG--
extra : convert_revision : 38586de9f72d0b5f4c7498dbef3709d77f4f07db
---
 templates/dash/INSTALL  | 12 ++++++++++++
 templates/dash/REMOVE   | 15 +++++++++++++++
 templates/dash/template |  6 +-----
 3 files changed, 28 insertions(+), 5 deletions(-)
 create mode 100644 templates/dash/INSTALL
 create mode 100644 templates/dash/REMOVE

diff --git a/templates/dash/INSTALL b/templates/dash/INSTALL
new file mode 100644
index 00000000000..8b3a234d206
--- /dev/null
+++ b/templates/dash/INSTALL
@@ -0,0 +1,12 @@
+#
+# This script creates the /bin/sh symlink to /bin/dash.
+#
+
+case "${ACTION}" in
+pre)
+	;;
+post)
+	echo "Creating /bin/sh symlink..."
+	cd ./bin && ./ln -sf dash sh
+	;;
+esac
diff --git a/templates/dash/REMOVE b/templates/dash/REMOVE
new file mode 100644
index 00000000000..c9541b91de3
--- /dev/null
+++ b/templates/dash/REMOVE
@@ -0,0 +1,15 @@
+#
+# This script remove the /bin/sh symlink to /bin/dash
+# and makes a new one to /bin/bash if available.
+#
+
+case "${ACTION}" in
+pre)
+	if [ -x ./bin/bash ]; then
+		echo "Creating /bin/sh -> /bin/bash symlink..."
+		cd ./bin && ln -sf bash sh
+	fi
+	;;
+post)
+	;;
+esac
diff --git a/templates/dash/template b/templates/dash/template
index 3eb2b83f994..ca7c365a917 100644
--- a/templates/dash/template
+++ b/templates/dash/template
@@ -1,6 +1,7 @@
 # Template file for 'dash'
 pkgname=dash
 version=0.5.5.1
+revision=1
 distfiles="http://gondor.apana.org.au/~herbert/dash/files/$pkgname-$version.tar.gz"
 build_style=gnu_configure
 configure_args="--prefix="
@@ -20,8 +21,3 @@ base_chroot=yes
 register_shell="/bin/sh"
 Add_dependency run glibc
 Add_dependency run coreutils
-
-post_install()
-{
-	cd ${DESTDIR}/bin && ln -s dash sh
-}