OpenSSH/dropbear: introducing update-alternatives for server component
PATCH 1/1 OpenSSH/dropbear: introducing update-alternatives for server component
Signed-off-by Steffen Sledz <[email protected]>
--- recipes/dropbear/dropbear.inc | 49 ++++++++++++++++++++++++++--- recipes/openssh/openssh.inc | 68 +++++++++++++++++++++++++++------------- 2 files changed, 90 insertions(+), 27 deletions(-)
recipes/dropbear/dropbear.inc +44 -5
@@ -6,7 +6,7 @@ DEPENDS = "zlib" PROVIDES = "ssh sshd" RPROVIDES_${PN} = "ssh sshd" -INC_PR = "r7" +INC_PR = "r8" SRC_URI = "\ http://matt.ucc.asn.au/dropbear/dropbear-${PV}.tar.bz2 \
@@ -18,10 +18,7 @@ SRC_URI = "\ file://default \ " -inherit autotools update-rc.d - -INITSCRIPT_NAME = "dropbear" -INITSCRIPT_PARAMS = "defaults 10" +inherit autotools CFLAGS =+ "-I." LD = "${CC}"
@@ -64,9 +61,38 @@ do_install() { fi } +# sshd initscript is handled explicitly because order of +# update-rc.d and update-alternatives is important +DEPENDS_append = " update-rc.d update-rc.d-native" +RDEPENDS_${PN}_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}" + pkg_postinst () { update-alternatives --install ${bindir}/scp scp ${sbindir}/dropbearmulti 20 update-alternatives --install ${bindir}/ssh ssh ${sbindir}/dropbearmulti 20 + + update-alternatives --install ${sysconfdir}/init.d/sshd sshd dropbear 20 + + if test "x$D" != "x"; then + OPT="-r $D" + else + OPT="-s" + fi + # remove all rc.d-links potentially created from older dropbear or + # alternative sshd packages before creating new ones + update-rc.d $OPT -f dropbear remove + update-rc.d $OPT -f sshd remove + update-rc.d $OPT sshd defaults + +} + +pkg_prerm () { + if test "x$D" = "x"; then + if test "$1" = "upgrade" -o "$1" = "remove"; then + /etc/init.d/sshd stop + fi + fi + + update-alternatives --remove sshd dropbear } pkg_postrm_append () {
@@ -78,6 +104,19 @@ pkg_postrm_append () { fi update-alternatives --remove ssh ${bindir}/dropbearmulti update-alternatives --remove scp ${bindir}/dropbearmulti + + if test "x$D" != "x"; then + OPT="-r $D" + else + OPT="" + fi + if test "$1" = "remove" -o "$1" = "purge"; then + if ! test -e "/etc/init.d/sshd"; then + update-rc.d $OPT sshd remove + fi + fi } CONFFILES_${PN} += "${sysconfdir}/default/dropbear" + +INITSCRIPT_NAME = "sshd"
recipes/openssh/openssh.inc +46 -22
114 lines not on this page · raw message
Signature · 1 line
1.7.7