diff options
Diffstat (limited to 'network')
-rw-r--r-- | network/sickrage/README | 11 | ||||
-rw-r--r-- | network/sickrage/config.ini | 3 | ||||
-rw-r--r-- | network/sickrage/doinst.sh | 27 | ||||
-rw-r--r-- | network/sickrage/rc.sickrage | 104 | ||||
-rw-r--r-- | network/sickrage/sickrage.SlackBuild | 97 | ||||
-rw-r--r-- | network/sickrage/sickrage.conf | 6 | ||||
-rw-r--r-- | network/sickrage/sickrage.info | 10 | ||||
-rw-r--r-- | network/sickrage/slack-desc | 19 |
8 files changed, 277 insertions, 0 deletions
diff --git a/network/sickrage/README b/network/sickrage/README new file mode 100644 index 0000000000000..c8bda973ce3bf --- /dev/null +++ b/network/sickrage/README @@ -0,0 +1,11 @@ +sickrage (Automatic Video Library Manager for TV Shows.) + +SickRage is an automatic Video Library Manager for TV Shows. It watches for +new episodes of your favorite shows, and when they are posted it does its +magic: automatic torrent/nzb searching, downloading, and processing at the +qualities you want. + +NOTE: Requires sickrage user and group. +(uid/gid assigned by SBo -- see https://slackbuilds.org/uid_gid.txt) + groupadd -g 324 sickrage + useradd -u 324 -g sickrage -d /var/lib/sickrage -s /bin/false sickrage diff --git a/network/sickrage/config.ini b/network/sickrage/config.ini new file mode 100644 index 0000000000000..acd32275514a2 --- /dev/null +++ b/network/sickrage/config.ini @@ -0,0 +1,3 @@ +[General] +log_dir = /var/log/sickrage +version_notify = 0 diff --git a/network/sickrage/doinst.sh b/network/sickrage/doinst.sh new file mode 100644 index 0000000000000..3aafce21d5248 --- /dev/null +++ b/network/sickrage/doinst.sh @@ -0,0 +1,27 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.sickrage.new +config etc/sickrage.conf.new +config var/lib/sickrage/config.ini.new diff --git a/network/sickrage/rc.sickrage b/network/sickrage/rc.sickrage new file mode 100644 index 0000000000000..89918979252a4 --- /dev/null +++ b/network/sickrage/rc.sickrage @@ -0,0 +1,104 @@ +#!/bin/sh +# Start/stop/restart sickrage. + +# rc.sickrage created by Jeremy Brent Hansen for Slackware + +# Set program name in case you want to run sick{beard|rage|gear|etc} +PROG=${PROG:-sickrage} + +# Source SickRage configuration +if [ -f /etc/${PROG}.conf ]; then + . /etc/${PROG}.conf +fi + +# Ensure all required variables are set in conf file +# Edit conf file in /etc/sickrage.conf for any changes +for var in USERNAME HOMEDIR DATADIR PIDFILE PORT; do + if [ -z "${!var}" ]; then + echo "/etc/${PROG}.conf is missing some or all required variables ($var)." + echo "Please check the file and try again." + exit 1 + fi +done + +# Check if the pid file exists +check() { + if [ -e $PIDFILE ]; then + STATUS=running + else + STATUS=stopped + fi +} + +status() { + if [ $STATUS == "running" ]; then + echo "${PROG} currently running or not shut down properly." + echo "PIDfile: $PIDFILE already exists." + elif [ $STATUS == "stopped" ]; then + echo "${PROG} not started." + echo "PIDfile: $PIDFILE does not exist." + else + echo "Status unknown." + fi +} + +start() { + if [ $STATUS == "running" ]; then + echo "$PROG already running or not shut down properly." + else + echo -n "Starting ${PROG}: " + su $USERNAME -s /bin/sh -c "python ${HOMEDIR}/SickBeard.py --daemon --pidfile=${PIDFILE} --datadir=${DATADIR} --port=${PORT} &> /dev/null" + if (( $? == 0 )); then + echo "Startup Successful" + else + echo "Startup Failed. Please try running the following to see the errors." + echo "su $USERNAME -s /bin/sh -c \"python ${HOMEDIR}/SickBeard.py --daemon --pidfile=${PIDFILE} --datadir=${DATADIR} --port=${PORT}\"" + fi + fi +} + +stop() { + if [ $STATUS == "stopped" ]; then + echo "${PROG} doesn't seem to be running. Please try running" + echo "$0 start" + else + if [ "$EUID" -ne 0 ];then + echo "Please run as root" + exit 1 + fi + PID=$(cat $PIDFILE) + echo -n $"Shutting down ${PROG}: " + curl -f http://localhost:${PORT}/home/shutdown/?pid=${PID} &> /dev/null + if [ $? -gt 0 ]; then + echo "Normal Shutdown Failed - Attempting to kill the process." + echo $? + sleep 7 + kill -9 $PID + else + echo "Shutdown Successful" + fi + fi +} + +case "$1" in + start) + check + start + ;; + stop) + check + stop + ;; + restart) + check + stop + start + ;; + status) + check + status + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 +esac diff --git a/network/sickrage/sickrage.SlackBuild b/network/sickrage/sickrage.SlackBuild new file mode 100644 index 0000000000000..9e4b1620de5f8 --- /dev/null +++ b/network/sickrage/sickrage.SlackBuild @@ -0,0 +1,97 @@ +#!/bin/sh + +# Slackware build script for sickrage +# Copyright 2016 Jeremy Hansen <jebrhansen+SBo -at- gmail.com> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=sickrage +SRCNAM=SickRage +VERSION=${VERSION:-2016.12.27_1} +SRCVER=$(echo $VERSION | tr _ -) +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +SICKUSER=${SICKUSER:-sickrage} +SICKGROUP=${SICKGROUP:-sickrage} + +# The user and group accounts need to be created manually. +# For slackbuilds.org, assigned sickrage uid/gid are 324/324. +# See http://slackbuilds.org/uid_gid.txt +if ! grep ^$SICKGROUP: /etc/group 2>&1 > /dev/null; then + echo " You must have a \"$SICKGROUP\" group to run this script." + echo " # groupadd -g 324 $SICKGROUP" + exit 1 +elif ! grep ^$SICKUSER: /etc/passwd 2>&1 > /dev/null; then + echo " You must have a \"$SICKUSER\" user to run this script." + echo " # useradd -u 324 -g $SICKGROUP -d /var/lib/sickrage -s /bin/false $SICKUSER" + exit 1 +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $SRCNAM-$SRCVER +tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz +cd $SRCNAM-$SRCVER +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# "Install" sickrage +echo "Installing sickrage" +mkdir -p $PKG/usr/share/sickrage +cp -r ./* $PKG/usr/share/sickrage + +# Copy documentation to correct folder +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a COPYING.txt readme.md $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/etc/rc.d/ +install -m 0644 $CWD/rc.sickrage $PKG/etc/rc.d/rc.sickrage.new +install -m 0644 $CWD/sickrage.conf $PKG/etc/sickrage.conf.new +install -dm 0755 --owner=sickrage $PKG/var/lib/sickrage/ +install -m 0644 --owner=sickrage $CWD/config.ini $PKG/var/lib/sickrage/config.ini.new +install -dm 0755 --owner=sickrage $PKG/var/log/sickrage/ + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/sickrage/sickrage.conf b/network/sickrage/sickrage.conf new file mode 100644 index 0000000000000..1b99f0b756c56 --- /dev/null +++ b/network/sickrage/sickrage.conf @@ -0,0 +1,6 @@ +USERNAME=sickrage +HOMEDIR=/usr/share/sickrage +DATADIR=/var/lib/sickrage +PIDFILE=${DATADIR}/sickrage.pid +PORT=8081 +LOGDIR=/var/log/sickrage
\ No newline at end of file diff --git a/network/sickrage/sickrage.info b/network/sickrage/sickrage.info new file mode 100644 index 0000000000000..22de48910b0c5 --- /dev/null +++ b/network/sickrage/sickrage.info @@ -0,0 +1,10 @@ +PRGNAM="sickrage" +VERSION="2016.12.27_1" +HOMEPAGE="https://sickrage.github.io/" +DOWNLOAD="https://github.com/SickRage/SickRage/archive/v2016.12.27-1/sickrage-2016.12.27-1.tar.gz" +MD5SUM="33ef081f48f34ba91fbe9a10d6185f6b" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Jeremy Hansen" +EMAIL="jebrhansen+SBo@gmail.com" diff --git a/network/sickrage/slack-desc b/network/sickrage/slack-desc new file mode 100644 index 0000000000000..929bbadb3d5eb --- /dev/null +++ b/network/sickrage/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +sickrage: sickrage (Automatic Video Library Manager for TV Shows.) +sickrage: +sickrage: SickRage is an automatic Video Library Manager for TV Shows. It +sickrage: watches for new episodes of your favorite shows, and when they are +sickrage: posted it does its magic: automatic torrent/nzb searching, +sickrage: downloading, and processing at the qualities you want. +sickrage: +sickrage: Homepage: https://sickrage.github.io/ +sickrage: +sickrage: +sickrage: |