Mail archive
alpine-aports

Re: [alpine-aports] [PATCH] testing/twemproxy: new aport

From: Sören Tempel <soeren_at_soeren-tempel.net>
Date: Tue, 20 Oct 2015 18:35:28 +0200

On 18.10.15, Yagnesh Mistry wrote:
> +package() {
> + cd "$_builddir"
> + make DESTDIR="$pkgdir" install || return 1
> + install -m644 -D "$srcdir"/$pkgname-$pkgver/conf/nutcracker.yml \
> + "$pkgdir"/etc/$akaname/nutcracker.yml || return 1
> + install -m644 -D
> "$srcdir"/$pkgname-$pkgver/conf/nutcracker.leaf.yml \
> + "$pkgdir"/etc/$akaname/nutcracker.leaf.yml || return 1
> + install -m644 -D
> "$srcdir"/$pkgname-$pkgver/conf/nutcracker.root.yml \
> + "$pkgdir"/etc/$akaname/nutcracker.root.yml || return 1
> + install -m755 -D "$srcdir"/$akaname.initd \
> + "$pkgdir"/etc/init.d/$akaname || return 1
> + install -m644 -D "$srcdir"/$akaname.confd \
> + "$pkgdir"/etc/conf.d/$akaname || return 1
> +
> + install -m0700 -d "$pkgdir"/$_rundir || return 1
> + install -m0700 -d "$pkgdir"/$_logdir || return 1
> +}

As you can see the indention is broken here.

> +doc () {
> + default_doc || return 1
> +
> + _docs="README.md NOTICE ChangeLog"
> + for _doc in $_docs; do
> + install -m644 -D "$srcdir"/$pkgname-$pkgver/$_doc \
> + "$pkgdir"/usr/share/doc/$akaname/$_doc || return 1
> + done
> +
> + install -m644 -D "$srcdir"/$pkgname-$pkgver/LICENSE \
> + "$pkgdir"/usr/share/licenses/$akaname/LICENSE || return 1
> +}

Why don't you use the default doc function and move those files in the
package function? Generally speaking the doc function should be
overwritten unless there is a specific reason to do so.

> b/testing/twemproxy/nutcracker.confd
> new file mode 100644
> index 0000000..7f25419
> --- /dev/null
> +++ b/testing/twemproxy/nutcracker.confd
> _at_@ -0,0 +1,6 @@
> +CONFFILE=/etc/nutcracker/nutcracker.yml
> +PIDFILE=/var/run/nutcracker/nutcracker.pid
> +LOGFILE=/var/log/nutcracker/nutcracker.log
> +STATSPORT=22222
> +
> +DAEMON_ARGS="-c $CONFFILE -o $LOGFILE -p $PIDFILE -s $STATSPORT -v 11 -m
> 2048 -d"
> diff --git a/testing/twemproxy/nutcracker.initd
> b/testing/twemproxy/nutcracker.initd
> new file mode 100644
> index 0000000..fc802ff
> --- /dev/null
> +++ b/testing/twemproxy/nutcracker.initd
> _at_@ -0,0 +1,39 @@
> +#!/sbin/openrc-run
> +
> +NAME="nutcracker"
> +DAEMON=/usr/sbin/nutcracker
> +USER=${USER:-nobody}
> +
> +CONFFILE=${CONFFILE:-/etc/nutcracker/nutcracker.yml}
> +PIDFILE=/var/run/nutcracker/nutcracker.pid
> +LOGFILE=/var/log/nutcracker/nutcracker.log
> +STATSPORT=22222
> +
> +DAEMON_ARGS=${DAEMON_ARGS:-"-c $CONFFILE -o $LOGFILE -p $PIDFILE -s
> $STATSPORT -v 11 -m 2048 -d"}
> +
> +depend() {
> + need net
> + after firewall
> +}
> +
> +start() {
> + touch $PIDFILE
> + chown $USER:$USER -R /var/run/nutcracker
> + chmod 755 /var/run/nutcracker
> +
> + ebegin "Starting ${NAME}: "
> + start-stop-daemon --start --quiet \
> + --pidfile ${PIDFILE} \
> + --chuid ${USER}:${USER} \
> + --exec ${DAEMON} -- ${DAEMON_ARGS}
> + eend $?
> +}
> +
> +stop() {
> + ebegin "Stopping ${NAME}: "
> + start-stop-daemon --stop --quiet \
> + --pidfile ${PIDFILE} \
> + --exec ${DAEMON}
> + eend $?
> +}

Your init scripts seem a bit too complicate, have you considered using
gentoos OpenRC services for this package?

Sören.


---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Tue Oct 20 2015 - 18:35:28 GMT