Use useradd and update-rc.d classes in the OpenSSH recipe
The current sshd postinst and postrm scripts in the OpenSSH make the package dependant of the adduser/addgroup scripts which may not be available on all systems. This patch replaces the sshd postinst and postrm scripts with proper usage of the useradd and update-rc.d classes. This patch had been modified from the previous proposed version to use useradd long options for more clarity. (From OE-Core rev: 6b7f399d595ef58e759dab211f4ece155119a680) (From OE-Core rev: 058116f528bff27ca5a0e56bbf8070e94f934f32) Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
ab81049f37
commit
e6e867558b
|
@ -29,6 +29,14 @@ PAM_SRC_URI = "file://sshd"
|
||||||
SRC_URI[md5sum] = "0541579adf9d55abb15ef927048d372e"
|
SRC_URI[md5sum] = "0541579adf9d55abb15ef927048d372e"
|
||||||
SRC_URI[sha256sum] = "5c35ec7c966ce05cc4497ac59c0b54a556e55ae7368165cc8c4129694654f314"
|
SRC_URI[sha256sum] = "5c35ec7c966ce05cc4497ac59c0b54a556e55ae7368165cc8c4129694654f314"
|
||||||
|
|
||||||
|
inherit useradd update-rc.d
|
||||||
|
|
||||||
|
USERADD_PACKAGES = "${PN}-sshd"
|
||||||
|
USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd"
|
||||||
|
INITSCRIPT_PACKAGES = "${PN}-sshd"
|
||||||
|
INITSCRIPT_NAME_${PN}-sshd = "sshd"
|
||||||
|
INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9"
|
||||||
|
|
||||||
inherit autotools
|
inherit autotools
|
||||||
|
|
||||||
# LFS support:
|
# LFS support:
|
||||||
|
@ -91,16 +99,6 @@ RDEPENDS_${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen"
|
||||||
DEPENDS_${PN}-sshd += "update-rc.d"
|
DEPENDS_${PN}-sshd += "update-rc.d"
|
||||||
RDEPENDS_${PN}-sshd += "update-rc.d ${PN}-keygen"
|
RDEPENDS_${PN}-sshd += "update-rc.d ${PN}-keygen"
|
||||||
|
|
||||||
pkg_postinst_${PN}-sshd () {
|
|
||||||
if [ "x$D" != "x" ]; then
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
addgroup sshd
|
|
||||||
adduser --system --home /var/run/sshd --no-create-home --disabled-password --ingroup sshd -s /bin/false sshd
|
|
||||||
update-rc.d sshd defaults 9
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst_${PN}-scp () {
|
pkg_postinst_${PN}-scp () {
|
||||||
update-alternatives --install ${bindir}/scp scp scp.${PN} 90
|
update-alternatives --install ${bindir}/scp scp scp.${PN} 90
|
||||||
}
|
}
|
||||||
|
@ -117,16 +115,5 @@ pkg_postrm_${PN}-scp () {
|
||||||
update-alternatives --remove ${bindir}/scp scp.${PN}
|
update-alternatives --remove ${bindir}/scp scp.${PN}
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_postrm_${PN}-sshd () {
|
|
||||||
if [ "x$D" != "x" ]; then
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
${sysconfdir}/init.d/sshd stop
|
|
||||||
deluser sshd
|
|
||||||
delgroup sshd
|
|
||||||
update-rc.d -f sshd remove
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
CONFFILES_${PN}-sshd = "${sysconfdir}/ssh/sshd_config"
|
CONFFILES_${PN}-sshd = "${sysconfdir}/ssh/sshd_config"
|
||||||
CONFFILES_${PN}-ssh = "${sysconfdir}/ssh/ssh_config"
|
CONFFILES_${PN}-ssh = "${sysconfdir}/ssh/ssh_config"
|
||||||
|
|
Loading…
Reference in New Issue