diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-11-15 20:25:35 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-11-15 21:33:57 +0300 |
commit | cd2e94714426e6109ed8400ef7380d106af684a3 (patch) | |
tree | d74338ba7b5d919bb20fe174767aed39528dd8b8 /docker | |
parent | fa519673368f401f0a0488c5f2a1187e63b8648e (diff) |
docker: add update-rc.d function
Diffstat (limited to 'docker')
-rw-r--r-- | docker/debian-ncp/Dockerfile | 2 | ||||
-rwxr-xr-x | docker/debian-ncp/run-parts.sh | 31 | ||||
-rwxr-xr-x | docker/lamp/010lamp (renamed from docker/lamp/010-lamp-run.sh) | 0 | ||||
-rw-r--r-- | docker/lamp/Dockerfile | 2 | ||||
-rwxr-xr-x | docker/nextcloud/020nextcloud (renamed from docker/nextcloud/020-nextcloud-run.sh) | 0 | ||||
-rw-r--r-- | docker/nextcloud/Dockerfile | 2 | ||||
-rwxr-xr-x | docker/nextcloudpi/000ncp (renamed from docker/nextcloudpi/000-ncp-run.sh) | 0 | ||||
-rw-r--r-- | docker/nextcloudpi/Dockerfile | 2 |
8 files changed, 31 insertions, 8 deletions
diff --git a/docker/debian-ncp/Dockerfile b/docker/debian-ncp/Dockerfile index 208603ff..6caf7825 100644 --- a/docker/debian-ncp/Dockerfile +++ b/docker/debian-ncp/Dockerfile @@ -4,6 +4,6 @@ MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com> CMD /bin/bash -RUN mkdir -p /etc/services.d +RUN mkdir -p /etc/services-available.d /etc/services-enabled.d COPY docker/debian-ncp/run-parts.sh / diff --git a/docker/debian-ncp/run-parts.sh b/docker/debian-ncp/run-parts.sh index dee4fe61..0c8fe3f1 100755 --- a/docker/debian-ncp/run-parts.sh +++ b/docker/debian-ncp/run-parts.sh @@ -2,16 +2,39 @@ cleanup() { - for file in $( ls -1rv /etc/services.d ); do - /etc/services.d/"$file" stop "$1" + for file in $( ls -1rv /etc/services-enabled.d ); do + /etc/services-enabled.d/"$file" stop "$1" done exit } trap cleanup SIGTERM -for file in $( ls -1v /etc/services.d ); do - /etc/services.d/"$file" start "$1" +cat > /usr/local/sbin/update-rc.d <<'EOF' +#!/bin/bash +FILE=/etc/services-available.d/???"$1" + +test -f $FILE || { + echo "$1 doesn't exist" + exit 1 +} + +[[ "$2" == "enable" ]] && { + ln -s $FILE /etc/services-enabled.d/$( basename $FILE ) + echo "enabled $1" + exit 0 +} + +[[ "$2" == "disable" ]] && { + rm -f /etc/services-enabled.d/$( basename $FILE ) + echo "disabled $1" + exit 0 +} +EOF +chmod +x /usr/local/sbin/update-rc.d + +for file in $( ls -1v /etc/services-enabled.d ); do + /etc/services-enabled.d/"$file" start "$1" done echo "Init done" diff --git a/docker/lamp/010-lamp-run.sh b/docker/lamp/010lamp index 9552d848..9552d848 100755 --- a/docker/lamp/010-lamp-run.sh +++ b/docker/lamp/010lamp diff --git a/docker/lamp/Dockerfile b/docker/lamp/Dockerfile index e6e77b93..86418ef4 100644 --- a/docker/lamp/Dockerfile +++ b/docker/lamp/Dockerfile @@ -33,7 +33,7 @@ rm -f /var/log/alternatives.log /var/log/apt/*; \ rm /data/database/ib_logfile*; \ rm /usr/local/etc/lamp.sh -COPY docker/lamp/010-lamp-run.sh /etc/services.d/ +COPY docker/lamp/010lamp /etc/services-enabled.d/ ENTRYPOINT ["/run-parts.sh"] diff --git a/docker/nextcloud/020-nextcloud-run.sh b/docker/nextcloud/020nextcloud index 48076ad2..48076ad2 100755 --- a/docker/nextcloud/020-nextcloud-run.sh +++ b/docker/nextcloud/020nextcloud diff --git a/docker/nextcloud/Dockerfile b/docker/nextcloud/Dockerfile index d0fda0bb..f8ad4012 100644 --- a/docker/nextcloud/Dockerfile +++ b/docker/nextcloud/Dockerfile @@ -33,4 +33,4 @@ rm -f /var/log/alternatives.log /var/log/apt/*; \ apt-get purge -y wget ca-certificates; \ rm /usr/local/etc/nc-nextcloud.sh -COPY docker/nextcloud/020-nextcloud-run.sh /etc/services.d/ +COPY docker/nextcloud/020nextcloud /etc/services-enabled.d/ diff --git a/docker/nextcloudpi/000-ncp-run.sh b/docker/nextcloudpi/000ncp index 6a4d2d2e..6a4d2d2e 100755 --- a/docker/nextcloudpi/000-ncp-run.sh +++ b/docker/nextcloudpi/000ncp diff --git a/docker/nextcloudpi/Dockerfile b/docker/nextcloudpi/Dockerfile index 7461efb7..b0f9a57f 100644 --- a/docker/nextcloudpi/Dockerfile +++ b/docker/nextcloudpi/Dockerfile @@ -74,7 +74,7 @@ rm -rf /usr/share/doc/*; \ rm -f /var/log/alternatives.log /var/log/apt/*; \ rm /var/cache/debconf/*-old; -COPY docker/nextcloudpi/000-ncp-run.sh /etc/services.d/ +COPY docker/nextcloudpi/000ncp /etc/services-enabled.d/ # 4443 - ncp-web EXPOSE 80 443 4443 |