aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-01-19 12:33:29 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-01-19 12:33:29 +0000
commitcceeeee0a2f1c6a11ed05cb9518887a1d4a319be (patch)
tree53cd882b61f1b70cdb0188986580c1d97e7760d7 /main
parent3501a750925f630855836e5dc1c5f0b460610819 (diff)
downloadaports-cceeeee0a2f1c6a11ed05cb9518887a1d4a319be.tar.bz2
aports-cceeeee0a2f1c6a11ed05cb9518887a1d4a319be.tar.xz
main/samba: sync init.d script with gentoo
ref #943
Diffstat (limited to 'main')
-rw-r--r--main/samba/APKBUILD4
-rw-r--r--main/samba/samba.initd94
2 files changed, 46 insertions, 52 deletions
diff --git a/main/samba/APKBUILD b/main/samba/APKBUILD
index 98c747f8b6..2463f5bfbe 100644
--- a/main/samba/APKBUILD
+++ b/main/samba/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=samba
pkgver=3.6.1
-pkgrel=1
+pkgrel=2
pkgdesc="Tools to access a server's filespace and printers via SMB"
url="http://www.samba.org"
arch="all"
@@ -154,6 +154,6 @@ client() {
md5sums="5291717be0734e07dc07b6110e162e87 samba-3.6.1.tar.gz
-c8a7f6ac5df2f73dbf023e25ea39927b samba.initd
+f0b8d460ad4af28266ac8bc1d6fa0d31 samba.initd
c150433426e18261e6e3eed3930e1a76 samba.confd
b7cafabfb4fa5b3ab5f2e857d8d1c733 samba.logrotate"
diff --git a/main/samba/samba.initd b/main/samba/samba.initd
index f7290173f8..6fd817da06 100644
--- a/main/samba/samba.initd
+++ b/main/samba/samba.initd
@@ -1,65 +1,59 @@
#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/files/3.6/samba.initd,v 1.3 2011/09/14 22:52:33 polynomial-c Exp $
-opts="reload"
-
-DAEMON=${SVCNAME#samba.}
-if [ "$DAEMON" != "samba" ]; then
- daemon_list=$DAEMON
-fi
+extra_started_commands="reload"
depend() {
+ after slapd firewall
need net
- after firewall
-}
-
-start_smbd() {
- start-stop-daemon --start --quiet --exec /usr/sbin/smbd -- \
- ${smbd_options:-"-D"}
-}
-
-stop_smbd() {
- start-stop-daemon --stop --quiet --pidfile /var/run/samba/smbd.pid
-}
-
-start_nmbd() {
- start-stop-daemon --start --quiet --exec /usr/sbin/nmbd -- \
- ${nmbd_options:-"-D"}
-}
-
-stop_nmbd() {
- start-stop-daemon --stop --quiet --pidfile /var/run/samba/nmbd.pid
-}
-
-start_winbindd() {
- start-stop-daemon --start --quiet --exec /usr/sbin/winbindd -- \
- $winbindd_options
+ use cupsd
+}
+
+DAEMONNAME="${SVCNAME##samba.}"
+[ "${DAEMONNAME}" != "samba" ] && daemon_list=${DAEMONNAME}
+
+signal_do() {
+ local signal="$1"
+ [ -z "${signal}" ] && return 0
+
+ local result=0 last_result=0 daemon= cmd_exec=
+ for daemon in ${daemon_list} ; do
+ eval cmd_exec=\$${daemon}_${signal}
+ if [ -n "${cmd_exec}" ]; then
+ ebegin "${my_service_name} -> ${signal}: ${daemon}"
+ #echo ${cmd} '->' ${!cmd}
+ ${cmd_exec} > /dev/null
+ last_result=$?
+ eend ${last_result}
+ fi
+ result=$(( ${result} + ${last_result} ))
+ done
+ return ${result}
}
-stop_winbindd() {
- start-stop-daemon --stop --quiet --pidfile /var/run/samba/winbindd.pid
+mkdir_sambadirs() {
+ [ -d /var/run/samba ] || mkdir -p /var/run/samba
}
start() {
- for i in $daemon_list; do
- ebegin "Starting $i"
- start_$i
- eend $?
- done
+ ${my_service_PRE}
+ mkdir_sambadirs
+ signal_do start && return 0
+
+ eerror "Error: starting services (see system logs)"
+ signal_do stop
+ return 1
}
-
stop() {
- for i in $daemon_list; do
- ebegin "Stopping $i"
- stop_$i
- eend $?
- done
+ ${my_service_PRE}
+ if signal_do stop ; then
+ ${my_service_POST}
+ return 0
+ fi
}
-
reload() {
- for i in $daemon_list; do
- ebegin "Reloading $i"
- killall -HUP $i
- eend $?
- done
+ ${my_service_PRE}
+ signal_do reload
}
-