diff options
author | Slashbunny | 2013-12-29 17:20:55 -0500 |
---|---|---|
committer | Slashbunny | 2013-12-29 17:20:55 -0500 |
commit | ef87c4115d976e06289e8a4d0bf101552bba5030 (patch) | |
tree | 6ddb222361c9a32332faefb65a7263fb26a8d9cd | |
parent | 696969b55cbdb6febc4efa447471729818aa0896 (diff) | |
download | aur-ef87c4115d976e06289e8a4d0bf101552bba5030.tar.gz |
Many modernizations and improvements
* Use proper linux directories for program/data
* Remove old rc.d script
* Run maraschino as an unprivileged user
* Use new VCS PKGBUILD standards for managing git
Thanks to user daichiasuka on the AUR
-rw-r--r-- | .SRCINFO | 14 | ||||
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | PKGBUILD | 53 | ||||
-rw-r--r-- | maraschino.confd | 2 | ||||
-rw-r--r-- | maraschino.install | 26 | ||||
-rw-r--r-- | maraschino.rc | 47 | ||||
-rw-r--r-- | maraschino.service | 10 | ||||
-rw-r--r-- | maraschino.sh | 2 |
8 files changed, 64 insertions, 96 deletions
@@ -1,20 +1,22 @@ pkgbase = maraschinoproject-git pkgdesc = Web-based frontend for XBMC, Sickbeard, Sabnzbd, and more. - pkgver = 20130121 + pkgver = v0.3.0.r230.gf16c775 pkgrel = 1 url = http://www.maraschinoproject.com/ + install = maraschino.install arch = any license = GPL makedepends = git depends = python2 backup = etc/conf.d/maraschino - backup = opt/maraschino/maraschino.db source = maraschino.sh - source = maraschino.rc + source = maraschino.confd source = maraschino.service - md5sums = 7ccaabbd8632323702b591637fcc2b4a - md5sums = 12d6bdd1753612a126b3626de855519b - md5sums = 0e1ac338c5ce5eb535f9ceaf08b5279f + source = maraschino::git+https://github.com/mrkipling/maraschino.git + sha256sums = b711e56f3275aa2e600a737471e2f3d8adc0eb7452e7fbf0937cb4584f939e48 + sha256sums = 2f9073c6cddd6a73a1f156c9280da757c8ea64c0134da70696705794a8d38aa5 + sha256sums = 51d8698cac6b8a4d70e71aaa6bda1dbc071a3beb77557b3c5abfb33a78e63b6b + sha256sums = SKIP pkgname = maraschinoproject-git diff --git a/.gitignore b/.gitignore index e4f398dc5b3a..95828dad3aca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1 @@ -src/ -pkg/ -*.pkg.tar.xz -*.pkg.tar -*.src.tar.gz +maraschino/ @@ -1,7 +1,7 @@ # Maintainer: Slash <demodevil5 [at] yahoo [dot] com> pkgname=maraschinoproject-git -pkgver=20130121 +pkgver=v0.3.0.r230.gf16c775 pkgrel=1 pkgdesc="Web-based frontend for XBMC, Sickbeard, Sabnzbd, and more." arch=('any') @@ -9,37 +9,28 @@ url="http://www.maraschinoproject.com/" license=('GPL') depends=('python2') makedepends=('git') -backup=('etc/conf.d/maraschino' - 'opt/maraschino/maraschino.db') -source=('maraschino.sh' 'maraschino.rc' 'maraschino.service') -md5sums=('7ccaabbd8632323702b591637fcc2b4a' - '12d6bdd1753612a126b3626de855519b' - '0e1ac338c5ce5eb535f9ceaf08b5279f') - -_gitroot=https://github.com/mrkipling/maraschino -_gitname=maraschino - -build() { - cd "$srcdir" - msg "Connecting to GIT server...." - - if [[ -d "$_gitname" ]]; then - cd "$_gitname" && git pull origin - msg "The local files are updated." - else - git clone "$_gitroot" "$_gitname" - fi - - msg "GIT checkout done or server timeout" - msg "Starting build..." +backup=('etc/conf.d/maraschino') +install='maraschino.install' +source=('maraschino.sh' 'maraschino.confd' 'maraschino.service' +'maraschino::git+https://github.com/mrkipling/maraschino.git') +sha256sums=('b711e56f3275aa2e600a737471e2f3d8adc0eb7452e7fbf0937cb4584f939e48' + '2f9073c6cddd6a73a1f156c9280da757c8ea64c0134da70696705794a8d38aa5' + '51d8698cac6b8a4d70e71aaa6bda1dbc071a3beb77557b3c5abfb33a78e63b6b' + 'SKIP') + +pkgver() { + cd "${srcdir}/maraschino" + git describe --long | sed -E 's/([^-]*-g)/r\1/;s/-/./g' } package() { - # Make destination directory - install -d ${pkgdir}/opt/ + # Make destination directories + install -d "${pkgdir}/usr/lib" + install -d "${pkgdir}/var/lib/maraschino" + install -dm777 "${pkgdir}/run/maraschino" - # Move Maraschino files to destintion directory - cp -r ${srcdir}/${_gitname} ${pkgdir}/opt/maraschino + # Move Maraschino files to destination directory + cp -r "${srcdir}/maraschino" "${pkgdir}/usr/lib/maraschino" # Install Launcher Script install -D -m755 "${srcdir}/maraschino.sh" \ @@ -49,12 +40,8 @@ package() { install -D -m755 "${srcdir}/maraschino.service" \ "${pkgdir}/usr/lib/systemd/system/maraschino.service" - # Install Daemon Script - install -D -m755 "${srcdir}/maraschino.rc" \ - "${pkgdir}/etc/rc.d/maraschino" - # Install Daemon Configuration - install -D -m644 "${srcdir}/maraschino/default" \ + install -D -m644 "${srcdir}/maraschino.confd" \ "${pkgdir}/etc/conf.d/maraschino" } diff --git a/maraschino.confd b/maraschino.confd new file mode 100644 index 000000000000..f0e8f826bf9b --- /dev/null +++ b/maraschino.confd @@ -0,0 +1,2 @@ +MC_PORT="7000" +MC_DATA="/var/lib/maraschino" diff --git a/maraschino.install b/maraschino.install new file mode 100644 index 000000000000..f36f4e3beb60 --- /dev/null +++ b/maraschino.install @@ -0,0 +1,26 @@ +MC_USER="maraschino" +MC_GROUP="maraschino" +MC_DIR="/usr/lib/maraschino" +MC_SETTINGS_DIR="/var/lib/maraschino" + +## arg 1: the new package version +post_install() { + groupadd ${MC_GROUP} &> /dev/null + useradd -g ${MC_GROUP} -d ${MC_DIR} -s /bin/false ${MC_USER} &> /dev/null + chown -R ${MC_USER}:${MC_GROUP} ${MC_DIR} + chown -R ${MC_USER}:${MC_GROUP} ${MC_SETTINGS_DIR} +} + +## arg 1: the new package version +## arg 2: the old package version +post_upgrade() { + chown -R ${MC_USER}:${MC_GROUP} ${MC_DIR} + chown -R ${MC_USER}:${MC_GROUP} ${MC_SETTINGS_DIR} +} + +## arg 1: the old package version +post_remove() { + userdel ${MC_USER} &> /dev/null + groupdel ${MC_GROUP} &> /dev/null || /bin/true +} + diff --git a/maraschino.rc b/maraschino.rc deleted file mode 100644 index 602a8ee77aa1..000000000000 --- a/maraschino.rc +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions -. /etc/conf.d/maraschino - -case "$1" in - start) - stat_busy "Starting Maraschino" - - if [ -f /var/run/daemons/maraschino ]; then - echo -n "Maraschino is already running as a daemon! If you are certain it is not running, remove /var/run/daemons/maraschino." - stat_fail - else - maraschino -p $PORT -d --pidfile=$PID_FILE > /dev/null 2>&1 & - if [ $? -gt 0 ]; then - stat_fail - else - add_daemon maraschino - stat_done - fi - fi - ;; - stop) - stat_busy "Stopping Maraschino" - - PID=`ps ax | grep 'python2 /opt/maraschino/Maraschino.py' | awk '{print $1}'` - - [ -n "$PID" ] && kill $PID &>/dev/null ] - - if [ "${?}" -gt 0 ]; then - stat_fail - else - rm_daemon maraschino - stat_done - fi - ;; - restart) - "${0}" stop - sleep 1 - "${0}" start - ;; - *) - echo "usage: ${0} {start|stop|restart}" -esac -exit 0 - diff --git a/maraschino.service b/maraschino.service index 4c15947d63af..bbf2fac83a18 100644 --- a/maraschino.service +++ b/maraschino.service @@ -1,13 +1,15 @@ [Unit] Description=Maraschino Daemon +After=network.target [Service] EnvironmentFile=/etc/conf.d/maraschino -ExecStart=/usr/bin/maraschino -d -p ${PORT} -GuessMainPID=no +ExecStart=/usr/bin/maraschino -d -p ${MC_PORT} --datadir ${MC_DATA} --pidfile /run/maraschino/maraschino.pid +PIDFile=/run/maraschino/maraschino.pid Type=forking -User=root -Group=root +User=maraschino +Group=maraschino [Install] WantedBy=multi-user.target + diff --git a/maraschino.sh b/maraschino.sh index 022ee266ddc2..24cdaea2404d 100644 --- a/maraschino.sh +++ b/maraschino.sh @@ -1,3 +1,3 @@ #!/bin/sh -python2 /opt/maraschino/Maraschino.py "$@" +python2 /usr/lib/maraschino/Maraschino.py "$@" |