[config] Build conf/service, added user/group name config

systemd service and config files populated with paths/users
Added user/group override options to configure
Added man ref in service file
This commit is contained in:
Scott Shambarger 2016-12-27 15:47:00 -08:00
parent 8b4b55b748
commit 17d3058147
5 changed files with 50 additions and 8 deletions

2
.gitignore vendored
View File

@ -29,6 +29,8 @@ missing
stamp-h1 stamp-h1
autotools-stamp autotools-stamp
build-stamp build-stamp
forked-daapd.conf
forked-daapd.service
# ignore debian packaging for convenience # ignore debian packaging for convenience
debian/ debian/

View File

@ -1,6 +1,11 @@
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
sysconf_DATA = forked-daapd.conf CONF_FILE = forked-daapd.conf
SYSTEMD_SERVICE_FILE = forked-daapd.service
sysconf_DATA = $(CONF_FILE)
BUILT_SOURCES = $(CONF_FILE) $(SYSTEMD_SERVICE_FILE)
SUBDIRS = sqlext src SUBDIRS = sqlext src
@ -17,8 +22,25 @@ nobase_dist_doc_DATA = \
scripts/pairinghelper.sh scripts/pairinghelper.sh
EXTRA_DIST = \ EXTRA_DIST = \
forked-daapd.conf $(CONF_FILE).in \
$(SYSTEMD_SERVICE_FILE).in
install-data-hook: install-data-hook:
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/$(PACKAGE)/libspotify" $(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/$(PACKAGE)/libspotify"
CLEANFILES = $(BUILT_SOURCES)
do_subst = sed -e 's|@sbindir[@]|$(sbindir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
-e 's|@PACKAGE[@]|$(PACKAGE)|g' \
-e 's|@DAAPD_USER[@]|$(DAAPD_USER)|g'
# these files use $prefix, which is determined at build (not configure) time
$(CONF_FILE) $(SYSTEMD_SERVICE_FILE): Makefile
$(AM_V_at)rm -f $@ $@-t
$(AM_V_GEN)$(do_subst) "$(srcdir)/$@.in" > $@-t
$(AM_V_at)mv $@-t $@
$(CONF_FILE): $(srcdir)/$(CONF_FILE).in
$(SYSTEMD_SERVICE_FILE): $(srcdir)/$(SYSTEMD_SERVICE_FILE).in

View File

@ -279,6 +279,23 @@ AS_IF([test "x$enable_mpd" != "xno"], [
AC_DEFINE(MPD, 1, [Define to 1 to enable MPD support]) AC_DEFINE(MPD, 1, [Define to 1 to enable MPD support])
]) ])
AM_CONDITIONAL(COND_MPD, [test "x$enable_mpd" != "xno"]) AM_CONDITIONAL(COND_MPD, [test "x$enable_mpd" != "xno"])
#
# Defining users and groups
#
AC_ARG_WITH([daapd_user],
[AS_HELP_STRING([--with-daapd-user=USER],
[User for running forked-daapd (default=daapd)])],
[test x"$withval" = xyes && withval=], [withval=])
DAAPD_USER=${withval:-daapd}
AC_SUBST(DAAPD_USER)
AC_ARG_WITH([daapd_group],
[AS_HELP_STRING([--with-daapd-group=GROUP],
[Group for daapd user (default=USER)])],
[test x"$withval" = xyes && withval=], [withval=])
DAAPD_GROUP=${withval:-$DAAPD_USER}
AC_SUBST(DAAPD_GROUP)
dnl --- End options --- dnl --- End options ---
dnl Checks for header files. dnl Checks for header files.

View File

@ -11,14 +11,14 @@ general {
# Username # Username
# Make sure the user has read access to the library directories you set # Make sure the user has read access to the library directories you set
# below, and full access to the databases, log and local audio # below, and full access to the databases, log and local audio
uid = "daapd" uid = "@DAAPD_USER@"
# Database location # Database location
# db_path = "/var/cache/forked-daapd/songs3.db" # db_path = "@localstatedir@/cache/@PACKAGE@/songs3.db"
# Log file and level # Log file and level
# Available levels: fatal, log, warning, info, debug, spam # Available levels: fatal, log, warning, info, debug, spam
logfile = "/var/log/forked-daapd.log" logfile = "@localstatedir@/log/@PACKAGE@.log"
loglevel = log loglevel = log
# Admin password for the non-existent web interface # Admin password for the non-existent web interface
@ -28,7 +28,7 @@ general {
ipv6 = yes ipv6 = yes
# Location of cache database # Location of cache database
# cache_path = "/var/cache/forked-daapd/cache.db" # cache_path = "@localstatedir@/cache/@PACKAGE@/cache.db"
# DAAP requests that take longer than this threshold (in msec) get their # DAAP requests that take longer than this threshold (in msec) get their
# replies cached for next time. Set to 0 to disable caching. # replies cached for next time. Set to 0 to disable caching.
@ -203,7 +203,7 @@ audio {
# Spotify settings (only have effect if Spotify enabled - see README/INSTALL) # Spotify settings (only have effect if Spotify enabled - see README/INSTALL)
spotify { spotify {
# Directory where user settings should be stored (credentials) # Directory where user settings should be stored (credentials)
# settings_dir = "/var/cache/forked-daapd/libspotify" # settings_dir = "@localstatedir@/cache/@PACKAGE@/libspotify"
# Cache directory # Cache directory
# cache_dir = "/tmp" # cache_dir = "/tmp"

View File

@ -1,9 +1,10 @@
[Unit] [Unit]
Description=DAAP/DACP (iTunes), RSP and MPD server, supports AirPlay and Remote Description=DAAP/DACP (iTunes), RSP and MPD server, supports AirPlay and Remote
Documentation=man:forked-daapd(8)
After=network.target sound.target After=network.target sound.target
[Service] [Service]
ExecStart=/usr/sbin/forked-daapd -f ExecStart=@sbindir@/forked-daapd -f
# Restart, but not more than once every 10 minutes # Restart, but not more than once every 10 minutes
Restart=on-failure Restart=on-failure