aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kampka <christian@kampka.net>2015-10-14 21:01:48 +0200
committerBartłomiej Piotrowski <b@bpiotrowski.pl>2015-10-16 14:50:52 +0200
commit20f07fd98ac82b5d97a28019d4b29d8a902854bc (patch)
treec1c01aa00d09b2a8431661f94d55711047640166
parent10a0c749b7baf631fac4fcb627982e1d9c25c97b (diff)
downloadaports-20f07fd98ac82b5d97a28019d4b29d8a902854bc.tar.gz
aports-20f07fd98ac82b5d97a28019d4b29d8a902854bc.tar.bz2
aports-20f07fd98ac82b5d97a28019d4b29d8a902854bc.tar.xz
testing/docker-registry: Simplify init script, run as dedicated user
-rw-r--r--testing/docker-registry/APKBUILD13
-rw-r--r--testing/docker-registry/docker-registry.initd30
-rw-r--r--testing/docker-registry/docker-registry.pre-install5
3 files changed, 23 insertions, 25 deletions
diff --git a/testing/docker-registry/APKBUILD b/testing/docker-registry/APKBUILD
index 2077d4698f..68a260919e 100644
--- a/testing/docker-registry/APKBUILD
+++ b/testing/docker-registry/APKBUILD
@@ -1,13 +1,16 @@
-# Maintainer: Chritsian Kampka <christian at kampka dot net>
+# Maintainer: Christian Kampka <christian at kampka dot net>
pkgname=docker-registry
pkgver=2.1.1
-pkgrel=0
+pkgrel=1
pkgdesc="An implementation of the Docker Registry HTTP API V2 for use with docker 1.6+."
url="https://github.com/docker/distribution"
arch="x86_64"
license="Apache 2.0"
makedepends="git go"
options="!strip"
+install="$pkgname.pre-install"
+pkguserss="docker-registry"
+pkggroups="docker-registry"
source="$pkgname-$pkgver.tar.gz::${url}/archive/v${pkgver}.tar.gz
docker-registry.initd"
@@ -39,8 +42,8 @@ package() {
install -v -D -m644 ${_builddir}/LICENSE ${pkgdir}/usr/share/licenses/${pkgname}
}
md5sums="956cddde0cbeeb01e15d51d5cc488efb docker-registry-2.1.1.tar.gz
-7bb346742afa5d44ef15df9855f295b1 docker-registry.initd"
+eaa66ce1509f0b2f257e2919b350fc46 docker-registry.initd"
sha256sums="80c23c3f223fa44c6cc3f9ac3588f95bc3aaa0561c6fd52f3bbca3fd4c1fbfc0 docker-registry-2.1.1.tar.gz
-c441b0cfac0fbb45fbc78563a07d812704d06ceb0a3b46b0a4377e55b02c5c21 docker-registry.initd"
+d35bfa20956a4dbd6070799fa8a1fd34c100070672e24c9b759df23c69b5431a docker-registry.initd"
sha512sums="42986be5077589bb49d61a0766218676bbc085b839ae83a5f39b48df5942ee27b41a66a5bbf282841b68d41cbcd254df04eadd1f2592becd06ba11c84ccb95f2 docker-registry-2.1.1.tar.gz
-4bedcb02d8f8b4f4f778d8c7af889c5d06affae5340a8e6deb228964294ff0257f2035c95c3d65d123a9e1ca9169c29c84a2c8a38c7c0b393b3221442fc447b3 docker-registry.initd"
+338d78b6813825154673c50cd73884297ebdd8c497ec933048dc5bf0863136e7bc308860ce71835d7e48a2b950266a69e60d318e382b18f8352d6c662851ed09 docker-registry.initd"
diff --git a/testing/docker-registry/docker-registry.initd b/testing/docker-registry/docker-registry.initd
index 0f0e34fb7d..47064077ed 100644
--- a/testing/docker-registry/docker-registry.initd
+++ b/testing/docker-registry/docker-registry.initd
@@ -1,30 +1,20 @@
#!/sbin/openrc-run
# $Header: $
-DOCKER_REGISTRY_LOGFILE=${DOCKER_REGISTRY_LOGFILE:-/var/log/${SVCNAME}.log}
DOCKER_REGISTRY_PIDFILE=${DOCKER_REGISTRY_PIDFILE:-/run/${SVCNAME}.pid}
DOCKER_REGISTRY_BINARY=${DOCKER_REGISTRY_BINARY:-/usr/bin/docker-registry}
DOCKER_REGISTRY_CONFIG=${DOCKER_REGISTRY_CONFIG:-/etc/docker-registry/config.yml}
+DOCKER_REGISTRY_LOGFILE=${DOCKER_REGISTRY_LOGFILE:-/var/log/docker-registry.log}
-start() {
- checkpath -f -m 0644 -o root:docker "$DOCKER_REGISTRY_LOGFILE"
+command="$DOCKER_REGISTRY_BINARY"
+command_args="$DOCKER_REGISTRY_CONFIG"
+pidfile="$DOCKER_REGISTRY_PIDFILE"
+command_background="true"
+start_stop_daemon_args="--user docker-registry:docker-registry --stdout $DOCKER_REGISTRY_LOGFILE --stderr $DOCKER_REGISTRY_LOGFILE"
+name="Docker Registry"
- ebegin "Starting docker registry"
- start-stop-daemon --start --background \
- --exec "$DOCKER_REGISTRY_BINARY" \
- --pidfile "$DOCKER_PIDFILE" \
- --make-pid \
- --background \
- --stdout "$DOCKER_LOGFILE" \
- --stderr "$DOCKER_LOGFILE" \
- -- "$DOCKER_REGISTRY_CONFIG"
- eend $?
-}
+start_pre() {
+ checkpath --directory --owner docker-registry:docker-registry --mode 0770 /var/lib/registry
-stop() {
- ebegin "Stopping docker daemon"
- start-stop-daemon --stop \
- --exec "$DOCKER_BINARY" \
- --pidfile "$DOCKER_PIDFILE"
- eend $?
+ checkpath -f -m 0644 -o docker-registry:docker-registry "$DOCKER_REGISTRY_LOGFILE"
}
diff --git a/testing/docker-registry/docker-registry.pre-install b/testing/docker-registry/docker-registry.pre-install
new file mode 100644
index 0000000000..e921230cfc
--- /dev/null
+++ b/testing/docker-registry/docker-registry.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup -S docker-registry 2>/dev/null
+adduser -S -H -h /dev/null -s /sbin/nologin -D -G docker-registry docker-registry 2>/dev/null
+exit 0