1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-22 17:10:26 +00:00

Merge pull request #148 from unknownloner/master

Allow MPD Password to be configured in command line options
This commit is contained in:
Andy 2018-01-22 04:23:51 +01:00 committed by GitHub
commit f7aade410d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 3 deletions

View File

@ -35,7 +35,7 @@ WEB_PORT=8080
# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS
DAEMON_OPT="--user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT"
DAEMON_OPT="--user $YMPD_USER --mpdpass '$MPD_PASSWORD' --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT"
do_start()
{

View File

@ -1,4 +1,5 @@
MPD_HOST=localhost
MPD_PORT=6600
MPD_PASSWORD=
WEB_PORT=8080
YMPD_USER=nobody

View File

@ -5,10 +5,11 @@ Requires=network.target local-fs.target
[Service]
Environment=MPD_HOST=localhost
Environment=MPD_PORT=6600
Environment=MPD_PASSWORD=
Environment=WEB_PORT=8080
Environment=YMPD_USER=nobody
EnvironmentFile=/etc/default/ympd
ExecStart=/usr/bin/ympd --user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT
ExecStart=/usr/bin/ympd --user $YMPD_USER --mpdpass "$MPD_PASSWORD" --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT
Type=simple
[Install]

View File

@ -87,10 +87,11 @@ int main(int argc, char **argv)
{"user", required_argument, 0, 'u'},
{"version", no_argument, 0, 'v'},
{"help", no_argument, 0, 0 },
{"mpdpass", required_argument, 0, 'm'},
{0, 0, 0, 0 }
};
while((n = getopt_long(argc, argv, "h:p:w:u:v",
while((n = getopt_long(argc, argv, "h:p:w:u:vm:",
long_options, &option_index)) != -1) {
switch (n) {
case 'h':
@ -105,6 +106,9 @@ int main(int argc, char **argv)
case 'u':
run_as_user = strdup(optarg);
break;
case 'm':
mpd.password = strdup(optarg);
break;
case 'v':
fprintf(stdout, "ympd %d.%d.%d\n"
"Copyright (C) 2014 Andrew Karpow <andy@ndyk.de>\n"
@ -119,6 +123,7 @@ int main(int argc, char **argv)
" -w, --webport [ip:]<port>\tlisten interface/port for webserver [8080]\n"
" -u, --user <username>\t\tdrop priviliges to user after socket bind\n"
" -V, --version\t\t\tget version\n"
" -m, --mpdpass <password>\tspecifies the password to use when connecting to mpd\n"
" --help\t\t\t\tthis help\n"
, argv[0]);
return EXIT_FAILURE;

3
ympd.1
View File

@ -23,6 +23,9 @@ specifies the port for the webserver to listen to, defaults to 8080
\fB\-u\fR, \fB\-\-user username\fR
drop privileges to the provided username after socket binding
.TP
\fB\-m\fR, \fB\-\-mpdpass password\fR
specifies the password to use when connecting to mpd
.TP
\fB\-V\fR, \fB\-\-version\fR
print version and exit
.TP