summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2017-06-25 13:37:16 -0700
committerZac Medico <zmedico@gentoo.org>2017-06-26 01:05:44 -0700
commit1df43410e16d5f3b6b808b3981fa062a87160da1 (patch)
treeb0197d04f71a2a043a1e68a10e7b6c29bf6482b9 /app-text/calibre/files
parentdev-perl/Format-Human-Bytes: Fix for '.' in @INC re bug #616868 (diff)
downloadgentoo-1df43410e16d5f3b6b808b3981fa062a87160da1.tar.gz
gentoo-1df43410e16d5f3b6b808b3981fa062a87160da1.tar.bz2
gentoo-1df43410e16d5f3b6b808b3981fa062a87160da1.zip
app-text/calibre: version bump to 3.1.1
Package-Manager: Portage-2.3.6, Repoman-2.3.2
Diffstat (limited to 'app-text/calibre/files')
-rw-r--r--app-text/calibre/files/calibre-server-3.conf13
-rw-r--r--app-text/calibre/files/calibre-server-3.init58
2 files changed, 71 insertions, 0 deletions
diff --git a/app-text/calibre/files/calibre-server-3.conf b/app-text/calibre/files/calibre-server-3.conf
new file mode 100644
index 000000000000..bb456e858bd6
--- /dev/null
+++ b/app-text/calibre/files/calibre-server-3.conf
@@ -0,0 +1,13 @@
+# /etc/conf.d/calibre-server
+# Change this to the user you want to run calibre-server as.
+# You may specify a group too, after a colon
+# NOTE: This must be set and not to root!
+CALIBRE_USER=
+
+# Set the path of the library to serve.
+# Defaults to the default location for CALIBRE_USER.
+#CALIBRE_LIBRARY='<user home directory>/Calibre Library'
+
+# Extra options to pass to calibre-server.
+# See the calibre-server man page for more options.
+#CALIBRE_SERVER_OPTS="--userdb /srv/calibre/users.sqlite --enable-auth --worker-count 10 --port 8080"
diff --git a/app-text/calibre/files/calibre-server-3.init b/app-text/calibre/files/calibre-server-3.init
new file mode 100644
index 000000000000..049d3e421a17
--- /dev/null
+++ b/app-text/calibre/files/calibre-server-3.init
@@ -0,0 +1,58 @@
+#!/sbin/openrc-run
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+depend() {
+ need net
+ need localmount
+ after bootmisc
+}
+
+checkconfig() {
+ if [ "${CALIBRE_USER}" = "" -o "${CALIBRE_USER}" = "root" ] ; then
+ eerror "Please edit /etc/conf.d/calibre-server"
+ eerror "You have to specify a user to run calibre-server as, as we will not run it as root!"
+ eerror "Modify CALIBRE_USER to your needs (you can also add a group, after a colon)"
+ return 1
+ fi
+ if ! getent passwd "${CALIBRE_USER%:*}" >/dev/null ; then
+ eerror "Please edit /etc/conf.d/calibre-server"
+ eerror "Your user has to exist!"
+ return 1
+ fi
+ if [ "${CALIBRE_USER%:*}" != "${CALIBRE_USER}" ] ; then
+ if ! getent group "${CALIBRE_USER#*:}" >/dev/null ; then
+ eerror "Please edit /etc/conf.d/calibre-server"
+ eerror "Your group has to exist too!"
+ return 1
+ fi
+ fi
+ if [ "${CALIBRE_LIBRARY}" = "" ] ; then
+ CALIBRE_USER_HOME=$(getent passwd "${CALIBRE_USER%:*}" | cut -d ':' -f 6)
+ CALIBRE_LIBRARY="${CALIBRE_USER_HOME}/Calibre Library"
+ fi
+ if [ ! -d "${CALIBRE_LIBRARY}" ] ; then
+ eerror "Please edit /etc/conf.d/calibre-server"
+ eerror "The Calibre library, '${CALIBRE_LIBRARY},' does not exist."
+ eerror "Please modify CALIBRE_LIBRARY to point to a valid library."
+ return 1
+ fi
+ return 0
+}
+
+start() {
+ checkconfig || return $?
+ local pidfile=/var/run/calibre-server.pid
+ ebegin "Starting calibre-server"
+ start-stop-daemon --user "${CALIBRE_USER}" \
+ --pidfile "${pidfile}" --make-pidfile --background --exec /usr/bin/calibre-server \
+ -- ${CALIBRE_OPTS} "${CALIBRE_LIBRARY}"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping calibre-server"
+ start-stop-daemon --stop --user "${CALIBRE_USER}" \
+ --pidfile /var/run/calibre-server.pid
+ eend $?
+}