From: Chong Lu <Chong.Lu@windriver.com>
To: <openembedded-devel@lists.openembedded.org>
Subject: Re: [meta-oe][PATCH] samba: add systemd service file
Date: Thu, 9 Oct 2014 15:04:43 +0800 [thread overview]
Message-ID: <5436338B.10408@windriver.com> (raw)
In-Reply-To: <1411978974-17996-1-git-send-email-Chong.Lu@windriver.com>
ping
//Chong
On 09/29/2014 04:22 PM, Chong Lu wrote:
> Add systemd service for samba.
>
> Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
> ---
> meta-oe/recipes-connectivity/samba/samba.inc | 32 +++++++++++++++++++++-
> .../recipes-connectivity/samba/samba/nmb.service | 12 ++++++++
> .../recipes-connectivity/samba/samba/smb.service | 13 +++++++++
> .../samba/samba/winbind.service | 12 ++++++++
> 4 files changed, 68 insertions(+), 1 deletion(-)
> create mode 100644 meta-oe/recipes-connectivity/samba/samba/nmb.service
> create mode 100644 meta-oe/recipes-connectivity/samba/samba/smb.service
> create mode 100644 meta-oe/recipes-connectivity/samba/samba/winbind.service
>
> diff --git a/meta-oe/recipes-connectivity/samba/samba.inc b/meta-oe/recipes-connectivity/samba/samba.inc
> index 3da0562..4392821 100644
> --- a/meta-oe/recipes-connectivity/samba/samba.inc
> +++ b/meta-oe/recipes-connectivity/samba/samba.inc
> @@ -8,11 +8,18 @@ SRC_URI = "http://samba.org/samba/ftp/stable/samba-${PV}.tar.gz \
> file://init.samba \
> file://init.winbind \
> file://tdb.pc \
> + file://nmb.service \
> + file://smb.service \
> + file://winbind.service \
> "
>
> S = "${WORKDIR}/samba-${PV}/source"
>
> -inherit autotools-brokensep update-rc.d
> +inherit autotools-brokensep update-rc.d systemd
> +
> +SYSTEMD_PACKAGES = "${PN} winbind"
> +SYSTEMD_SERVICE_${PN} = "nmb.service smb.service"
> +SYSTEMD_SERVICE_winbind = "winbind.service"
>
> SAMBAMMAP = "no"
> SAMBAMMAP_libc-glibc = "yes"
> @@ -103,6 +110,29 @@ do_install_append() {
>
> # usershare mount place
> mkdir -p ${D}${localstatedir}/lib/samba/usershares
> +
> + # Remove sysinit script if sysvinit is not in DISTRO_FEATURES
> + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
> + rm -rf ${D}${sysconfdir}/init.d/
> + fi
> +
> + install -d ${D}${systemd_unitdir}/system
> + for i in nmb smb winbind; do
> + install -m 0644 ${WORKDIR}/$i.service ${D}${systemd_unitdir}/system
> + done
> + sed -e 's,@BASE_BINDIR@,${base_bindir},g' \
> + -e 's,@SBINDIR@,${sbindir},g' \
> + -i ${D}${systemd_unitdir}/system/*.service
> +}
> +
> +DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
> +pkg_postinst_${PN} () {
> + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then
> + if [ -n "$D" ]; then
> + OPTS="--root=$D"
> + fi
> + systemctl $OPTS mask samba.service
> + fi
> }
>
> pkg_postinst_libnss-winbind () {
> diff --git a/meta-oe/recipes-connectivity/samba/samba/nmb.service b/meta-oe/recipes-connectivity/samba/samba/nmb.service
> new file mode 100644
> index 0000000..91b9975
> --- /dev/null
> +++ b/meta-oe/recipes-connectivity/samba/samba/nmb.service
> @@ -0,0 +1,12 @@
> +[Unit]
> +Description=Samba NMB Daemon
> +After=syslog.target network.target
> +
> +[Service]
> +Type=forking
> +PIDFile=/var/run/nmbd.pid
> +ExecStart=@SBINDIR@/nmbd
> +ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
> +
> +[Install]
> +WantedBy=multi-user.target
> diff --git a/meta-oe/recipes-connectivity/samba/samba/smb.service b/meta-oe/recipes-connectivity/samba/samba/smb.service
> new file mode 100644
> index 0000000..bc0707a
> --- /dev/null
> +++ b/meta-oe/recipes-connectivity/samba/samba/smb.service
> @@ -0,0 +1,13 @@
> +[Unit]
> +Description=Samba SMB Daemon
> +After=syslog.target network.target nmb.service winbind.service
> +
> +[Service]
> +Type=forking
> +PIDFile=/var/run/smbd.pid
> +LimitNOFILE=16384
> +ExecStart=@SBINDIR@/smbd
> +ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
> +
> +[Install]
> +WantedBy=multi-user.target
> diff --git a/meta-oe/recipes-connectivity/samba/samba/winbind.service b/meta-oe/recipes-connectivity/samba/samba/winbind.service
> new file mode 100644
> index 0000000..bff6fb8
> --- /dev/null
> +++ b/meta-oe/recipes-connectivity/samba/samba/winbind.service
> @@ -0,0 +1,12 @@
> +i[Unit]
> +Description=Samba Winbind Daemon
> +After=syslog.target network.target nmb.service
> +
> +[Service]
> +Type=forking
> +PIDFile=/var/run/winbindd.pid
> +ExecStart=@SBINDIR@/winbindd
> +ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
> +
> +[Install]
> +WantedBy=multi-user.target
next prev parent reply other threads:[~2014-10-09 7:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-29 8:22 [meta-oe][PATCH] samba: add systemd service file Chong Lu
2014-10-09 7:04 ` Chong Lu [this message]
2014-10-14 8:02 ` Chong Lu
2014-10-14 9:39 ` Martin Jansa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5436338B.10408@windriver.com \
--to=chong.lu@windriver.com \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox