mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
kodi: service addons: force start "enabled" service addons on kodi start
so 96f1c0c is safe on oe-stables.
This commit is contained in:
parent
85dee53e91
commit
320762e06d
@ -1,52 +1,54 @@
|
|||||||
From 6746387ee5681508c40a8d02747f9c1f3a7cdbc2 Mon Sep 17 00:00:00 2001
|
From 5259de8dcb34a4a3caacfbff8afae05c48c739d6 Mon Sep 17 00:00:00 2001
|
||||||
From: Stefan Saraev <stefan@saraev.ca>
|
From: Stefan Saraev <stefan@saraev.ca>
|
||||||
Date: Fri, 8 Aug 2014 18:22:44 +0300
|
Date: Fri, 8 Aug 2014 18:22:44 +0300
|
||||||
Subject: [PATCH] use a wrapper to setup systemd services
|
Subject: [PATCH] use a wrapper to setup systemd services
|
||||||
|
|
||||||
---
|
---
|
||||||
xbmc/addons/Service.cpp | 12 ++++++++++++
|
xbmc/addons/Service.cpp | 14 ++++++++++++++
|
||||||
xbmc/addons/Service.h | 3 +++
|
xbmc/addons/Service.h | 3 +++
|
||||||
2 files changed, 15 insertions(+)
|
2 files changed, 17 insertions(+)
|
||||||
|
|
||||||
diff --git a/xbmc/addons/Service.cpp b/xbmc/addons/Service.cpp
|
diff --git a/xbmc/addons/Service.cpp b/xbmc/addons/Service.cpp
|
||||||
index c406b11..808f498 100644
|
index c406b11..3c7eef5 100644
|
||||||
--- a/xbmc/addons/Service.cpp
|
--- a/xbmc/addons/Service.cpp
|
||||||
+++ b/xbmc/addons/Service.cpp
|
+++ b/xbmc/addons/Service.cpp
|
||||||
@@ -53,6 +53,7 @@ AddonPtr CService::Clone() const
|
@@ -53,6 +53,9 @@ AddonPtr CService::Clone() const
|
||||||
bool CService::Start()
|
bool CService::Start()
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
+
|
||||||
|
+ CallOEWrapper(ID(), false, true);
|
||||||
+
|
+
|
||||||
switch (m_type)
|
switch (m_type)
|
||||||
{
|
{
|
||||||
#ifdef HAS_PYTHON
|
#ifdef HAS_PYTHON
|
||||||
@@ -113,13 +114,24 @@ void CService::BuildServiceType()
|
@@ -113,13 +116,24 @@ void CService::BuildServiceType()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+void CService::CallOEWrapper(const std::string& ID, bool disable)
|
+void CService::CallOEWrapper(const std::string& ID, bool disable, bool check)
|
||||||
+{
|
+{
|
||||||
+ char cmd[255];
|
+ char cmd[255];
|
||||||
+ snprintf(cmd, sizeof(cmd), "/usr/lib/openelec/systemd-addon-wrapper %s %d", ID.c_str(), disable);
|
+ snprintf(cmd, sizeof(cmd), "/usr/lib/openelec/systemd-addon-wrapper %s %d", ID.c_str(), disable, check);
|
||||||
+ system(cmd);
|
+ system(cmd);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
void CService::OnDisabled()
|
void CService::OnDisabled()
|
||||||
{
|
{
|
||||||
+ CallOEWrapper(ID(), true);
|
+ CallOEWrapper(ID(), true, false);
|
||||||
+
|
+
|
||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CService::OnEnabled()
|
void CService::OnEnabled()
|
||||||
{
|
{
|
||||||
+ CallOEWrapper(ID(), false);
|
+ CallOEWrapper(ID(), false, false);
|
||||||
+
|
+
|
||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/xbmc/addons/Service.h b/xbmc/addons/Service.h
|
diff --git a/xbmc/addons/Service.h b/xbmc/addons/Service.h
|
||||||
index 98ec8b6..36e4109 100644
|
index 98ec8b6..accd9e2 100644
|
||||||
--- a/xbmc/addons/Service.h
|
--- a/xbmc/addons/Service.h
|
||||||
+++ b/xbmc/addons/Service.h
|
+++ b/xbmc/addons/Service.h
|
||||||
@@ -47,6 +47,9 @@ namespace ADDON
|
@@ -47,6 +47,9 @@ namespace ADDON
|
||||||
@ -54,7 +56,7 @@ index 98ec8b6..36e4109 100644
|
|||||||
TYPE GetServiceType() { return m_type; }
|
TYPE GetServiceType() { return m_type; }
|
||||||
START_OPTION GetStartOption() { return m_startOption; }
|
START_OPTION GetStartOption() { return m_startOption; }
|
||||||
+
|
+
|
||||||
+ void CallOEWrapper(const std::string& ID, bool disable);
|
+ void CallOEWrapper(const std::string& ID, bool disable, bool check);
|
||||||
+
|
+
|
||||||
virtual void OnDisabled();
|
virtual void OnDisabled();
|
||||||
virtual void OnEnabled();
|
virtual void OnEnabled();
|
||||||
|
@ -22,7 +22,13 @@ if [ ! -d /storage/.config/system.d ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "/storage/.kodi/addons/$1/system.d/$1.service" ] ; then
|
if [ -f "/storage/.kodi/addons/$1/system.d/$1.service" ] ; then
|
||||||
if [ $2 -eq 1 ] ; then
|
if [ "_$3" = "_1" ] ; then
|
||||||
|
# check if enabled, on kodi start
|
||||||
|
if ! systemctl is-enabled "$1.service" &>/dev/null ; then
|
||||||
|
systemctl enable "/storage/.kodi/addons/$1/system.d/$1.service"
|
||||||
|
systemctl start "$1.service"
|
||||||
|
fi
|
||||||
|
elif [ "_$2" = "_1" ] ; then
|
||||||
# disable = true: cleanup
|
# disable = true: cleanup
|
||||||
systemctl stop "$1.service"
|
systemctl stop "$1.service"
|
||||||
systemctl disable "/storage/.kodi/addons/$1/system.d/$1.service"
|
systemctl disable "/storage/.kodi/addons/$1/system.d/$1.service"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user