updated sickrage-9999 init and ebuild
authordweezil <bram.aelvoet@gmail.com>
Fri, 24 Mar 2017 12:03:43 +0000 (13:03 +0100)
committerdweezil <bram.aelvoet@gmail.com>
Fri, 24 Mar 2017 12:03:43 +0000 (13:03 +0100)
net-nntp/sickrage/Manifest
net-nntp/sickrage/files/sickrage.init
net-nntp/sickrage/sickrage-9999.ebuild

index 821945d11959091b095c74a32e63d83c43501f2a..7c984dd965d7e19602a3eea2cfb0c7033c592c79 100644 (file)
@@ -1,5 +1,5 @@
 AUX sickrage.conf 1158 SHA256 9e82a4a397c8c2cbca7e4d956763f0b547eae5a2501ad7c13e1243cc9ce3d939 SHA512 d50c55df52dc89372b72411b312227d39c5227a2beb6f2e4fccd969fb2549039901fe72bf2326c0c8418663819e0a20a2a4320b6d9f832c6e3b517dc3c0627af WHIRLPOOL 3b5574deb95e9b59841e4ec8a63bf641e4208691d2c151f09ed35b81efdcef544f25229628621e0420b74f9af57999a3e50c5a50002939074e90dbc5d886308c
 AUX sickrage.ini 233 SHA256 d59678ce97a8d1b4f50cfbdc47919a21bd3a296ed002ad33e66cf617fa595825 SHA512 98bc1353828ecc151c30c4b3fdd14952f76988b7f3d00b1d849ea0ff57e9ce3023ae9297074a5e2ff2ab7305cc709db04f197dc2d837dd273c6f299123ef7271 WHIRLPOOL 52b9b3f22493694a414174c9041b7bc7bee040e826baf447e204247c66edb744dec2d23b812cb3dd0dea517df296f7ce8ce26b714ab6eddbfdb9fdcf8c4b46f9
-AUX sickrage.init 1245 SHA256 1ae46eb64b842090f826cabae0d1ccf3d503630c4c5ea905ce791de0b8940ab2 SHA512 a675f8cb57a169f2cf7d8d999b1c1a22ab4a2752d89ab979647533f0805b5fd726181dfe1b230e6269aeed9d546eff26839185dc958aac908864d21570b4220b WHIRLPOOL 233b4ea7d8b1e5ed4d7cef188ea7976e6d814dd14a63865e006552aa56065f650f9125d2a1825f3394cf137b4a3196dd016502faab596d4acf27c254b6a41af9
+AUX sickrage.init 1403 SHA256 00eaa7d977bb8d72f30a8adcf184994d5fd26bb5e524b43595e94f032443054f SHA512 609a641e882c8be2f7d8b3c27cb94e8e10b3f6b88a066ea721aa35875ef2ca0dcec2641ec8ff15a06b382bb9a88d4e4cffaec2c029f925eaeb3c68b85b67aea9 WHIRLPOOL cbdd92b8beb3ae95c22333ffe01d8141332153453c7bad00e1ad086dc1965d877630991b230cb408be492179e7eb7f8adb6e36240dab293abf5ff71d87ff9724
 AUX sickrage.logrotate 181 SHA256 dca1eccc37ddb03f44949507348ae0f1cc630e65e1d655733804a4b572c07736 SHA512 b8c33c70a11737230ae9f2a69ace3f41f2e6bc0a649a92ba36e7e572577018bb0634bf79e9864a46a35e9e6d147bae53f7c71673d56aae237c80b24e7134e58b WHIRLPOOL 0c4fe43e4ddb23cd0126c0e84c0b2dfbbd8ed26a3ff3399096be46b36686574d0dfd5775c3e7c0e7d263748caff08ed36f0b6bb36cbb6b347ef9bc9d7c63478d
-EBUILD sickrage-9999.ebuild 2464 SHA256 ef6614da579141524e39da531279984d73185250c8f0988b4b18dd4ca34769bc SHA512 2ef7bf28e37457c7e253a8ab20471ea4b3f05b3830750810238bbc90677910b90c8f5556ec4bb70a6badcba79f42d557b99422f1547814591a03615435670b72 WHIRLPOOL fd67d2a63deb087bd282278af7da1f742bb3e224328be4d800ecb2ee579f9d0d9a7dc7c7b1b015bc1e2615e446c55b81f6ac667e1fedbece3c610094b1f158e0
+EBUILD sickrage-9999.ebuild 2314 SHA256 110da6d64f536c228ac7c4b7cec45bfad3e0ffa24779e08266c94429a4fbfa9c SHA512 d35d665f2b506b5b442fd0ab3f3ddaf42a675a187c125fa271055df46d00e6f3612622ef0063ee1b0f0c0ebf90cd48a148ef4ea69cada293bb3b250010ecfd5b WHIRLPOOL 358a189f0263dcadb05d58366a9a273c8126bb3551dae78d2709e16c9874824c9e6d824f3e1a052700694d1ca42fea4a80b5fc5a6b8df347806136b45c1f28e5
index a9420a73d6fc23341619dd14948d3613012fe81c..14a94c131e23a77ec6996931d934454aba734052 100644 (file)
@@ -1,54 +1,52 @@
-#!/sbin/runscript
-# Copyright 1999-2015 Gentoo Foundation
+#!/sbin/openrc-run
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Header: $
 
 depend() {
-       need net
+        need net
 }
 
 run_dir="/var/run/sickrage"
-pidfile="${run_dir}/sickrage.pid"
+pidfile="$run_dir/sickrage.pid"
 etc_dir="/etc/sickrage"
-var_dir="/var/lib/sickrage"
+var_dir="/var/sickrage"
 log_dir="/var/log/sickrage"
-program="${CODE_DIR}/SickBeard.py"
-bin="$(which ${PYTHON_BIN})"
+program="/usr/share/sickrage/SickBeard.py"
+bin=`which $PYTHON_BIN`
 
 check_config() {
-       # Permission stuff. Should ensure that the daemon user always have write permissions, and avoid run_dir shenanigans.
-       checkpath -q -d -m 0755 -o ${USER}:${GROUP} "${run_dir}" "${var_dir}" "${etc_dir}" "${log_dir}"
-       checkpath -q -f -m 0770 -o ${USER}:${GROUP} "${etc_dir}/sickrage.ini"
-
-       if [ "${WEBUPDATER}" = "YES" ] ; then
-               checkpath -q -d -m 0755 -o ${USER}:${GROUP} "${CODE_DIR}"
+       
+       if [ ! -d "${run_dir}" ]; then
+               mkdir "${run_dir}"
        fi
+
+       # Permission stuff. Should ensure that the daemon user always have write permissions.
+       # Quick and ugly but should get the job done.
+
+       chown -R ${USER}:${GROUP} "${run_dir}"
+        chown -R ${USER}.${GROUP} "${var_dir}"
+       chown -R ${USER}.${GROUP} "${etc_dir}"
+       chown -R ${USER}.${GROUP} "${log_dir}"
+       if [ "${WEBUPDATER}" = "YES" ]; then
+                chown -R ${USER}.${GROUP} "${CODE_DIR}"
+        fi
 }
 
 start() {
        check_config
 
-       ebegin "Starting SickRage"
-       start-stop-daemon \
-               --start \
-               --user ${USER} \
-               --group ${GROUP} \
-               --umask ${UMASK} \
-               --name sickrage \
-               --background \
-               --pidfile ${pidfile} \
-               --exec ${bin} ${program} \
-               -- \
-               -d \
-               --pidfile ${pidfile} \
-               --datadir ${var_dir} \
-               --config ${CONFIG_FILE} \
-               --port ${PORT}
-       eend $?
+       sed -i "s/^cur_commit_hash.*/cur_commit_hash = `cat /usr/share/sickrage/version.txt`/" /etc/sickrage/sickrage.ini
+
+        ebegin "Starting SickRage"
+        start-stop-daemon --start --pidfile ${pidfile} -u ${USER} -g ${GROUP}\
+       --exec ${bin} ${program} -- \
+       --daemon --pidfile ${pidfile} --datadir ${var_dir} --nolaunch --config ${CONFIG_FILE} --port ${PORT}
+        eend $?
 }
 
 stop() {
-       ebegin "Stopping SickRage"
-       start-stop-daemon --stop --pidfile ${pidfile} --retry 30
-       eend $?
+        ebegin "Stopping SickRage"
+        start-stop-daemon --stop --pidfile ${pidfile} --retry 15
+        eend $?
 }
index d7b6ada75ff6324bbaff515bcae76300474c8c23..6a827e06aae9997ca6287e2ea72ad7c2a6c99431 100644 (file)
@@ -1,36 +1,30 @@
 # Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header$
+# $Header$
 
 EAPI=5
 
-PYTHON_DEPEND="2:2.7"
-PYTHON_USE_WITH="sqlite"
+PYTHON_COMPAT=( python2_6 python2_7 )
 
-EGIT_REPO_URI="https://github.com/SickRage/SickRage"
+EGIT_REPO_URI="https://github.com/SickRage/SickRage.git"
 
-inherit eutils user git-r3 python
+inherit eutils user git-2 python-any-r1
 
 DESCRIPTION="SickRage - Searches TheTVDB and TVRage for shows"
-HOMEPAGE="http://www.sickrage.tv/"
+HOMEPAGE="http://sickrage.github.io/"
 
 LICENSE="GPL-3" # only
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
 IUSE=""
 
+DEPEND="${PTYHON_DEPS}"
 RDEPEND="
        dev-python/cheetah
-       dev-python/pyopenssl
-       dev-python/cryptography
 "
 
-DOCS=( "readme.md" )
-
 pkg_setup() {
-       # Control PYTHON_USE_WITH
-       python_set_active_version 2
-       python_pkg_setup
+       python-any-r1_pkg_setup
 
        # Create sickrage group
        enewgroup ${PN}
@@ -39,18 +33,18 @@ pkg_setup() {
 }
 
 src_install() {
-       # Init script
-       newconfd "${FILESDIR}/${PN}.conf" "${PN}"
-       newinitd "${FILESDIR}/${PN}.init" "${PN}"
+       dodoc readme.md
+
+       newconfd "${FILESDIR}/${PN}.conf" ${PN}
+       newinitd "${FILESDIR}/${PN}.init" ${PN}
 
        # Location of log and data files
-       keepdir /var/lib/${PN}
-       fowners -R ${PN}:${PN} /var/lib/${PN}
+       keepdir /var/${PN}
+       fowners -R ${PN}:${PN} /var/${PN}
 
-       keepdir /var/lib/{${PN}/{cache,download},log/${PN}}
-       fowners -R ${PN}:${PN} /var/lib/{${PN}/{cache,download},log/${PN}}
+       keepdir /var/{${PN}/{cache,download},log/${PN}}
+       fowners -R ${PN}:${PN} /var/{${PN}/{cache,download},log/${PN}}
 
-       # Barebones config
        insinto /etc/${PN}
        insopts -m0660 -o ${PN} -g ${PN}
        doins "${FILESDIR}/${PN}.ini"
@@ -60,23 +54,28 @@ src_install() {
        insopts -m0644 -o root -g root
        newins "${FILESDIR}/${PN}.logrotate" ${PN}
 
-       # Generate the version tag ourselves...
-       sed -e "s/CUR_COMMIT_HASH = None/CUR_COMMIT_HASH = '${EGIT_VERSION}'/"  -i sickbeard/__init__.py
-       sed -e 's/self._cur_commit_hash = None/self._cur_commit_hash = sickbeard.CUR_COMMIT_HASH/' -i sickbeard/versionChecker.py
+       # weird stuff ;-)
+       last_commit=$(git rev-parse HEAD)
+       echo ${last_commit} > version.txt
 
-       # Umask trickery? Might only be used for internal data files (ie. /var/lib/${PN} & /var/log/${PN})?
-       sed -e "s/os.umask(prev and int('077', 8))/os.umask(prev and int('002', 8))/" -i SickBeard.py
+       insinto /usr/share/${PN}
+       doins -r contrib gui lib locale runscripts sickbeard sickrage tests SickBeard.py version.txt
 
-       # Install
-       insinto /usr/lib/${PN}
-       insopts -m0775 -o ${PN} -g ${PN}
-       doins -r contrib gui lib sickbeard sickrage tests SickBeard.py
+       fowners -R ${PN}:${PN} /usr/share/${PN}
 }
 
 pkg_postinst() {
-       python_mod_optimize /usr/lib/${PN}
 
-       elog "SickRage has been installed with data directories in /var/lib/${PN}"
+       # we need to remove .git which old ebuild installed
+       if [[ -d "/usr/share/${PN}/.git" ]] ; then
+          ewarn "stale files from previous ebuild detected"
+          ewarn "/usr/share/${PN}/.git removed."
+          ewarn "To ensure proper operation, you should unmerge package and remove directory /usr/share/${PN} and then emerge package again"
+          ewarn "Sorry for the inconvenience"
+          rm -Rf "/usr/share/${PN}/.git"
+       fi
+
+       elog "SickRage has been installed with data directories in /var/${PN}"
        elog
        elog "New user/group ${PN}/${PN} has been created"
        elog
@@ -89,7 +88,3 @@ pkg_postinst() {
        elog "Default web username/password : sickrage/secret"
        elog
 }
-
-pkg_postrm() {
-       python_mod_cleanup /usr/lib/${PN}
-}