openssh: Add systemd support
PATCH v6 1/5 openssh: Add systemd support
From: Muhammad Shakeel <[email protected]>
-Remove dependency on meta-systemd
--- .../openssh/openssh-6.2p2/sshd.socket | 11 +++++++++++ .../openssh/openssh-6.2p2/[email protected] | 9 +++++++++ .../openssh/openssh-6.2p2/sshdgenkeys.service | 10 ++++++++++ meta/recipes-connectivity/openssh/openssh_6.2p2.bb | 19 +++++++++++++++++-- 4 files changed, 47 insertions(+), 2 deletions(-)
meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket new file +11 -0
@@ -0,0 +1,11 @@ +[Unit] +Conflicts=sshd.service + +[Socket] +ExecStartPre=@BASE_BINDIR@/mkdir -p /var/run/sshd +ListenStream=22 +Accept=yes + +[Install] +WantedBy=sockets.target +Also=sshdgenkeys.service
meta/recipes-connectivity/openssh/openssh-6.2p2/[email protected] new file +9 -0
@@ -0,0 +1,9 @@ +[Unit] +Description=OpenSSH Per-Connection Daemon +After=sshdgenkeys.service + +[Service] +ExecStart=-@SBINDIR@/sshd -i +ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID +StandardInput=socket +StandardError=syslog
meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service new file +10 -0
@@ -0,0 +1,10 @@ +[Unit] +Description=SSH Key Generation + +[Service] +ExecStart=@BINDIR@/ssh-keygen -A +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target
meta/recipes-connectivity/openssh/openssh_6.2p2.bb +17 -2
@@ -26,14 +26,17 @@ SRC_URI = "ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar. file://init \ file://openssh-CVE-2011-4327.patch \ file://mac.patch \ - ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)}" + ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ + file://sshd.socket \ + file://[email protected] \ + file://sshdgenkeys.service " PAM_SRC_URI = "file://sshd" SRC_URI[md5sum] = "be46174dcbb77ebb4ea88ef140685de1" SRC_URI[sha256sum] = "7f29b9d2ad672ae0f9e1dcbff871fc5c2e60a194e90c766432e32161b842313b" -inherit useradd update-rc.d update-alternatives +inherit useradd update-rc.d update-alternatives systemd USERADD_PACKAGES = "${PN}-sshd" USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd"
@@ -41,6 +44,9 @@ INITSCRIPT_PACKAGES = "${PN}-sshd" INITSCRIPT_NAME_${PN}-sshd = "sshd" INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9" +SYSTEMD_PACKAGES = "${PN}-sshd" +SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket [email protected] sshdgenkeys.service" + PACKAGECONFIG ??= "tcp-wrappers" PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,,tcp-wrappers"
@@ -93,6 +99,15 @@ do_install_append () { echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly echo "HostKey /var/run/ssh/ssh_host_dsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly echo "HostKey /var/run/ssh/ssh_host_ecdsa_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}/[email protected] ${D}${systemd_unitdir}/system + install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + ${D}${systemd_unitdir}/system/sshd.socket ${D}${systemd_unitdir}/system/*.service } ALLOW_EMPTY_${PN} = "1"
Signature · 1 line
1.7.9.5
PATCH v6 2/5 lighttpd: Add systemd support
From: Muhammad Shakeel <[email protected]>
- Remove dependency on meta-systemd
--- .../lighttpd/files/lighttpd.service | 12 ++++++++++++ meta/recipes-extended/lighttpd/lighttpd_1.4.32.bb | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-)
meta/recipes-extended/lighttpd/files/lighttpd.service new file +12 -0
@@ -0,0 +1,12 @@ +[Unit] +Description=Lightning Fast Webserver With Light System Requirements +After=network.target + +[Service] +ExecStartPre=@SBINDIR@/lighttpd -t -f @SYSCONFDIR@/lighttpd.conf +ExecStart=@SBINDIR@/lighttpd -D -f @SYSCONFDIR@/lighttpd.conf +ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target +
meta/recipes-extended/lighttpd/lighttpd_1.4.32.bb +11 -1
@@ -22,6 +22,7 @@ SRC_URI = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${PV}.t file://index.html.lighttpd \ file://lighttpd.conf \ file://lighttpd \ + file://lighttpd.service \ " SRC_URI[md5sum] = "8e2d4ae8e918d4de1aeb9842584d170b"
@@ -39,16 +40,25 @@ EXTRA_OECONF = " \ --disable-static \ " -inherit autotools pkgconfig update-rc.d gettext +inherit autotools pkgconfig update-rc.d gettext systemd INITSCRIPT_NAME = "lighttpd" INITSCRIPT_PARAMS = "defaults 70" +SYSTEMD_SERVICE_${PN} = "lighttpd.service" + do_install_append() { install -d ${D}${sysconfdir}/init.d ${D}/www/logs ${D}/www/pages/dav ${D}/www/var install -m 0755 ${WORKDIR}/lighttpd ${D}${sysconfdir}/init.d install -m 0755 ${WORKDIR}/lighttpd.conf ${D}${sysconfdir} install -m 0644 ${WORKDIR}/index.html.lighttpd ${D}/www/pages/index.html + + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/lighttpd.service ${D}${systemd_unitdir}/system + sed -i -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@SYSCONFDIR@,${sysconfdir},g' \ + -e 's,@BASE_BINDIR@,${base_bindir},g' \ + ${D}${systemd_unitdir}/system/lighttpd.service } FILES_${PN} += "${sysconfdir} /www"
Signature · 1 line
1.7.9.5
PATCH v6 3/5 rpcbind: Add systemd support
In reply to Shakeel, MuhammadFrom: Muhammad Shakeel <[email protected]>
- Remove dependency on meta-systemd
--- meta/recipes-extended/rpcbind/rpcbind/rpcbind.conf | 3 +++ .../rpcbind/rpcbind/rpcbind.service | 14 ++++++++++++++ meta/recipes-extended/rpcbind/rpcbind_0.2.0.bb | 16 +++++++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-)
meta/recipes-extended/rpcbind/rpcbind/rpcbind.conf new file +3 -0
@@ -0,0 +1,3 @@ +# Optional arguments passed to rpcbind. +# +RPCBIND_OPTS=""
meta/recipes-extended/rpcbind/rpcbind/rpcbind.service new file +14 -0
@@ -0,0 +1,14 @@ +[Unit] +Description=RPC Bind +After=network.target +Wants=rpcbind.target +Before=rpcbind.target + +[Service] +Type=forking +EnvironmentFile=-@SYSCONFDIR@/rpcbind.conf +ExecStart=@SBINDIR@/rpcbind -w $RPCBIND_OPTS +Restart=always + +[Install] +WantedBy=multi-user.target
meta/recipes-extended/rpcbind/rpcbind_0.2.0.bb +15 -1
@@ -15,6 +15,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/rpcbind/rpcbind-${PV}.tar.bz2 \ file://fix_host_path.patch \ file://obsolete_automake_macros.patch \ ${UCLIBCPATCHES} \ + file://rpcbind.conf \ + file://rpcbind.service \ " UCLIBCPATCHES_libc-uclibc = "file://0001-uclibc-nss.patch \
@@ -27,7 +29,7 @@ SRC_URI[sha256sum] = "c92f263e0353887f16379d7708ef1fb4c7eedcf20448bc1e4838f59497 PR = "r4" -inherit autotools update-rc.d +inherit autotools update-rc.d systemd PACKAGECONFIG ??= "tcp-wrappers" PACKAGECONFIG[tcp-wrappers] = "--enable-libwrap,--disable-libwrap,tcp-wrappers"
@@ -35,6 +37,11 @@ PACKAGECONFIG[tcp-wrappers] = "--enable-libwrap,--disable-libwrap,tcp-wrappers" INITSCRIPT_NAME = "rpcbind" INITSCRIPT_PARAMS = "start 43 S . start 32 0 6 . stop 81 1 ." +SYSTEMD_SERVICE_${PN} = "rpcbind.service" +SYSTEMD_AUTO_ENABLE = "disable" + +EXTRA_OECONF += " --enable-warmstarts " + do_install_append () { mv ${D}${bindir} ${D}${sbindir}
@@ -43,4 +50,11 @@ do_install_append () { -e 's,/sbin/,${sbindir}/,g' \ ${WORKDIR}/init.d > ${D}${sysconfdir}/init.d/rpcbind chmod 0755 ${D}${sysconfdir}/init.d/rpcbind + + install -m 0755 ${WORKDIR}/rpcbind.conf ${D}${sysconfdir} + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/rpcbind.service ${D}${systemd_unitdir}/system + sed -i -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@SYSCONFDIR@,${sysconfdir},g' \ + ${D}${systemd_unitdir}/system/rpcbind.service }
Signature · 1 line
1.7.9.5
PATCH v6 4/5 nfs-utils: Add systemd support
In reply to Shakeel, MuhammadFrom: Muhammad Shakeel <[email protected]>
- Remove dependency on meta-systemd
--- .../nfs-utils/nfs-utils/nfs-mountd.service | 11 ++++++ .../nfs-utils/nfs-utils/nfs-server.service | 18 ++++++++++ .../nfs-utils/nfs-utils/nfs-statd.service | 12 +++++++ .../nfs-utils/nfs-utils/nfs-utils.conf | 35 ++++++++++++++++++++ .../nfs-utils/nfs-utils_1.2.8.bb | 21 ++++++++++-- 5 files changed, 95 insertions(+), 2 deletions(-)
meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service new file +11 -0
@@ -0,0 +1,11 @@ +[Unit] +Description=NFS Mount Daemon +After=rpcbind.service nfs-server.service +Requires=rpcbind.service nfs-server.service + +[Service] +EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf +ExecStart=@SBINDIR@/rpc.mountd -F $MOUNTD_OPTS + +[Install] +WantedBy=multi-user.target
meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service new file +18 -0
@@ -0,0 +1,18 @@ +[Unit] +Description=NFS Server +Requires=rpcbind.service nfs-mountd.service +After=rpcbind.service + +[Service] +Type=oneshot +EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf +ExecStartPre=@SBINDIR@/exportfs -r +ExecStart=@SBINDIR@/rpc.nfsd $NFSD_OPTS $NFSD_COUNT +ExecStop=@SBINDIR@/rpc.nfsd 0 +ExecStopPost=@SBINDIR@/exportfs -f +ExecReload=@SBINDIR@/exportfs -r +StandardError=syslog +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target
meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service new file +12 -0
@@ -0,0 +1,12 @@ +[Unit] +Description=NFS file locking service +After=rpcbind.service +Requires=rpcbind.service +Before=remote-fs-pre.target + +[Service] +EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf +ExecStart=@SBINDIR@/rpc.statd -F $STATD_OPTS + +[Install] +WantedBy=multi-user.target
meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf new file +35 -0
@@ -0,0 +1,35 @@ +# Parameters to be passed to nfs-utils (clients & server) service files. +# + +# Options to pass to rpc.nfsd. +NFSD_OPTS="" + +# Number of servers to start up; the default is 8 servers. +NFSD_COUNT="" + +# Where to mount nfsd filesystem; the default is "/proc/fs/nfsd". +PROCNFSD_MOUNTPOINT="" + +# Options used to mount nfsd filesystem; the default is "rw,nodev,noexec,nosuid". +PROCNFSD_MOUNTOPTS="" + +# Options for rpc.mountd. +# If you have a port-based firewall, you might want to set up +# a fixed port here using the --port option. +MOUNTD_OPTS="" + +# Parameters to be passed to nfs-common (nfs clients & server) init script. +# + +# If you do not set values for the NEED_ options, they will be attempted +# autodetected; this should be sufficient for most people. Valid alternatives +# for the NEED_ options are "yes" and "no". + +# Do you want to start the statd daemon? It is not needed for NFSv4. +NEED_STATD="" + +# Options to pass to rpc.statd. +# N.B. statd normally runs on both client and server, and run-time +# options should be specified accordingly. +# STATD_OPTS="-p 32765 -o 32766" +STATD_OPTS=""
meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.8.bb +19 -2
@@ -15,7 +15,11 @@ RRECOMMENDS_${PN} = "kernel-module-nfsd" SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.bz2 \ file://nfs-utils-1.0.6-uclibc.patch \ file://nfs-utils-1.2.3-sm-notify-res_init.patch \ - file://nfsserver" + file://nfsserver \ + file://nfs-utils.conf \ + file://nfs-server.service \ + file://nfs-mountd.service \ + file://nfs-statd.service " SRC_URI[md5sum] = "6e7d97de51e428a0b8698c16ca23db77" SRC_URI[sha256sum] = "1cc8f02a633eddbf0a1d93421f331479c4cdab4c5ab33b8bf8c7c369f9156ac6"
@@ -31,7 +35,10 @@ INITSCRIPT_NAME = "nfsserver" # in the shutdown levels, but that works fine. INITSCRIPT_PARAMS = "defaults" -inherit autotools update-rc.d +inherit autotools update-rc.d systemd + +SYSTEMD_SERVICE_${PN} = "nfs-server.service nfs-mountd.service nfs-statd.service" +SYSTEMD_AUTO_ENABLE = "disable" # --enable-uuid is need for cross-compiling EXTRA_OECONF = "--with-statduser=nobody \
@@ -65,6 +72,16 @@ do_install_append () { install -d ${D}${sysconfdir}/init.d install -d ${D}${localstatedir}/lib/nfs/statd install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver + + install -m 0755 ${WORKDIR}/nfs-utils.conf ${D}${sysconfdir} + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/nfs-server.service ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/nfs-mountd.service ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/nfs-statd.service ${D}${systemd_unitdir}/system/ + sed -i -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@SYSCONFDIR@,${sysconfdir},g' \ + ${D}${systemd_unitdir}/system/*.service + # kernel code as of 3.8 hard-codes this path as a default install -d ${D}/var/lib/nfs/v4recovery
Signature · 1 line
1.7.9.5
PATCH v6 5/5 systemd: Remove base_libdir if installed only for systemd_unitdir
In reply to Shakeel, MuhammadFrom: Muhammad Shakeel <[email protected]>
If a recipe installs systemd_unitdir and it is a non-systemd build than systemd.bbclass deletes systemd_unitdir (/lib/systemd/) but not base_libdir (/lib). In this case if base_libdir is empty than following QA Issue is reported.
ERROR: QA Issue: openssh: Files/directories were installed but not shipped
/lib
If base_libdir was installed due to systemd_unitdir installation than for non-systemd build it should also be removed.
--- meta/classes/systemd.bbclass | 3 +++ 1 file changed, 3 insertions(+)
meta/classes/systemd.bbclass +3 -0
@@ -168,6 +168,9 @@ python rm_systemd_unitdir (){ systemd_unitdir = oe.path.join(d.getVar("D", True), d.getVar('systemd_unitdir', True)) if os.path.exists(systemd_unitdir): shutil.rmtree(systemd_unitdir) + base_libdir = oe.path.join(d.getVar("D", True), d.getVar('base_libdir', True)) + if (os.path.exists(base_libdir) and not os.listdir(base_libdir)): + os.rmdir(base_libdir) } do_install[postfuncs] += "rm_systemd_unitdir "
Signature · 1 line
1.7.9.5