aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong.Lu@windriver.com <Chong.Lu@windriver.com>2014-09-29 16:22:54 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2014-10-16 07:00:59 +0200
commit91939fda6ba7546d2e24730a1a225691015231b6 (patch)
tree9718f23775733883d8026a1144a43a5a4542795d
parentd1951db22a9971a1bb7cf25810ec3bdc9669a6f1 (diff)
downloadmeta-openembedded-91939fda6ba7546d2e24730a1a225691015231b6.tar.gz
meta-openembedded-91939fda6ba7546d2e24730a1a225691015231b6.tar.bz2
meta-openembedded-91939fda6ba7546d2e24730a1a225691015231b6.zip
samba: add systemd service file
Add systemd service for samba. Signed-off-by: Chong Lu <Chong.Lu@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r--meta-oe/recipes-connectivity/samba/samba.inc32
-rw-r--r--meta-oe/recipes-connectivity/samba/samba/nmb.service12
-rw-r--r--meta-oe/recipes-connectivity/samba/samba/smb.service13
-rw-r--r--meta-oe/recipes-connectivity/samba/samba/winbind.service12
4 files changed, 68 insertions, 1 deletions
diff --git a/meta-oe/recipes-connectivity/samba/samba.inc b/meta-oe/recipes-connectivity/samba/samba.inc
index 3da056223..439282166 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 000000000..91b997533
--- /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 000000000..bc0707a34
--- /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 000000000..bff6fb8e1
--- /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