vanilla: use busybox add-shell/remove-shell for post scripts

Mon, 28 Oct 2019 20:05:00 +0100

author
David Demelier <markand@malikania.fr>
date
Mon, 28 Oct 2019 20:05:00 +0100
changeset 1185
6ac8b545df56
parent 1184
02911b528211
child 1186
2fafcd07edb0

vanilla: use busybox add-shell/remove-shell for post scripts

core/busybox/busybox-post.sh file | annotate | diff | comparison | revisions
gnu/bash/bash-post.sh file | annotate | diff | comparison | revisions
shells/dash/dash-post.sh file | annotate | diff | comparison | revisions
shells/tcsh/tcsh-post.sh file | annotate | diff | comparison | revisions
shells/zsh/zsh-post.sh file | annotate | diff | comparison | revisions
--- a/core/busybox/busybox-post.sh	Fri Oct 25 20:10:00 2019 +0200
+++ b/core/busybox/busybox-post.sh	Mon Oct 28 20:05:00 2019 +0100
@@ -15,6 +15,9 @@
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
 
-if [ "$1" = "install" ]; then
+if [ "$1" = "post-install" ]; then
 	/bin/busybox --install -s
+	/bin/busybox add-shell /bin/sh
+elif [ "$1" = "post-uninstall" ]; then
+	/bin/busybox remove-shell /bin/sh
 fi
--- a/gnu/bash/bash-post.sh	Fri Oct 25 20:10:00 2019 +0200
+++ b/gnu/bash/bash-post.sh	Mon Oct 28 20:05:00 2019 +0100
@@ -16,9 +16,7 @@
 #
 
 if [ "$1" = "post-install" ]; then
-	if ! grep -q "/bin/bash" $DESTDIR/etc/shells >/dev/null 2>&1; then
-		echo "/bin/bash" >> $DESTDIR/etc/shells
-	fi
+	/bin/busybox add-shell /bin/bash
 elif [ "$1" = "post-uninstall" ]; then
-	sed -i -e '/\/\/bin\/bash/d' $DESTDIR/etc/shells
+	/bin/busybox remove-shell /bin/bash
 fi
--- a/shells/dash/dash-post.sh	Fri Oct 25 20:10:00 2019 +0200
+++ b/shells/dash/dash-post.sh	Mon Oct 28 20:05:00 2019 +0100
@@ -16,9 +16,7 @@
 #
 
 if [ "$1" = "post-install" ]; then
-	if ! grep -q "/bin/dash" $DESTDIR/etc/shells >/dev/null 2>&1; then
-		echo "/bin/dash" >> $DESTDIR/etc/shells
-	fi
+	/bin/busybox add-shell /bin/dash
 elif [ "$1" = "post-uninstall" ]; then
-	sed -i -e '/\/\/bin\/dash/d' $DESTDIR/etc/shells
+	/bin/busybox remove-shell /bin/dash
 fi
--- a/shells/tcsh/tcsh-post.sh	Fri Oct 25 20:10:00 2019 +0200
+++ b/shells/tcsh/tcsh-post.sh	Mon Oct 28 20:05:00 2019 +0100
@@ -16,9 +16,7 @@
 #
 
 if [ "$1" = "post-install" ]; then
-	if ! grep -q "/bin/tcsh" /etc/shells >/dev/null 2>&1; then
-		echo "/bin/tcsh" >> /etc/shells
-	fi
+	/bin/busybox add-shell /bin/tcsh
 elif [ "$1" = "post-uninstall" ]; then
-	sed -i -e '/\/bin\/tcsh/d' /etc/shells
+	/bin/busybox remove-shell /bin/tcsh
 fi
--- a/shells/zsh/zsh-post.sh	Fri Oct 25 20:10:00 2019 +0200
+++ b/shells/zsh/zsh-post.sh	Mon Oct 28 20:05:00 2019 +0100
@@ -16,9 +16,7 @@
 #
 
 if [ "$1" = "post-install" ]; then
-	if ! grep -q "/bin/zsh" $DESTDIR/etc/shells >/dev/null 2>&1; then
-		echo "/bin/zsh" >> $DESTDIR/etc/shells
-	fi
+	/bin/busybox add-shell /bin/zsh
 elif [ "$1" = "post-uninstall" ]; then
-	sed -i -e '/\/\/bin\/zsh/d' $DESTDIR/etc/shells
+	/bin/busybox remove-shell /bin/zsh
 fi

mercurial