[docker-io: 7/14] remove xinetd in favor of sysvinit

Lokesh Mandvekar lsm5 at fedoraproject.org
Thu Nov 28 06:44:08 UTC 2013


commit 1e67a79f6fcff2eba054e8903e8b7a5e9f491cf4
Author: Adam Miller <admiller at redhat.com>
Date:   Sat Nov 23 01:54:00 2013 -0600

    remove xinetd in favor of sysvinit

 docker-io.spec   |   33 +++++++++-----
 docker.sysconfig |    1 +
 docker.sysvinit  |  121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 docker.xinetd    |   11 -----
 4 files changed, 143 insertions(+), 23 deletions(-)
---
diff --git a/docker-io.spec b/docker-io.spec
index d04df3e..b171053 100644
--- a/docker-io.spec
+++ b/docker-io.spec
@@ -11,7 +11,7 @@
 
 Name:           docker-io
 Version:        0.7
-Release:        0.17.rc6%{?dist}
+Release:        0.18.rc6%{?dist}
 Summary:        Automates deployment of containerized applications
 License:        ASL 2.0
 
@@ -23,9 +23,10 @@ URL:            http://www.docker.io
 ExclusiveArch:  x86_64
 Source0:        https://github.com/dotcloud/docker/archive/%{commit}/docker-%{shortcommit}.tar.gz
 Source1:        docker.service
-# though final name for xinetd file is simply 'docker',
-# having .xinetd makes things clear
-Source2:        docker.xinetd
+# though final name for sysconf/sysvinit files is simply 'docker',
+# having .sysvinit and .sysconfig makes things clear
+Source2:        docker.sysconfig
+Source3:        docker.sysvinit
 BuildRequires:  gcc
 BuildRequires:  glibc-static
 BuildRequires:  golang(github.com/gorilla/mux)
@@ -38,7 +39,8 @@ BuildRequires:  python-sphinxcontrib-httpdomain
 BuildRequires:  pkgconfig(systemd)
 Requires:       systemd-units
 %else
-Requires:       xinetd
+Requires(post): chkconfig
+Requires(preun): chkconfig
 %endif
 Requires:       lxc
 Requires:       tar
@@ -101,8 +103,10 @@ install -p -m 644 contrib/completion/zsh/_docker %{buildroot}%{_datadir}/zsh/sit
 install -d %{buildroot}%{_unitdir}
 install -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}
 %else
-install -d %{buildroot}%{_sysconfdir}/xinetd.d
-install -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/xinetd.d/docker
+install -d %{buildroot}%{_sysconfdir}/sysconfig/
+install -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/docker
+install -d %{buildroot}%{_initddir}
+install -p -m 755 %{SOURCE3} %{buildroot}%{_initddir}/docker
 %endif
 
 %pre
@@ -112,20 +116,22 @@ exit 0
 %post
 %if %{with systemd}
 %systemd_post %{SOURCE1}
+%else
+# install but don't activate
+/sbin/chkconfig --add docker
 %endif
 
 %preun
 %if %{with systemd}
 %systemd_preun %{SOURCE1}
-%else
-if [ $1 -eq 0 ]; then
-    /sbin/service xinetd condrestart > /dev/null 2>&1
-fi
 %endif
 
 %postun
 %if %{with systemd}
 %systemd_postun_with_restart %{SOURCE1}
+%else
+%{_initrddir}/docker stop >/dev/null 2>&1
+/sbin/chkconfig --del docker
 %endif
 
 %files
@@ -138,7 +144,8 @@ fi
 %if %{with systemd}
 %{_unitdir}/docker.service
 %else
-%config(noreplace) %{_sysconfdir}/xinetd.d/docker
+%config(noreplace) %{_sysconfdir}/sysconfig/docker
+%{_initddir}/docker
 %endif
 %dir %{_sysconfdir}/bash_completion.d
 %{_sysconfdir}/bash_completion.d/docker.bash
@@ -146,6 +153,8 @@ fi
 %dir %{_sharedstatedir}/docker
 
 %changelog
+* Fri Nov 22 2013 Adam Miller <maxamillion at fedoraproject.org> - 0.7-0.18.rc6
+- Remove xinetd entry, added sysvinit
 * Wed Nov 20 2013 Lokesh Mandvekar <lsm5 at redhat.com> - 0.7-0.17.rc6
 - removed ExecStartPost lines from docker.service (BZ #1026045)
 - dockerinit listed in files
diff --git a/docker.sysconfig b/docker.sysconfig
new file mode 100644
index 0000000..dbb3944
--- /dev/null
+++ b/docker.sysconfig
@@ -0,0 +1 @@
+other_args="-b none"
diff --git a/docker.sysvinit b/docker.sysvinit
new file mode 100644
index 0000000..d3c29a8
--- /dev/null
+++ b/docker.sysvinit
@@ -0,0 +1,121 @@
+#!/bin/sh
+#
+#       /etc/rc.d/init.d/docker
+#
+#       Daemon for docker.io
+#       
+# chkconfig:   2345 95 95
+# description: Daemon for docker.io
+
+### BEGIN INIT INFO
+# Provides:       docker
+# Required-Start: $network 
+# Required-Stop:
+# Should-Start:
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop:  0 1 6
+# Short-Description: start and stop docker
+# Description: Daemon for docker.io
+### END INIT INFO
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/bin/docker"
+prog="docker"
+pidfile="/var/run/$prog.pid"
+lockfile="/var/lock/subsys/$prog"
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+prestart() {
+
+    preexec="/sbin/sysctl"
+    [ -x $preexec ] || exit 6
+    $preexec -w net.ipv4.ip_forward=1 > /dev/null 2>&1
+    $preexec -w net.ipv6.conf.all.forwarding=1 > /dev/null 2>&1
+
+}
+
+start() {
+    [ -x $exec ] || exit 5
+
+    if ! [ -f $pidfile ]; then
+        prestart
+        printf "Starting $prog:\t"
+        $exec -d $other_args 1>/dev/null 2>&1 &
+        pid=$!
+        touch $lockfile
+        success
+        echo
+    else
+        failure
+        echo
+        printf "$pidfile still exists...\n"
+        exit 7
+    fi
+}
+
+stop() {
+    echo -n $"Stopping $prog: "
+    killproc -p $pidfile $prog
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+    restart
+}
+
+force_reload() {
+    restart
+}
+
+rh_status() {
+    status -p $pidfile $prog
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        rh_status_q || exit 7
+        $1
+        ;;
+    force-reload)
+        force_reload
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+        exit 2
+esac
+
+exit $?


More information about the scm-commits mailing list