summaryrefslogtreecommitdiffstats
path: root/external/meta-virtualization/recipes-containers/docker
diff options
context:
space:
mode:
Diffstat (limited to 'external/meta-virtualization/recipes-containers/docker')
-rw-r--r--external/meta-virtualization/recipes-containers/docker/docker-ce_git.bb167
-rw-r--r--external/meta-virtualization/recipes-containers/docker/docker_git.bb173
-rw-r--r--external/meta-virtualization/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch59
-rw-r--r--external/meta-virtualization/recipes-containers/docker/files/docker-registry.service19
-rw-r--r--external/meta-virtualization/recipes-containers/docker/files/docker.init131
5 files changed, 549 insertions, 0 deletions
diff --git a/external/meta-virtualization/recipes-containers/docker/docker-ce_git.bb b/external/meta-virtualization/recipes-containers/docker/docker-ce_git.bb
new file mode 100644
index 00000000..caf6d704
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/docker/docker-ce_git.bb
@@ -0,0 +1,167 @@
+HOMEPAGE = "http://www.docker.com"
+SUMMARY = "Linux container runtime"
+DESCRIPTION = "Linux container runtime \
+ Docker complements kernel namespacing with a high-level API which \
+ operates at the process level. It runs unix processes with strong \
+ guarantees of isolation and repeatability across servers. \
+ . \
+ Docker is a great building block for automating distributed systems: \
+ large-scale web deployments, database clusters, continuous deployment \
+ systems, private PaaS, service-oriented architectures, etc. \
+ . \
+ This package contains the daemon and client. Using docker.io is \
+ officially supported on x86_64 and arm (32-bit) hosts. \
+ Other architectures are considered experimental. \
+ . \
+ Also, note that kernel version 3.10 or above is required for proper \
+ operation of the daemon process, and that any lower versions may have \
+ subtle and/or glaring issues. \
+ "
+
+SRCREV_docker = "6e632f7fc395d15bce46f426086e91c01598cf59"
+SRCREV_libnetwork = "6da50d1978302f04c3e2089e29112ea24812f05b"
+SRC_URI = "\
+ git://github.com/docker/docker-ce.git;branch=18.09;name=docker \
+ git://github.com/docker/libnetwork.git;branch=bump_18.09;name=libnetwork;destsuffix=git/libnetwork \
+ file://docker.init \
+ "
+
+# Apache-2.0 for docker
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/import/components/engine/LICENSE;md5=9740d093a080530b5c5c6573df9af45a"
+
+GO_IMPORT = "import"
+
+S = "${WORKDIR}/git"
+
+DOCKER_VERSION = "18.09.0-ce"
+PV = "${DOCKER_VERSION}+git${SRCREV_docker}"
+
+DEPENDS = " \
+ go-cli \
+ go-pty \
+ go-context \
+ go-mux \
+ go-patricia \
+ go-logrus \
+ go-fsnotify \
+ go-dbus \
+ go-capability \
+ go-systemd \
+ btrfs-tools \
+ sqlite3 \
+ go-distribution \
+ compose-file \
+ go-connections \
+ notary \
+ grpc-go \
+ libtool-native \
+ libtool \
+ "
+
+PACKAGES =+ "${PN}-contrib"
+
+DEPENDS_append_class-target = " lvm2"
+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)} \
+ "
+RDEPENDS_${PN} += "virtual/containerd virtual/runc"
+
+RRECOMMENDS_${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat"
+RSUGGESTS_${PN} = "lxc rt-tests"
+DOCKER_PKG="github.com/docker/docker"
+
+inherit systemd update-rc.d
+inherit go
+inherit goarch
+inherit pkgconfig
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ # Set GOPATH. See 'PACKAGERS.md'. Don't rely on
+ # docker to download its dependencies but rather
+ # use dependencies packaged independently.
+ cd ${S}/src/import
+ rm -rf .gopath
+ mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")"
+ ln -sf ../../../../components/engine/ .gopath/src/"${DOCKER_PKG}"
+
+ mkdir -p .gopath/src/github.com/docker
+ ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork
+ ln -sf ${S}/src/import/components/cli .gopath/src/github.com/docker/cli
+
+ export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
+ export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
+
+ # Pass the needed cflags/ldflags so that cgo
+ # can find the needed headers files and libraries
+ export GOARCH=${TARGET_GOARCH}
+ export CGO_ENABLED="1"
+ export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ # in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056
+ export DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdriver_devicemapper'
+
+ export DISABLE_WARN_OUTSIDE_CONTAINER=1
+
+ cd ${S}/src/import/components/engine
+
+ # this is the unsupported build structure
+ # that doesn't rely on an existing docker
+ # to build this:
+ VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" ./hack/make.sh dynbinary
+
+ # build the proxy
+ cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork
+ oe_runmake cross-local
+
+ # build the cli
+ cd ${S}/src/import/components/cli
+ export CFLAGS=""
+ export LDFLAGS=""
+ export DOCKER_VERSION=${DOCKER_VERSION}
+ VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary
+}
+
+SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
+SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.service','',d)}"
+SYSTEMD_AUTO_ENABLE_${PN} = "enable"
+
+INITSCRIPT_PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}"
+INITSCRIPT_NAME_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','docker.init','',d)}"
+INITSCRIPT_PARAMS_${PN} = "defaults"
+
+do_install() {
+ mkdir -p ${D}/${bindir}
+ cp ${S}/src/import/components/cli/build/docker ${D}/${bindir}/docker
+ cp ${S}/src/import/components/engine/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
+ cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy
+
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -d ${D}${systemd_unitdir}/system
+ install -m 644 ${S}/src/import/components/engine/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system
+ # replaces one copied from above with one that uses the local registry for a mirror
+ install -m 644 ${S}/src/import/components/engine/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system
+ else
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init
+ fi
+
+ mkdir -p ${D}${datadir}/docker/
+ install -m 0755 ${S}/src/import/components/engine/contrib/check-config.sh ${D}${datadir}/docker/
+}
+
+inherit useradd
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "-r docker"
+
+FILES_${PN} += "${systemd_unitdir}/system/*"
+
+FILES_${PN}-contrib += "${datadir}/docker/check-config.sh"
+RDEPENDS_${PN}-contrib += "bash"
+
+# DO NOT STRIP docker
+INHIBIT_PACKAGE_STRIP = "1"
+INSANE_SKIP_${PN} += "ldflags"
diff --git a/external/meta-virtualization/recipes-containers/docker/docker_git.bb b/external/meta-virtualization/recipes-containers/docker/docker_git.bb
new file mode 100644
index 00000000..79578083
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/docker/docker_git.bb
@@ -0,0 +1,173 @@
+HOMEPAGE = "http://www.docker.com"
+SUMMARY = "Linux container runtime"
+DESCRIPTION = "Linux container runtime \
+ Docker complements kernel namespacing with a high-level API which \
+ operates at the process level. It runs unix processes with strong \
+ guarantees of isolation and repeatability across servers. \
+ . \
+ Docker is a great building block for automating distributed systems: \
+ large-scale web deployments, database clusters, continuous deployment \
+ systems, private PaaS, service-oriented architectures, etc. \
+ . \
+ This package contains the daemon and client. Using docker.io is \
+ officially supported on x86_64 and arm (32-bit) hosts. \
+ Other architectures are considered experimental. \
+ . \
+ Also, note that kernel version 3.10 or above is required for proper \
+ operation of the daemon process, and that any lower versions may have \
+ subtle and/or glaring issues. \
+ "
+
+SRCREV_docker = "489b8eda6674523df8b82a210399b7d2954427d0"
+SRCREV_libnetwork = "6da50d1978302f04c3e2089e29112ea24812f05b"
+SRCREV_cli = "51668a30f26250ccfce31bcc13d9334eaafabe36"
+SRC_URI = "\
+ git://github.com/moby/moby.git;nobranch=1;name=docker \
+ git://github.com/docker/libnetwork.git;branch=bump_18.09;name=libnetwork;destsuffix=git/libnetwork \
+ git://github.com/docker/cli;branch=18.09;name=cli;destsuffix=git/cli \
+ file://docker.init \
+ file://0001-libnetwork-use-GO-instead-of-go.patch \
+ "
+
+# Apache-2.0 for docker
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=4859e97a9c7780e77972d989f0823f28"
+
+GO_IMPORT = "import"
+
+S = "${WORKDIR}/git"
+
+DOCKER_VERSION = "18.09.0"
+PV = "${DOCKER_VERSION}+git${SRCREV_docker}"
+
+DEPENDS = " \
+ go-cli \
+ go-pty \
+ go-context \
+ go-mux \
+ go-patricia \
+ go-logrus \
+ go-fsnotify \
+ go-dbus \
+ go-capability \
+ go-systemd \
+ btrfs-tools \
+ sqlite3 \
+ go-distribution \
+ compose-file \
+ go-connections \
+ notary \
+ grpc-go \
+ libtool \
+ "
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[seccomp] = "seccomp,,libseccomp"
+
+PACKAGES =+ "${PN}-contrib"
+
+DEPENDS_append_class-target = " lvm2"
+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)} \
+ "
+RDEPENDS_${PN} += "virtual/containerd virtual/runc"
+
+RRECOMMENDS_${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat docker-init"
+RSUGGESTS_${PN} = "lxc rt-tests"
+DOCKER_PKG="github.com/docker/docker"
+
+inherit systemd update-rc.d
+inherit go
+inherit goarch
+inherit pkgconfig
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ # Set GOPATH. See 'PACKAGERS.md'. Don't rely on
+ # docker to download its dependencies but rather
+ # use dependencies packaged independently.
+ cd ${S}/src/import
+ rm -rf .gopath
+ mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")"
+ ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
+
+ mkdir -p .gopath/src/github.com/docker
+ ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork
+ ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli
+
+ export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
+ export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
+
+ # Pass the needed cflags/ldflags so that cgo
+ # can find the needed headers files and libraries
+ export GOARCH=${TARGET_GOARCH}
+ export CGO_ENABLED="1"
+ export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ # in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056
+ export DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdriver_devicemapper ${PACKAGECONFIG_CONFARGS}'
+
+ export DISABLE_WARN_OUTSIDE_CONTAINER=1
+
+ cd ${S}/src/import/
+
+ # this is the unsupported built structure
+ # that doesn't rely on an existing docker
+ # to build this:
+ VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" ./hack/make.sh dynbinary
+
+ # build the cli
+ cd ${S}/src/import/.gopath/src/github.com/docker/cli
+ export CFLAGS=""
+ export LDFLAGS=""
+ export DOCKER_VERSION=${DOCKER_VERSION}
+ VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary
+
+ # build the proxy
+ cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork
+ oe_runmake cross-local
+}
+
+SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
+SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.service','',d)}"
+
+SYSTEMD_AUTO_ENABLE_${PN} = "enable"
+
+INITSCRIPT_PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}"
+INITSCRIPT_NAME_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','docker.init','',d)}"
+INITSCRIPT_PARAMS_${PN} = "defaults"
+
+do_install() {
+ mkdir -p ${D}/${bindir}
+ cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker
+ cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
+ cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy
+
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -d ${D}${systemd_unitdir}/system
+ install -m 644 ${S}/src/import/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system
+ # replaces one copied from above with one that uses the local registry for a mirror
+ install -m 644 ${S}/src/import/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system
+ else
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init
+ fi
+
+ mkdir -p ${D}${datadir}/docker/
+ install -m 0755 ${S}/src/import/contrib/check-config.sh ${D}${datadir}/docker/
+}
+
+inherit useradd
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "-r docker"
+
+FILES_${PN} += "${systemd_unitdir}/system/*"
+
+FILES_${PN}-contrib += "${datadir}/docker/check-config.sh"
+RDEPENDS_${PN}-contrib += "bash"
+
+# DO NOT STRIP docker
+INHIBIT_PACKAGE_STRIP = "1"
+INSANE_SKIP_${PN} += "ldflags textrel"
diff --git a/external/meta-virtualization/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch b/external/meta-virtualization/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch
new file mode 100644
index 00000000..c623b260
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch
@@ -0,0 +1,59 @@
+From 04c07804930faad708218a3134c81de06a9c742a Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@windriver.com>
+Date: Fri, 6 Apr 2018 23:58:22 -0400
+Subject: [PATCH] libnetwork: use $(GO) instead of go
+
+Ensure that the libnetwork makefile uses the go cross flags and
+utilities.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
+---
+ Makefile | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+Index: git/libnetwork/Makefile
+===================================================================
+--- git.orig/libnetwork/Makefile
++++ git/libnetwork/Makefile
+@@ -45,9 +45,9 @@
+ build-local:
+ @echo "🐳 $@"
+ @mkdir -p "bin"
+- go build -tags experimental -o "bin/dnet" ./cmd/dnet
+- go build -o "bin/docker-proxy" ./cmd/proxy
+- CGO_ENABLED=0 go build -o "bin/diagnosticClient" ./cmd/diagnostic
++ $(GO) build -tags experimental -o "bin/dnet" ./cmd/dnet
++ $(GO) build -o "bin/proxy" ./cmd/proxy
++ CGO_ENABLED=0 $(GO) build -o "bin/diagnosticClient" ./cmd/diagnostic
+ CGO_ENABLED=0 go build -o "bin/testMain" ./cmd/networkdb-test/testMain.go
+
+ build-images:
+@@ -82,8 +82,8 @@
+
+ cross-local:
+ @echo "🐳 $@"
+- go build -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet
+- go build -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy
++ @$(GO) build -linkshared $(GOBUILDFLAGS) -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy
++ @$(GO) build -linkshared $(GOBUILDFLAGS) -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet
+
+ # Rebuild protocol buffers.
+ # These may need to be rebuilt after vendoring updates, so .proto files are declared .PHONY so they are always rebuilt.
+@@ -130,7 +130,7 @@
+ if ls $$dir/*.go &> /dev/null; then \
+ pushd . &> /dev/null ; \
+ cd $$dir ; \
+- go test ${INSIDECONTAINER} -test.parallel 5 -test.v -covermode=count -coverprofile=./profile.tmp ; \
++ $(GO) test ${INSIDECONTAINER} -test.parallel 5 -test.v -covermode=count -coverprofile=./profile.tmp ; \
+ ret=$$? ;\
+ if [ $$ret -ne 0 ]; then exit $$ret; fi ;\
+ popd &> /dev/null; \
+@@ -145,7 +145,7 @@
+ # Depends on binaries because vet will silently fail if it can not load compiled imports
+ vet: ## run go vet
+ @echo "🐳 $@"
+- @test -z "$$(go vet ${PACKAGES} 2>&1 | grep -v 'constant [0-9]* not a string in call to Errorf' | egrep -v '(timestamp_test.go|duration_test.go|exit status 1)' | tee /dev/stderr)"
++ @test -z "$$($(GO) vet ${PACKAGES} 2>&1 | grep -v 'constant [0-9]* not a string in call to Errorf' | egrep -v '(timestamp_test.go|duration_test.go|exit status 1)' | tee /dev/stderr)"
+
+ misspell:
+ @echo "🐳 $@"
diff --git a/external/meta-virtualization/recipes-containers/docker/files/docker-registry.service b/external/meta-virtualization/recipes-containers/docker/files/docker-registry.service
new file mode 100644
index 00000000..7b4bc468
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/docker/files/docker-registry.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=docker private registry service
+After=docker.service
+
+[Service]
+ExecStartPre=-/usr/bin/docker kill registry
+ExecStartPre=-/usr/bin/docker rm registry
+ExecStart=/usr/bin/docker run --name registry -v /mirror/registry:/tmp/ -p 5000:5000 \
+ -e "STANDALONE=true" \
+ -e "MIRROR_SOURCE=https://registry-1.docker.io" \
+ -e "MIRROR_SOURCE_INDEX=https://index.docker.io" \
+ -e "SETTINGS_FLAVOR=local" \
+ registry
+ExecStop=-/usr/bin/docker stop registry
+Restart=always
+RestartSec=10s
+
+[Install]
+WantedBy=multi-user.target
diff --git a/external/meta-virtualization/recipes-containers/docker/files/docker.init b/external/meta-virtualization/recipes-containers/docker/files/docker.init
new file mode 100644
index 00000000..0aea8d01
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/docker/files/docker.init
@@ -0,0 +1,131 @@
+#!/bin/sh
+#
+# /etc/rc.d/init.d/docker
+#
+# Daemon for docker.com
+#
+# chkconfig: 2345 95 95
+# description: Daemon for docker.com
+
+### BEGIN INIT INFO
+# Provides: docker
+# Required-Start: $network cgconfig
+# 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.com
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+prog="dockerd"
+unshare=/usr/bin/unshare
+exec="/usr/bin/$prog"
+pidfile="/var/run/$prog.pid"
+lockfile="/var/lock/subsys/$prog"
+logfile="/var/log/$prog"
+other_args="--registry-mirror=http://localhost:5000 --insecure-registry=http://localhost:5000 --raw-logs"
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+start() {
+ [ -x $exec ] || exit 5
+
+ check_for_cleanup
+
+ if ! [ -f $pidfile ]; then
+ printf "Starting $prog:\t"
+ echo -e "\n$(date)\n" >> $logfile
+ "$unshare" -m -- $exec $other_args &>> $logfile &
+ pid=$!
+ touch $lockfile
+ # wait up to 10 seconds for the pidfile to exist. see
+ # https://github.com/docker/docker/issues/5359
+ tries=0
+ while [ ! -f $pidfile -a $tries -lt 10 ]; do
+ sleep 1
+ tries=$((tries + 1))
+ done
+ success
+ echo
+ else
+ failure
+ echo
+ printf "$pidfile still exists...\n"
+ exit 7
+ fi
+}
+
+stop() {
+ echo -n $"Stopping $prog: "
+ killproc $prog
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ restart
+}
+
+force_reload() {
+ restart
+}
+
+rh_status() {
+ status $prog
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+
+check_for_cleanup() {
+ if [ -f ${pidfile} ]; then
+ /bin/ps -fp $(cat ${pidfile}) > /dev/null || rm ${pidfile}
+ fi
+}
+
+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 $?