Skip to contentSkip to conversation

docker: fix broken init script

PATCH In review Ting Yu 2 participants 2 messages Nov 27, 2018 – Nov 29, 2018

lore
Share & tools
lore

Ting Yu

author
#0 lore raw

PATCH 1/1 docker: fix broken init script

From: Chin Huat Ang <[email protected]>

Fix numerous docker.init issues such as missing runtime dependency util-linux-unshare, incomplete handling of start/stop etc. operations and minor typos.

---
 recipes-containers/docker/docker-ce_git.bb  |  2 +-
 recipes-containers/docker/docker_git.bb     |  2 +-
 recipes-containers/docker/files/docker.init | 12 ++++++++----
 3 files changed, 10 insertions(+), 6 deletions(-)
recipes-containers/docker/docker-ce_git.bb +1 -1
index 7a41850..caf6d70 100644
@@ -62,7 +62,7 @@ DEPENDS = " \
 PACKAGES =+ "${PN}-contrib"
 
 DEPENDS_append_class-target = " lvm2"
-RDEPENDS_${PN} = "util-linux iptables \
+RDEPENDS_${PN} = "util-linux util-linux-unshare iptables \
                   ${@bb.utils.contains('DISTRO_FEATURES', 'aufs', 'aufs-util', '', d)} \
                   ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'cgroup-lite', d)} \
                  "
recipes-containers/docker/docker_git.bb +1 -1
index f63cee1..7957808 100644
@@ -67,7 +67,7 @@ PACKAGECONFIG[seccomp] = "seccomp,,libseccomp"
 PACKAGES =+ "${PN}-contrib"
 
 DEPENDS_append_class-target = " lvm2"
-RDEPENDS_${PN} = "util-linux iptables \
+RDEPENDS_${PN} = "util-linux util-linux-unshare iptables \
                   ${@bb.utils.contains('DISTRO_FEATURES', 'aufs', 'aufs-util', '', d)} \
                   ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'cgroup-lite', d)} \
                  "
recipes-containers/docker/files/docker.init +8 -4
index 2e8eb9e..0aea8d0 100644
@@ -22,7 +22,7 @@
 # Source function library.
 . /etc/init.d/functions
 
-prog="docker"
+prog="dockerd"
 unshare=/usr/bin/unshare
 exec="/usr/bin/$prog"
 pidfile="/var/run/$prog.pid"
@@ -40,7 +40,7 @@ start() {
     if ! [ -f $pidfile ]; then
         printf "Starting $prog:\t"
         echo -e "\n$(date)\n" >> $logfile
-        "$unshare" -m -- $exec daemon $other_args &>> $logfile &
+        "$unshare" -m -- $exec $other_args &>> $logfile &
         pid=$!
         touch $lockfile
         # wait up to 10 seconds for the pidfile to exist.  see
@@ -83,7 +83,7 @@ force_reload() {
 }
 
 rh_status() {
-    status -p $pidfile $prog
+    status $prog
 }
 
 rh_status_q() {
@@ -99,24 +99,28 @@ check_for_cleanup() {
 
 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)
-        status
+        rh_status
         ;;
     condrestart|try-restart)
+        rh_status_q || exit 0
         restart
         ;;
     *)
Signature · 1 line
2.19.1
#1 lore raw

I tried to apply this on master, and it fails. Which branch is this against ?

We should do two patches in a scenario like this: 1) fix it on master
2) request a backport, or do a version for other branches.

Since we don't only want fixes in already released branches.

Quoted 8 lines · Ting Yu

From: Chin Huat Ang <[email protected]>

Fix numerous docker.init issues such as missing runtime dependency util-linux-unshare, incomplete handling of start/stop etc. operations and minor typos.

Since we'll need a v2, I can offer some tips here.

Drop my Signed-off-by:, I'll add it when merging the change. And add your Signed-off-by: since you are sending the change on behalf of the author.

Cheers,

Bruce

Quoted 94 lines
---
  recipes-containers/docker/docker-ce_git.bb  |  2 +-
  recipes-containers/docker/docker_git.bb     |  2 +-
  recipes-containers/docker/files/docker.init | 12 ++++++++----
  3 files changed, 10 insertions(+), 6 deletions(-)
recipes-containers/docker/docker-ce_git.bb +1 -1
index 7a41850..caf6d70 100644
@@ -62,7 +62,7 @@ DEPENDS = " \
  PACKAGES =+ "${PN}-contrib"
 
  DEPENDS_append_class-target = " lvm2"
-RDEPENDS_${PN} = "util-linux iptables \
+RDEPENDS_${PN} = "util-linux util-linux-unshare iptables \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'aufs', 'aufs-util', '', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'cgroup-lite', d)} \
                   "
recipes-containers/docker/docker_git.bb +1 -1
index f63cee1..7957808 100644
@@ -67,7 +67,7 @@ PACKAGECONFIG[seccomp] = "seccomp,,libseccomp"
  PACKAGES =+ "${PN}-contrib"
 
  DEPENDS_append_class-target = " lvm2"
-RDEPENDS_${PN} = "util-linux iptables \
+RDEPENDS_${PN} = "util-linux util-linux-unshare iptables \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'aufs', 'aufs-util', '', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'cgroup-lite', d)} \
                   "
recipes-containers/docker/files/docker.init +8 -4
index 2e8eb9e..0aea8d0 100644
@@ -22,7 +22,7 @@
  # Source function library.
  . /etc/init.d/functions
 
-prog="docker"
+prog="dockerd"
  unshare=/usr/bin/unshare
  exec="/usr/bin/$prog"
  pidfile="/var/run/$prog.pid"
@@ -40,7 +40,7 @@ start() {
      if ! [ -f $pidfile ]; then
          printf "Starting $prog:\t"
          echo -e "\n$(date)\n" >> $logfile
-        "$unshare" -m -- $exec daemon $other_args &>> $logfile &
+        "$unshare" -m -- $exec $other_args &>> $logfile &
          pid=$!
          touch $lockfile
          # wait up to 10 seconds for the pidfile to exist.  see
@@ -83,7 +83,7 @@ force_reload() {
  }
 
  rh_status() {
-    status -p $pidfile $prog
+    status $prog
  }
 
  rh_status_q() {
@@ -99,24 +99,28 @@ check_for_cleanup() {
 
  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)
-        status
+        rh_status
          ;;
      condrestart|try-restart)
+        rh_status_q || exit 0
          restart
          ;;
      *)