docker: fix broken init script

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

Signed-off-by: Chin Huat Ang <chin.huat.ang@intel.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
This commit is contained in:
Chin Huat Ang 2018-11-16 09:31:15 +08:00 committed by Bruce Ashfield
parent b74c0d4ec2
commit 4ef7f8b758
3 changed files with 10 additions and 6 deletions

View File

@ -62,7 +62,7 @@ DEPENDS = " \
PACKAGES =+ "${PN}-contrib" PACKAGES =+ "${PN}-contrib"
DEPENDS_append_class-target = " lvm2" 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', 'aufs', 'aufs-util', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'cgroup-lite', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'cgroup-lite', d)} \
" "

View File

@ -67,7 +67,7 @@ PACKAGECONFIG[seccomp] = "seccomp,,libseccomp"
PACKAGES =+ "${PN}-contrib" PACKAGES =+ "${PN}-contrib"
DEPENDS_append_class-target = " lvm2" 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', 'aufs', 'aufs-util', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'cgroup-lite', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'cgroup-lite', d)} \
" "

View File

@ -22,7 +22,7 @@
# Source function library. # Source function library.
. /etc/init.d/functions . /etc/init.d/functions
prog="docker" prog="dockerd"
unshare=/usr/bin/unshare unshare=/usr/bin/unshare
exec="/usr/bin/$prog" exec="/usr/bin/$prog"
pidfile="/var/run/$prog.pid" pidfile="/var/run/$prog.pid"
@ -40,7 +40,7 @@ start() {
if ! [ -f $pidfile ]; then if ! [ -f $pidfile ]; then
printf "Starting $prog:\t" printf "Starting $prog:\t"
echo -e "\n$(date)\n" >> $logfile echo -e "\n$(date)\n" >> $logfile
"$unshare" -m -- $exec daemon $other_args &>> $logfile & "$unshare" -m -- $exec $other_args &>> $logfile &
pid=$! pid=$!
touch $lockfile touch $lockfile
# wait up to 10 seconds for the pidfile to exist. see # wait up to 10 seconds for the pidfile to exist. see
@ -83,7 +83,7 @@ force_reload() {
} }
rh_status() { rh_status() {
status -p $pidfile $prog status $prog
} }
rh_status_q() { rh_status_q() {
@ -99,24 +99,28 @@ check_for_cleanup() {
case "$1" in case "$1" in
start) start)
rh_status_q && exit 0
$1 $1
;; ;;
stop) stop)
rh_status_q || exit 0
$1 $1
;; ;;
restart) restart)
$1 $1
;; ;;
reload) reload)
rh_status_q || exit 7
$1 $1
;; ;;
force-reload) force-reload)
force_reload force_reload
;; ;;
status) status)
status rh_status
;; ;;
condrestart|try-restart) condrestart|try-restart)
rh_status_q || exit 0
restart restart
;; ;;
*) *)