diff options
author | Andreas Oberritter <obi@opendreambox.org> | 2016-10-15 19:54:37 +0200 |
---|---|---|
committer | Andreas Oberritter <obi@opendreambox.org> | 2017-10-17 04:38:27 +0200 |
commit | 525e25817257177ec4cf14e56ebcc2ba46189d35 (patch) | |
tree | 4131cad98dbd9673b77ae362316e6debec88ef6d | |
parent | 4f089ca3a9853a95996d8e6178e11d2f4d54a003 (diff) | |
download | openembedded-core-contrib-525e25817257177ec4cf14e56ebcc2ba46189d35.tar.gz |
bash: use update-alternatives for the bash binary
Busybox may offer a bash applet. If enabled, the alternatives mechanism
avoids breaking logins if bash gets deinstalled while /bin/bash is configured
as a login shell.
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
-rw-r--r-- | meta/recipes-core/busybox/busybox.inc | 9 | ||||
-rw-r--r-- | meta/recipes-extended/bash/bash.inc | 6 |
2 files changed, 13 insertions, 2 deletions
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc index 39c2eef082..56cd6b9180 100644 --- a/meta/recipes-core/busybox/busybox.inc +++ b/meta/recipes-core/busybox/busybox.inc @@ -395,6 +395,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} () { @@ -419,6 +422,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 diff --git a/meta/recipes-extended/bash/bash.inc b/meta/recipes-extended/bash/bash.inc index 1d08526c9e..a05b987b87 100644 --- a/meta/recipes-extended/bash/bash.inc +++ b/meta/recipes-extended/bash/bash.inc @@ -14,9 +14,11 @@ EXTRA_OECONF = "--enable-job-control --without-bash-malloc" # This is what other major distros do. And this is what we wanted. See bug#5359 and bug#7137. CFLAGS += "-DNON_INTERACTIVE_LOGIN_SHELLS" -ALTERNATIVE_${PN} = "sh" +ALTERNATIVE_${PN} = "bash sh" +ALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash" +ALTERNATIVE_TARGET[bash] = "${base_bindir}/bash" ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh" -ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash" +ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash.${BPN}" ALTERNATIVE_PRIORITY = "100" RDEPENDS_${PN} += "base-files" |