On 2023/11/30 08:51, Edd Barrett wrote:
> Hi,
> 
> At the moment we encourage users to configure navidrome via command line
> arguments in the rc script.
> 
> Besides that being a bit crusty, the next version of navidrome supports
> subsonic "jukebox mode" which can't be configured via the command line (only
> via a config file).
> 
> This diff therefore makes the port install and use a config file.
> 
> While here, remove adding LOCALSTATEDIR to SUBST_VARS (it's already there), 
> and
> update a straggling VARBASE in the pkg README.
> 
> Questions:
>  - Did I use LOCALSTATEDIR correctly?

I would avoid overriding it. It's not "wrong" but is a bit unusual.
Specifically: drop the LOCALSTATEDIR setting in Makefile, use
${LOCALSTATEDIR}/navidrome in the toml file, keep the existing
${LOCALSTATEDIR}/navidrome in PLIST and use it in README.

>  - Do we need to mention this change on -current.html?

My rule of thumb: If the average user of the old version needs to make
changes for it to stay working, and it's not fairly obvious what to
do from the errors they'll see, and it's not part of normal upstream
documentation, then it may be worth adding to current.html.

(If the user has to make changes _before_ upgrading, then it's
definitely worth adding).

I think in this case, if the user has overridden flags it should stay
working, and the installed file seems to match what the old default
flags do, so probably no need to mention. But I don't run this software
myself so that's just from reading the diff.

> (Once this is in, I'll post a diff to update to the latest version)
> 
> Comments, OK?

see inline about the toml file

> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/audio/navidrome/Makefile,v
> diff -u -p -r1.14 Makefile
> --- Makefile  28 Nov 2023 06:22:47 -0000      1.14
> +++ Makefile  29 Nov 2023 19:20:26 -0000
> @@ -2,6 +2,7 @@ COMMENT =     modern music server and stream
>  
>  MODGO_MODNAME =      github.com/navidrome/navidrome
>  MODGO_VERSION =      v0.49.3
> +REVISION =   0
>  
>  DISTNAME =   navidrome-${MODGO_VERSION}
>  
> @@ -31,11 +32,16 @@ RUN_DEPENDS =             graphics/ffmpeg
>  
>  MODULES =            lang/go
>  
> -SUBST_VARS =         LOCALSTATEDIR
> +LOCALSTATEDIR =              ${BASELOCALSTATEDIR}/navidrome
>  
>  post-extract:
>       cd ${WRKSRC} && tar -C ${WRKSRC}/ui/ -zxf \
>               ${FULLDISTDIR}/navidrome-build-${MODGO_VERSION}.tar.gz
> +
> +post-install:
> +     ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/navidrome
> +     ${SUBST_CMD} -c -m 755 ${FILESDIR}/navidrome.toml \
> +             ${PREFIX}/share/examples/navidrome/navidrome.toml
>  
>  .include "modules.inc"
>  
> Index: files/navidrome.toml
> ===================================================================
> RCS file: files/navidrome.toml
> diff -N files/navidrome.toml
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ files/navidrome.toml      30 Nov 2023 08:25:59 -0000
> @@ -0,0 +1,15 @@
> +# The address to bind to.
> +#
> +# To allow other hosts to connect, change to "localhost".

0.0.0.0 rather than localhost. But according to
https://www.navidrome.org/docs/usage/configuration-options/ the default
is to bind to 0.0.0.0 _and_ ::, so it might be better for users to
comment this out if they want to allow connections from other hosts.
(Check that though, in case they really mean "listen to :: and hope it
sees v4 too", like so many other programs).

> +Address = "127.0.0.1"
> +
> +# Where Navidrome finds music.
> +#
> +# Make sure the _navidrome user has read access to the music files.
> +MusicFolder = "${LOCALSTATEDIR}/music"
> +
> +# Where Navidrome stores its database etc.
> +DataFolder = "${LOCALSTATEDIR}"
> +
> +# Uncomment to make logging more verbose.
> +#LogLevel = 'DEBUG'
> Index: pkg/PLIST
> ===================================================================
> RCS file: /cvs/ports/audio/navidrome/pkg/PLIST,v
> diff -u -p -r1.4 PLIST
> --- pkg/PLIST 28 Nov 2023 06:22:47 -0000      1.4
> +++ pkg/PLIST 29 Nov 2023 19:19:35 -0000
> @@ -4,8 +4,11 @@
>  @mode 755
>  @owner _navidrome
>  @group _navidrome
> -@sample ${LOCALSTATEDIR}/navidrome/
> -@sample ${LOCALSTATEDIR}/navidrome/music/
> +@sample ${LOCALSTATEDIR}/
> +@sample ${LOCALSTATEDIR}/music/
> +share/examples/navidrome/
> +share/examples/navidrome/navidrome.toml
> +@sample ${SYSCONFDIR}/navidrome.toml
>  @mode
>  @owner
>  @group
> Index: pkg/README
> ===================================================================
> RCS file: /cvs/ports/audio/navidrome/pkg/README,v
> diff -u -p -r1.2 README
> --- pkg/README        11 Mar 2022 18:20:21 -0000      1.2
> +++ pkg/README        30 Nov 2023 08:34:11 -0000
> @@ -2,20 +2,24 @@
>  | Running ${PKGSTEM} on OpenBSD
>  +-----------------------------------------------------------------------
>  
> +Config File
> +===========
> +
> +When using the included rc.d(8) script, ${PKGSTEM} uses the config file at
> +`${SYSCONFDIR}/navidrome.toml`.
> +
>  Adding Music
>  =============
>  
> -Music can be added by copying it to ${VARBASE}/navidrome/music/ or by 
> changing
> -the `--datafolder` directory used.
> +Music can be added by copying it to `${LOCALSTATEDIR}/music/` or by changing
> +`MusicFolder` in the config file.
>  
>  Web Interface
>  =============
>  
> -${PKGSTEM} serves up a web interface on:
> -
> -      http://localhost:4533
> +By default, ${PKGSTEM} serves up a web interface on:
>  
> -If you wish to listen on a different interface or change the location
> -${PKGSTEM} looks for music, you can modify it via rcctl:
> +      http://127.0.0.1:4533
>  
> -         # rcctl set navidrome flags -a 0.0.0.0 --datafolder /home/music
> +If you wish to listen on a different address, change the `Address` setting in
> +the config file.
> Index: pkg/navidrome.rc
> ===================================================================
> RCS file: /cvs/ports/audio/navidrome/pkg/navidrome.rc,v
> diff -u -p -r1.2 navidrome.rc
> --- pkg/navidrome.rc  11 Mar 2022 18:20:21 -0000      1.2
> +++ pkg/navidrome.rc  29 Nov 2023 18:58:43 -0000
> @@ -2,7 +2,7 @@
>  
>  daemon="${TRUEPREFIX}/bin/navidrome"
>  daemon_user="_navidrome"
> -daemon_flags="-a localhost --datafolder ${VARBASE}/navidrome --musicfolder 
> ${VARBASE}/navidrome/music"
> +daemon_flags="-c ${SYSCONFDIR}/navidrome.toml"
>  
>  . /etc/rc.d/rc.subr
>  
> 
> -- 
> Best Regards
> Edd Barrett
> 
> https://www.theunixzoo.co.uk
> 

Reply via email to