Skip to contentSkip to conversation

package/tvheadend: change configuration directory

PATCH New Damjan Marion 3 participants 10 messages Nov 28, 2016 – Dec 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/tvheadend: change configuration directory

Currently tvheadend configuration is stored in /home/tvheadend/.hts/tvheadend. This patch changes this location to /etc/tvheadend which seems to be more appropriate place.

---
 package/tvheadend/S99tvheadend | 4 ++--
 package/tvheadend/tvheadend.mk | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)
package/tvheadend/S99tvheadend +2 -2
index 65669ce..98167bf 100644
@@ -13,7 +13,7 @@ PIDFILE=/var/run/$NAME.pid
 # Read configuration variable file if it is present
 [ -r "/etc/default/${NAME}" ] && . "/etc/default/${NAME}"
 
-ARGS="-f"
+ARGS="-f -c /etc/tvheadend"
 [ -z "${TVH_USER}"      ] || ARGS="${ARGS} -u ${TVH_USER}"
 [ -z "${TVH_GROUP}"     ] || ARGS="${ARGS} -g ${TVH_GROUP}"
 [ -z "${TVH_ADAPTERS}"  ] || ARGS="${ARGS} -a ${TVH_ADAPTERS}"
@@ -22,7 +22,7 @@ ARGS="-f"
 [ "${TVH_DEBUG}" = "1"  ] && ARGS="${ARGS} -s"
 
 # If first run, start in wizard mode
-if [ -z "$(ls -1 /home/tvheadend/.hts/tvheadend/accesscontrol/ 2>/dev/null)" ]; then
+if [ -z "$(ls -1 /etc/tvheadend/accesscontrol/ 2>/dev/null)" ]; then
     ARGS="${ARGS} -C"
 fi
 
package/tvheadend/tvheadend.mk +3 -2
index a3afec8..11e56b6 100644
@@ -93,6 +93,7 @@ endef
 
 define TVHEADEND_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(TARGET_DIR)" install
+	mkdir -p $(TARGET_DIR)/etc/tvheadend
 endef
 
 # Remove documentation and source files that are not needed because we
@@ -116,10 +117,10 @@ define TVHEADEND_INSTALL_INIT_SYSV
 endef
 
 define TVHEADEND_USERS
-	tvheadend -1 tvheadend -1 * /home/tvheadend - video TVHeadend daemon
+	tvheadend -1 tvheadend -1 * - - video TVHeadend daemon
 endef
 define TVHEADEND_PERMISSIONS
-	/home/tvheadend r 0700 tvheadend tvheadend - - - - -
+	/etc/tvheadend r 0700 tvheadend tvheadend - - - - -
 endef
 
 $(eval $(generic-package))
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/1 package/tvheadend: change configuration directory

Hello,

I'm adding Yann E. Morin and Bernd Kuhls in Cc, since they are listed in our DEVELOPERS file for this package. Yann, Bernd, could you have a look at the below patch?

Damjan: next time, could you use our get-developers script to get the proper list of recipients for your patches, so that the appropriate developers get automatically Cc'ed?

Thanks!

Thomas

Quoted 57 lines · Damjan Marion

Currently tvheadend configuration is stored in /home/tvheadend/.hts/tvheadend. This patch changes this location to /etc/tvheadend which seems to be more appropriate place.

---
 package/tvheadend/S99tvheadend | 4 ++--
 package/tvheadend/tvheadend.mk | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)
package/tvheadend/S99tvheadend +2 -2
index 65669ce..98167bf 100644
@@ -13,7 +13,7 @@ PIDFILE=/var/run/$NAME.pid
 # Read configuration variable file if it is present
 [ -r "/etc/default/${NAME}" ] && . "/etc/default/${NAME}"
 
-ARGS="-f"
+ARGS="-f -c /etc/tvheadend"
 [ -z "${TVH_USER}"      ] || ARGS="${ARGS} -u ${TVH_USER}"
 [ -z "${TVH_GROUP}"     ] || ARGS="${ARGS} -g ${TVH_GROUP}"
 [ -z "${TVH_ADAPTERS}"  ] || ARGS="${ARGS} -a ${TVH_ADAPTERS}"
@@ -22,7 +22,7 @@ ARGS="-f"
 [ "${TVH_DEBUG}" = "1"  ] && ARGS="${ARGS} -s"
 
 # If first run, start in wizard mode
-if [ -z "$(ls -1 /home/tvheadend/.hts/tvheadend/accesscontrol/ 2>/dev/null)" ]; then
+if [ -z "$(ls -1 /etc/tvheadend/accesscontrol/ 2>/dev/null)" ]; then
     ARGS="${ARGS} -C"
 fi
 
package/tvheadend/tvheadend.mk +3 -2
index a3afec8..11e56b6 100644
@@ -93,6 +93,7 @@ endef
 
 define TVHEADEND_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(TARGET_DIR)" install
+	mkdir -p $(TARGET_DIR)/etc/tvheadend
 endef
 
 # Remove documentation and source files that are not needed because we
@@ -116,10 +117,10 @@ define TVHEADEND_INSTALL_INIT_SYSV
 endef
 
 define TVHEADEND_USERS
-	tvheadend -1 tvheadend -1 * /home/tvheadend - video TVHeadend daemon
+	tvheadend -1 tvheadend -1 * - - video TVHeadend daemon
 endef
 define TVHEADEND_PERMISSIONS
-	/home/tvheadend r 0700 tvheadend tvheadend - - - - -
+	/etc/tvheadend r 0700 tvheadend tvheadend - - - - -
 endef
 
 $(eval $(generic-package))
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 package/tvheadend: change configuration directory

In reply to Damjan Marion

Damjan, All,

On 2016-11-28 10:45 +0100, Damjan Marion spake thusly:

Quoted 3 lines

Currently tvheadend configuration is stored in /home/tvheadend/.hts/tvheadend. This patch changes this location to /etc/tvheadend which seems to be more appropriate place.

I disagree. This location is not only about "configuration" but also about "state". It contains user-specified settings, recordings, DVB scan status...

For example, accesscontrol can be updated from the WebUI to add/remopve users or change their rights. I don't remember the full set of stuff that gets in there, but there's almost no "configuration", but mostly "settings" than can be updated a lot; the most ovious being records (not the media streams, but the settings like channel, start and end times...)

Besides, /etc can be read-only, and we need a writable location. And /etc is not a correct location to expect to be writable. /home is most probably writable by users (although we do not provide that guarantee in Buildroot, it is still much better than /etc).

So, it does not belong to /etc.

What was your rationale for moving it, besides "it seems more appropriate" ?

Regards,
Yann E. MORIN.

Quoted 60 lines
---
 package/tvheadend/S99tvheadend | 4 ++--
 package/tvheadend/tvheadend.mk | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)
package/tvheadend/S99tvheadend +2 -2
index 65669ce..98167bf 100644
@@ -13,7 +13,7 @@ PIDFILE=/var/run/$NAME.pid
 # Read configuration variable file if it is present
 [ -r "/etc/default/${NAME}" ] && . "/etc/default/${NAME}"
 
-ARGS="-f"
+ARGS="-f -c /etc/tvheadend"
 [ -z "${TVH_USER}"      ] || ARGS="${ARGS} -u ${TVH_USER}"
 [ -z "${TVH_GROUP}"     ] || ARGS="${ARGS} -g ${TVH_GROUP}"
 [ -z "${TVH_ADAPTERS}"  ] || ARGS="${ARGS} -a ${TVH_ADAPTERS}"
@@ -22,7 +22,7 @@ ARGS="-f"
 [ "${TVH_DEBUG}" = "1"  ] && ARGS="${ARGS} -s"
 
 # If first run, start in wizard mode
-if [ -z "$(ls -1 /home/tvheadend/.hts/tvheadend/accesscontrol/ 2>/dev/null)" ]; then
+if [ -z "$(ls -1 /etc/tvheadend/accesscontrol/ 2>/dev/null)" ]; then
     ARGS="${ARGS} -C"
 fi
 
package/tvheadend/tvheadend.mk +3 -2
index a3afec8..11e56b6 100644
@@ -93,6 +93,7 @@ endef
 
 define TVHEADEND_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(TARGET_DIR)" install
+	mkdir -p $(TARGET_DIR)/etc/tvheadend
 endef
 
 # Remove documentation and source files that are not needed because we
@@ -116,10 +117,10 @@ define TVHEADEND_INSTALL_INIT_SYSV
 endef
 
 define TVHEADEND_USERS
-	tvheadend -1 tvheadend -1 * /home/tvheadend - video TVHeadend daemon
+	tvheadend -1 tvheadend -1 * - - video TVHeadend daemon
 endef
 define TVHEADEND_PERMISSIONS
-	/home/tvheadend r 0700 tvheadend tvheadend - - - - -
+	/etc/tvheadend r 0700 tvheadend tvheadend - - - - -
 endef
 
 $(eval $(generic-package))
Signature · 6 lines
2.9.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 package/tvheadend: change configuration directory

Hello,

Quoted 15 lines · Yann E. MORIN

On 2016-11-28 10:45 +0100, Damjan Marion spake thusly:

Quoted 3 lines

Currently tvheadend configuration is stored in /home/tvheadend/.hts/tvheadend. This patch changes this location to /etc/tvheadend which seems to be more appropriate place.

I disagree. This location is not only about "configuration" but also about "state". It contains user-specified settings, recordings, DVB scan status...

For example, accesscontrol can be updated from the WebUI to add/remopve users or change their rights. I don't remember the full set of stuff that gets in there, but there's almost no "configuration", but mostly "settings" than can be updated a lot; the most ovious being records (not the media streams, but the settings like channel, start and end times...)

Quoted 8 lines

Besides, /etc can be read-only, and we need a writable location. And /etc is not a correct location to expect to be writable. /home is most probably writable by users (although we do not provide that guarantee in Buildroot, it is still much better than /etc).

So, it does not belong to /etc.

What was your rationale for moving it, besides "it seems more appropriate" ?

Could we have the configuration in /etc and the state in /var, like most sane Linux daemons do?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 package/tvheadend: change configuration directory

Quoted 27 lines · Thomas Petazzoni

Hello,

Quoted 20 lines · Yann E. MORIN

On 2016-11-28 10:45 +0100, Damjan Marion spake thusly:

Quoted 3 lines

Currently tvheadend configuration is stored in /home/tvheadend/.hts/tvheadend. This patch changes this location to /etc/tvheadend which seems to be more appropriate place.

I disagree. This location is not only about "configuration" but also about "state". It contains user-specified settings, recordings, DVB scan status...

For example, accesscontrol can be updated from the WebUI to add/remopve users or change their rights. I don't remember the full set of stuff that gets in there, but there's almost no "configuration", but mostly "settings" than can be updated a lot; the most ovious being records (not the media streams, but the settings like channel, start and end times...)

Besides, /etc can be read-only, and we need a writable location. And /etc is not a correct location to expect to be writable. /home is most probably writable by users (although we do not provide that guarantee in Buildroot, it is still much better than /etc).

Quoted 6 lines
Quoted 3 lines

So, it does not belong to /etc.

What was your rationale for moving it, besides "it seems more appropriate" ?

Could we have the configuration in /etc and the state in /var, like most sane Linux daemons do?

+1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1600 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20161130/c06fbff0/attachment.p7s>

#5 lore raw

PATCH 1/1 package/tvheadend: change configuration directory

Hello,

Quoted 4 lines · Damjan Marion
Quoted 2 lines

Could we have the configuration in /etc and the state in /var, like most sane Linux daemons do?

+1

Well a +1 here is not really useful. A patch or at least initial investigation of the feasibility would be a lot more useful :-)

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#6 lore raw

PATCH 1/1 package/tvheadend: change configuration directory

Quoted 7 lines · Thomas Petazzoni

Hello,

On Wed, 30 Nov 2016 23:28:30 +0100, Damjan Marion wrote:

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Could we have the configuration in /etc and the state in /var, like most sane Linux daemons do?

+1

Well a +1 here is not really useful. A patch or at least initial investigation of the feasibility would be a lot more useful :-)

I can resubmit the patch if we all agree that /var is better place.
I just wanted to say that I agree with you...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1600 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20161130/ec8a0819/attachment.p7s>

#7 lore raw

PATCH 1/1 package/tvheadend: change configuration directory

Hello,

Quoted 5 lines · Damjan Marion
Quoted 2 lines

Well a +1 here is not really useful. A patch or at least initial investigation of the feasibility would be a lot more useful :-)

I can resubmit the patch if we all agree that /var is better place. I just wanted to say that I agree with you...

Well, the problem is that your change would put both the configuration and state into /var. While the correct thing is to have the configuration in /etc and the state in /var.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#8 lore raw

PATCH 1/1 package/tvheadend: change configuration directory

Quoted 10 lines · Thomas Petazzoni

Hello,

Quoted 3 lines · Damjan Marion
Quoted 2 lines

Well a +1 here is not really useful. A patch or at least initial investigation of the feasibility would be a lot more useful :-)

Quoted 6 lines
Quoted 2 lines

I can resubmit the patch if we all agree that /var is better place. I just wanted to say that I agree with you...

Well, the problem is that your change would put both the configuration and state into /var. While the correct thing is to have the configuration in /etc and the state in /var.

tvheadend doesn?t have static configuration beside few command line parameters which are already in /etc/default/tvheadend.
Everything else is in json encoded files and it is changed via web ui.
i.e. when you add new user via web ui, daemon will create new json file with all user parameters.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1600 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20161201/ce72ca5a/attachment.p7s>

#9 lore raw

PATCH 1/1 package/tvheadend: change configuration directory

In reply to Yann E. MORIN
Quoted 20 lines · Yann E. MORIN

Damjan, All,

On 2016-11-28 10:45 +0100, Damjan Marion spake thusly:

Quoted 3 lines

Currently tvheadend configuration is stored in /home/tvheadend/.hts/tvheadend. This patch changes this location to /etc/tvheadend which seems to be more appropriate place.

I disagree. This location is not only about "configuration" but also about "state". It contains user-specified settings, recordings, DVB scan status...

For example, accesscontrol can be updated from the WebUI to add/remopve users or change their rights. I don't remember the full set of stuff that gets in there, but there's almost no "configuration", but mostly "settings" than can be updated a lot; the most ovious being records (not the media streams, but the settings like channel, start and end times...)

Quoted 6 lines

Besides, /etc can be read-only, and we need a writable location. And /etc is not a correct location to expect to be writable. /home is most probably writable by users (although we do not provide that guarantee in Buildroot, it is still much better than /etc).

So, it does not belong to /etc.

ack, what about /var/tvheadend ?

Quoted 2 lines

What was your rationale for moving it, besides "it seems more appropriate? ?

nothing critical, just having same behavior like other system daemons I newer saw before system daemon storing it?s data in the user folder.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1600 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20161130/6041edb8/attachment.p7s>