From 93f76db19d87074b9c127e190fad44a6338eb85e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 30 Sep 2014 12:10:12 -0700 Subject: [PATCH] dev-python/thumbor: Add this image-thumbnailing service --- files/init.d/thumbor | 50 +++++++++++++++++++++++++++ thumbor-9999.ebuild | 80 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100755 files/init.d/thumbor create mode 100644 thumbor-9999.ebuild diff --git a/files/init.d/thumbor b/files/init.d/thumbor new file mode 100755 index 0000000..247c5c3 --- /dev/null +++ b/files/init.d/thumbor @@ -0,0 +1,50 @@ +#!/sbin/runscript + +PC_USER="${PC_USER:-thumbor}" +PC_GROUP="${PC_GROUP:-thumbor}" +CONFIG="${CONFIG:-/etc/thumbor/${SVCNAME}.conf}" +HOME="/var/lib/thumbor" +HOST="${HOST:-0.0.0.0}" +PORT="${PORT:-80}" +KEYFILE="${KEYFILE:-}" +command="/usr/bin/thumbor" +pidfile="/run/${SVCNAME}.pid" + +depend() { + need net +} + +start() { + ebegin "Starting ${SVCNAME}" + if [[ -n "${KEYFILE}" ]] && [[ ! -f "${KEYFILE}" ]]; then + eend 1 "configured KEYFILE does not exist (${KEYFILE})" + fi + KEYFILE="${KEYFILE:-/etc/thumbor/${SVCNAME}.key}" + KEYFILE_OPTS=() + if [[ -f "${KEYFILE}" ]]; then + KEYFILE_OPTS+=( --keyfile "${KEYFILE}" ) + fi + start-stop-daemon --start \ + --user "${PC_USER}:${PC_GROUP}" \ + --chdir "${HOME}" \ + --exec "${command}" \ + --background \ + --pidfile "${pidfile}" \ + --make-pidfile \ + -- \ + --syslog \ + --ip "${HOST}" \ + --port "${PORT}" \ + "${KEYFILE_OPTS[@]}" \ + ${PC_OPTS:+${PC_OPTS}} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop \ + --user "${PC_USER}:${PC_GROUP}" \ + --exec "${command}" \ + --pidfile "${pidfile}" + eend $? +} diff --git a/thumbor-9999.ebuild b/thumbor-9999.ebuild new file mode 100644 index 0000000..011aeac --- /dev/null +++ b/thumbor-9999.ebuild @@ -0,0 +1,80 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=5 +PYTHON_COMPAT=( python2_7 ) + +inherit distutils-r1 user + +if [[ "${PV}" == "9999" ]]; then + inherit git-2 + EGIT_REPO_URI="git://github.com/thumbor/thumbor.git" + SRC_URI="" +else + SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz" +fi + +DESCRIPTION="An an open-source photo thumbnail service" +HOMEPAGE="https://github.com/thumbor/thumbor https://pypi.python.org/pypi/thumbor" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="test" + +RDEPEND=" + >=dev-python/derpconf-0.2.0[${PYTHON_USEDEP}] + >=dev-python/pillow-2.1.0[${PYTHON_USEDEP}] + =dev-python/pycrypto-2.1.0[${PYTHON_USEDEP}] + >=dev-python/pycurl-7.19.0[${PYTHON_USEDEP}] + =dev-python/python-magic-0.4.3[${PYTHON_USEDEP}] + >=dev-python/thumbor-pexif-0.14[${PYTHON_USEDEP}] + =www-servers/tornado-2.3.0[${PYTHON_USEDEP}] + "${ED}etc/${PN}/${PN}.conf" || + die "Failed to run thumbor-config" + mkdir -p "${ED}var/lib/${PN}" || die "Failed to make ${EPREFIX}/var/lib/${PN}" + chown -R "${PN}:${PN}" "${ED}etc/${PN}" "${ED}var/lib/${PN}" || die "Failed to chown ${PN}:${PN}" +} -- 2.26.2