aur/couchpotato-git to 20120812-1

This commit is contained in:
Kevin Mihelich 2012-10-13 22:26:49 +00:00
parent 22d57a10a9
commit 32c2d545bb
6 changed files with 75 additions and 30 deletions

View file

@ -1,24 +1,24 @@
# Maintainer: Ben Ruijl <benruyl at gmail>
plugrel=1
pkgname=couchpotato-git
pkgver=20120412
pkgver=20120812
pkgrel=1
pkgdesc="Automatic Movie Downloading via NZBs & Torrent"
arch=('i686' 'x86_64')
url="http://couchpotatoapp.com/"
url="http://couchpota.to/"
license=('unknown')
depends=('python2')
makedepends=('git')
provides=('couchpotato')
install='couchpotato.install'
source=('couchpotato' 'couchpotato.init')
backup=('etc/conf.d/couchpotato' 'etc/conf.d/couchpotato_systemd')
source=('couchpotato' 'couchpotato.init' 'couchpotato.conf' 'couchpotato_systemd.conf' 'couchpotato.service')
md5sums=('a7db842a8af532847ef41890f6714819'
'6f247a743fd17aa38e99f64e6e123978')
'a7711d04d2db7de96f067e484c29f709'
'2c3c045ae9c5f5bf4bc0972917c19071'
'c22c7a797415131baf0fbe092132abda'
'bdedef6bcb8d04c534bd094047885fa7')
_gitroot="git://github.com/RuudBurger/CouchPotato.git"
_gitroot="git://github.com/RuudBurger/CouchPotatoServer.git"
_gitname="couchpotato_src"
build() {
@ -40,4 +40,7 @@ build() {
install -D -m755 "${srcdir}/couchpotato" "${pkgdir}/usr/bin/couchpotato"
install -D -m755 "${srcdir}/couchpotato.init" "${pkgdir}/etc/rc.d/couchpotato"
install -D -m644 "${srcdir}/couchpotato.conf" "${pkgdir}/etc/conf.d/couchpotato"
install -D -m644 "${srcdir}/couchpotato_systemd.conf" "${pkgdir}/etc/conf.d/couchpotato_systemd"
install -D -m644 "${srcdir}/couchpotato.service" "${pkgdir}/usr/lib/systemd/system/couchpotato.service"
}

View file

@ -0,0 +1,25 @@
# Make sure we don't run as 0077 or similar
#
# Useful if running as another user that needs access to files
umask 0022
# Misc options, these aren't necessary but useful
#
# Can be commented out / modified
CP_OPTS="--daemon --quiet"
#
# The following below MUST be set
#
# User to run process as
CP_USER="couchpotato"
# Config file to use
CP_CONFIG="/opt/couchpotato/config.ini"
# Port to listen on, only used for shutdown!
CP_PORT="5050"
# Where CouchPotato stores its info
CP_DATA="/opt/couchpotato/data"

View file

@ -2,16 +2,18 @@
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/couchpotato
PID=`ps -A -F | grep "python2 /opt/couchpotato/CouchPotato.py" | grep -v grep | awk '{print $2}'`
case "$1" in
start)
stat_busy "Starting CouchPotato"
if [ -f /var/run/daemons/couchpotato ]; then
echo -n "CouchPotato is already running as a daemon! If you are certain it is not running, remove /var/run/daemons/couchpotato."
if [ -z "$CP_USER" ]; then
stat_busy "No CP_USER, please edit /etc/conf.d/couchpotato"
stat_fail
else
su - couchpotato -c "python2 /opt/couchpotato/CouchPotato.py &> /dev/null &" -s /bin/sh
[ -z "$PID" ] && su -l -s /bin/sh -c "python2 /opt/couchpotato/CouchPotato.py ${CP_OPTS} --config_file ${CP_CONFIG} --data_dir ${CP_DATA} &> /dev/null &" "$CP_USER"
if [ $? -gt 0 ]; then
stat_fail
else
@ -22,10 +24,8 @@ case "$1" in
;;
stop)
stat_busy "Stopping CouchPotato"
curl -f http://localhost:5000/config/exit/ &> /dev/null
if [ $? -gt 0 ]; then
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -ne 0 ]; then
stat_fail
else
rm_daemon couchpotato
@ -34,7 +34,7 @@ case "$1" in
;;
restart)
$0 stop
sleep 1
while [ ! -z "$PID" -a -d "/proc/$PID" ]; do sleep 1; done
$0 start
;;
*)

View file

@ -3,7 +3,7 @@ post_install() {
groupadd couchpotato &> /dev/null
useradd -g couchpotato -d /opt/couchpotato -s /bin/false couchpotato &> /dev/null
chown -R couchpotato:couchpotato /opt/couchpotato
echo " >> If you change CouchPotato's port in the general configuration page, you will need to edit /etc/rc.d/couchpotato to have it point to the new port number"
echo " >> If you change CouchPotato's port in the general configuration page, you will need to edit /etc/conf.d/couchpotato (or /etc/conf.d/couchpotato_systemd) to have it point to the new port number"
}
## arg 1: the new package version
## arg 2: the old package version
@ -12,6 +12,7 @@ post_upgrade() {
}
## arg 1: the old package version
pre_remove() {
post_remove() {
userdel couchpotato &> /dev/null
groupdel sabnzbd &> /dev/null || /bin/true
}

View file

@ -0,0 +1,15 @@
[Unit]
Description=An automatic NZB and torrent movie downloader
[Service]
EnvironmentFile=/etc/conf.d/couchpotato_systemd
ExecStart=/usr/bin/python2 /opt/couchpotato/CouchPotato.py $CP_OPTS
GuessMainPID=no
Type=forking
User=couchpotato
Group=couchpotato
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1 @@
CP_OPTS=--config_file /opt/couchpotato/config.ini --data_dir /opt/couchpotato/data --daemon --quiet