[OE-core] [PATCH 2/2] openssh: Use systemd-tmpfiles to create volatiles files and dirs
Fabio Berton
fabio.berton at ossystems.com.br
Thu Apr 13 14:38:17 UTC 2017
ping
On 04/05/2017 09:09 AM, Fabio Berton wrote:
> Volatiles files are installed in different locations depending on
> distro feature update-rc.d or systemd. For update-rc.d volatiles
> configuration files are installed in /etc/default/volatiles and
> for systemd in /etc/tmpfiles.d/. So, we need to install volatiles
> files in correct location depending on what distro feature is used.
>
> Signed-off-by: Fabio Berton <fabio.berton at ossystems.com.br>
> ---
> .../openssh/openssh/sshd.tmpfiles.d | 2 ++
> meta/recipes-connectivity/openssh/openssh_7.4p1.bb | 27 +++++++++++++---------
> 2 files changed, 18 insertions(+), 11 deletions(-)
> create mode 100644 meta/recipes-connectivity/openssh/openssh/sshd.tmpfiles.d
>
> diff --git a/meta/recipes-connectivity/openssh/openssh/sshd.tmpfiles.d b/meta/recipes-connectivity/openssh/openssh/sshd.tmpfiles.d
> new file mode 100644
> index 0000000000..a2ae06ad94
> --- /dev/null
> +++ b/meta/recipes-connectivity/openssh/openssh/sshd.tmpfiles.d
> @@ -0,0 +1,2 @@
> +d /var/run/sshd 0755 root root - -
> +f /var/log/lastlog 0644 root root - -
> diff --git a/meta/recipes-connectivity/openssh/openssh_7.4p1.bb b/meta/recipes-connectivity/openssh/openssh_7.4p1.bb
> index c8093d4e2b..eff83de135 100644
> --- a/meta/recipes-connectivity/openssh/openssh_7.4p1.bb
> +++ b/meta/recipes-connectivity/openssh/openssh_7.4p1.bb
> @@ -20,6 +20,7 @@ SRC_URI = "http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar
> file://sshd@.service \
> file://sshdgenkeys.service \
> file://volatiles.99_sshd \
> + file://sshd.tmpfiles.d \
> file://add-test-support-for-busybox.patch \
> file://run-ptest \
> file://openssh-7.1p1-conditional-compile-des-in-cipher.patch \
> @@ -104,8 +105,7 @@ do_install_append () {
> install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
> rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin
> rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir}
> - install -d ${D}/${sysconfdir}/default/volatiles
> - install -m 644 ${WORKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd
> +
> install -m 0755 ${S}/contrib/ssh-copy-id ${D}${bindir}
>
> # Create config files for read-only rootfs
> @@ -117,14 +117,19 @@ do_install_append () {
> echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
> echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
>
> - install -d ${D}${systemd_unitdir}/system
> - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_unitdir}/system
> - install -c -m 0644 ${WORKDIR}/sshd at .service ${D}${systemd_unitdir}/system
> - install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system
> - sed -i -e 's, at BASE_BINDIR@,${base_bindir},g' \
> - -e 's, at SBINDIR@,${sbindir},g' \
> - -e 's, at BINDIR@,${bindir},g' \
> - ${D}${systemd_unitdir}/system/sshd.socket ${D}${systemd_unitdir}/system/*.service
> + if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
> + install -d ${D}${systemd_unitdir}/system
> + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_unitdir}/system
> + install -c -m 0644 ${WORKDIR}/sshd at .service ${D}${systemd_unitdir}/system
> + install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system
> + sed -i -e 's, at BASE_BINDIR@,${base_bindir},g' \
> + -e 's, at SBINDIR@,${sbindir},g' \
> + -e 's, at BINDIR@,${bindir},g' \
> + ${D}${systemd_unitdir}/system/sshd.socket ${D}${systemd_unitdir}/system/*.service
> + install -Dm 0644 ${WORKDIR}/sshd.tmpfiles.d ${D}${sysconfdir}/tmpfiles.d/sshd.conf
> + else
> + install -Dm 0644 ${WORKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd
> + fi
> }
>
> do_install_ptest () {
> @@ -138,7 +143,7 @@ PACKAGES =+ "${PN}-keygen ${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-sftp ${PN}-misc $
> FILES_${PN}-scp = "${bindir}/scp.${BPN}"
> FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config"
> FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd ${systemd_unitdir}/system"
> -FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly ${sysconfdir}/default/volatiles/99_sshd ${sysconfdir}/pam.d/sshd"
> +FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly ${sysconfdir}/default/volatiles/99_sshd ${sysconfdir}/pam.d/sshd ${sysconfdir}/tmpfiles.d/sshd.conf"
> FILES_${PN}-sftp = "${bindir}/sftp"
> FILES_${PN}-sftp-server = "${libexecdir}/sftp-server"
> FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*"
>
More information about the Openembedded-core
mailing list