Skip to contentSkip to conversation

busybox: make bash a valid login shell if enabled

PATCH New Andreas Oberritter 1 participant 1 message Apr 28, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 busybox: make bash a valid login shell if enabled

Add bash to /etc/shells if busybox is built with bash applet anabled to fix login via dropbear.

---
 meta/recipes-core/busybox/busybox.inc | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/recipes-core/busybox/busybox.inc +9 -0
index 375632d..adc6e9a 100644
@@ -398,6 +398,9 @@ pkg_postinst_${PN} () {
 			fi
 		done
 	fi
+	if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links*; then
+		grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
+	fi
 }
 
 pkg_prerm_${PN} () {
@@ -422,6 +425,12 @@ pkg_prerm_${PN} () {
 	export PATH=$PATH:$tmpdir
 }
 
+pkg_postrm_${PN} () {
+	if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links* && [ ! -e $D${base_bindir}/bash ]; then
+		printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
+	fi
+}
+
 pkg_prerm_${PN}-syslog () {
 	# remove syslog
 	if test "x$D" = "x"; then
Signature · 1 line
2.7.4