fix(main/mpc): use termux's mpd socket if --host is not given

Previously mpc had to be run with '--host $PREFIX/var/run/mpd.socket',
or else we got:

  MPD error: Connection refused

Patch mpd to use our socket if --host option is omitted, so that it
works without extra options.
This commit is contained in:
Henrik Grimler 2022-07-28 21:40:35 +02:00
parent 52eff4a81c
commit bcb81f5d35
No known key found for this signature in database
GPG Key ID: B0076E490B71616B
2 changed files with 16 additions and 1 deletions

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Minimalist command line interface for MPD"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.34
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://www.musicpd.org/download/mpc/${TERMUX_PKG_VERSION:0:1}/mpc-$TERMUX_PKG_VERSION.tar.xz
TERMUX_PKG_SHA256=691e3f3654bc10d022bb0310234d0bc2d8c075a698f09924d9ebed8f506fda20
TERMUX_PKG_DEPENDS="libiconv, libmpdclient"

View File

@ -0,0 +1,15 @@
--- ../options.c.orig 2022-07-28 21:21:13.150375029 +0200
+++ ./src/options.c 2022-07-28 21:25:59.500403799 +0200
@@ -304,7 +304,11 @@
option_error(ERROR_MISSING_ARGUMENT, opt->longopt, opt->argument);
/* Parse the password from the host */
- if (options.host != NULL &&
+ if (options.host == NULL) {
+ /* Use socket in @TERMUX_$PREFIX@/var/run/mpd.socket
+ if none was specified */
+ options.host = "@TERMUX_PREFIX@/var/run/mpd.socket";
+ } else if (options.host != NULL &&
(tmp = strchr(options.host, '@')) != NULL &&
/* if the host begins with a '@' then it's not an empty
password but an abstract socket */