mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
hts-tvheadend: rework startscript
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
2e1ade42c9
commit
258ac994f9
@ -1,2 +1,5 @@
|
||||
0.99.2
|
||||
- rework start scripts
|
||||
|
||||
0.99.1
|
||||
- initial version hts-tvheadend-90e3570
|
||||
- initial version hts-tvheadend-90e3570
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
PKG_NAME="hts-tvheadend"
|
||||
PKG_VERSION="90e3570"
|
||||
PKG_REV="1"
|
||||
PKG_REV="2"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.lonelycoder.com/hts/tvheadend_overview.html"
|
||||
|
@ -20,64 +20,11 @@
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
XBMC_PID=$1
|
||||
APP=$2
|
||||
SCRIPT_DIR=$(dirname `readlink -f $0`)
|
||||
ADDON_DIR="$HOME/.xbmc/addons/service.multimedia.hts-tvheadend"
|
||||
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/service.multimedia.hts-tvheadend"
|
||||
PATH="${PATH}:${SCRIPT_DIR}/bin"
|
||||
LOG_FILE="${ADDON_HOME}/service.log"
|
||||
LOG_FILE="$ADDON_HOME/service.log"
|
||||
|
||||
cleanup() {
|
||||
local EXIT_STATUS=$1
|
||||
if [ -n "${EXIT_STATUS}" ];then
|
||||
EXIT_STATUS=0
|
||||
fi
|
||||
kill -15 "${APP_PID}"
|
||||
exit $EXIT_STATUS;
|
||||
}
|
||||
|
||||
# trap signals for clean shutdown
|
||||
trap cleanup 1 2 3 15
|
||||
|
||||
launch_app() {
|
||||
local PID
|
||||
eval "${APP} ${ARG} &>${LOG_FILE} &"
|
||||
APP_PID=$!
|
||||
}
|
||||
|
||||
pid_is_running() {
|
||||
local PID=${1}
|
||||
for IPID in `ps -o pid | sed 's/[A-Za-z]//g' | sed 's/\ //g'`;do
|
||||
if [ ${IPID} -eq ${PID} ];then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
app_prep() {
|
||||
TVHEADEND_ARG="-f -C -s -u root -g root -c $ADDON_HOME"
|
||||
|
||||
mkdir -p $ADDON_HOME
|
||||
ARG="-C -s -u root -g root -c $ADDON_HOME"
|
||||
|
||||
}
|
||||
|
||||
main() {
|
||||
app_prep
|
||||
launch_app "${APP}"
|
||||
pid_is_running "${XBMC_PID}"
|
||||
XBMC_RUNNING=$?
|
||||
pid_is_running "${APP_PID}"
|
||||
APP_RUNNING=$?
|
||||
|
||||
while [ $XBMC_RUNNING -eq 0 -a ${APP_RUNNING} -eq 0 ]; do
|
||||
sleep 1
|
||||
pid_is_running "${XBMC_PID}"
|
||||
XBMC_RUNNING=$?
|
||||
pid_is_running "${APP_PID}"
|
||||
APP_RUNNING=$?
|
||||
done
|
||||
}
|
||||
|
||||
main
|
||||
cleanup
|
||||
tvheadend $TVHEADEND_ARG &>$LOG_FILE
|
@ -20,18 +20,4 @@
|
||||
|
||||
import xbmc, time, os, subprocess
|
||||
|
||||
dir = os.path.realpath(os.path.dirname(__file__))
|
||||
script = 'start.sh'
|
||||
|
||||
launcher = os.path.join(dir, script)
|
||||
app = '/storage/.xbmc/addons/service.multimedia.hts-tvheadend/bin/tvheadend'
|
||||
|
||||
os.chmod(launcher, 0755)
|
||||
os.chmod(app, 0755)
|
||||
|
||||
args = [launcher, str(os.getpid()), app]
|
||||
|
||||
p = subprocess.Popen(args)
|
||||
print p.pid
|
||||
p.wait()
|
||||
os.exit(1)
|
||||
os.system("tvheadend.service")
|
||||
|
Loading…
x
Reference in New Issue
Block a user