From 17d054bc9fb02bbb557f9de68e29e715a17f3ee6 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Mon, 12 Jun 2017 22:22:51 +0200 Subject: [PATCH] Patch system daemon for Arch-friendliness --- cdemu-daemon/CMakeLists.txt | 15 ++++++++++++++- cdemu-daemon/system/cdemu-daemon-dbus.conf | 9 +++++++-- cdemu-daemon/system/cdemu-daemon-system.sh | 6 +++--- cdemu-daemon/system/cdemu-daemon.conf | 8 ++++++++ cdemu-daemon/system/cdemu-daemon.service.in | 10 ++++++++++ cdemu-daemon/system/net.sf.cdemu.CDEmuDaemon.service.in | 4 ++-- 6 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 cdemu-daemon/system/cdemu-daemon.conf create mode 100644 cdemu-daemon/system/cdemu-daemon.service.in diff --git a/cdemu-daemon/CMakeLists.txt b/cdemu-daemon/CMakeLists.txt index 76feb818d09a57af..c6abd56b82484b6f 100644 --- a/cdemu-daemon/CMakeLists.txt +++ b/cdemu-daemon/CMakeLists.txt @@ -15,7 +15,7 @@ set (CDEMU_DAEMON_INTERFACE_VERSION_MINOR 0) include (GNUInstallDirs) # Options -option (SYSTEM_BUS_SERVICE "Install CDEmu daemon as D-Bus system bus service" off) +option (SYSTEM_BUS_SERVICE "Install CDEmu daemon as D-Bus system bus service" on) option (SESSION_BUS_SERVICE "Install CDEmu daemon as D-Bus session bus service" on) # If install prefix is /usr, override the sysconf dir to be /etc instead of /usr/etc @@ -45,6 +45,10 @@ configure_file ( ${PROJECT_SOURCE_DIR}/system/net.sf.cdemu.CDEmuDaemon.service.in ${PROJECT_BINARY_DIR}/system/net.sf.cdemu.CDEmuDaemon.service ) +configure_file ( + ${PROJECT_SOURCE_DIR}/system/cdemu-daemon.service.in + ${PROJECT_BINARY_DIR}/system/cdemu-daemon.service +) # Global definitions add_definitions (-std=c99) # We're compiling using C99 @@ -121,13 +125,22 @@ if (SYSTEM_BUS_SERVICE) DESTINATION ${CMAKE_INSTALL_LIBEXECDIR} ) install ( + FILES ${PROJECT_BINARY_DIR}/system/cdemu-daemon.service + DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/system/ + ) + install ( FILES ${PROJECT_BINARY_DIR}/system/net.sf.cdemu.CDEmuDaemon.service DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/system-services/ ) install ( FILES system/cdemu-daemon-dbus.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/system.d ) + install ( + FILES system/cdemu-daemon.conf + RENAME cdemu-daemon + DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/conf.d + ) endif () # Translations; we use the version provided by our FindIntlTool.cmake diff --git a/cdemu-daemon/system/cdemu-daemon-dbus.conf b/cdemu-daemon/system/cdemu-daemon-dbus.conf index c450d78cf03bce6a..e86b62cf0437a9fd 100644 --- a/cdemu-daemon/system/cdemu-daemon-dbus.conf +++ b/cdemu-daemon/system/cdemu-daemon-dbus.conf @@ -11,8 +11,13 @@ - - + + + + + + + diff --git a/cdemu-daemon/system/cdemu-daemon-system.sh b/cdemu-daemon/system/cdemu-daemon-system.sh index d9ab60aaff559400..735c24442a82e8bc 100755 --- a/cdemu-daemon/system/cdemu-daemon-system.sh +++ b/cdemu-daemon/system/cdemu-daemon-system.sh @@ -1,15 +1,15 @@ #!/bin/sh # Starts the CDEmu daemon instance on D-Bus *system* bus. Optional # configuration (number of devices, audio driver, log file) are read -# from /etc/sysconfig/cdemu-daemon +# from /etc/conf.d/cdemu-daemon # Default settings NUM_DEVICES=1 AUDIO_DRIVER=null -LOG_FILE=/tmp/cdemu-daemon.log +LOG_FILE=/var/log/cdemu-daemon.log # Read the settings -CONFIG_FILE=/etc/sysconfig/cdemu-daemon +CONFIG_FILE=/etc/conf.d/cdemu-daemon if [ -f ${CONFIG_FILE} ]; then . ${CONFIG_FILE}; diff --git a/cdemu-daemon/system/cdemu-daemon.conf b/cdemu-daemon/system/cdemu-daemon.conf new file mode 100644 index 0000000000000000..d0d6ecfebb77fbfb --- /dev/null +++ b/cdemu-daemon/system/cdemu-daemon.conf @@ -0,0 +1,8 @@ +# how many optical drives to emulate +#NUM_DEVICES=1 + +# audio backend (null, default, alsa, or pulse) +#AUDIO_DRIVER=null + +# log file +#LOG_FILE=/var/log/cdemu-daemon.log diff --git a/cdemu-daemon/system/cdemu-daemon.service.in b/cdemu-daemon/system/cdemu-daemon.service.in new file mode 100644 index 0000000000000000..43b5a61dc476e384 --- /dev/null +++ b/cdemu-daemon/system/cdemu-daemon.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=CDEmu Daemon + +[Service] +Type=dbus +BusName=net.sf.cdemu.CDEmuDaemon +ExecStart=@CMAKE_INSTALL_FULL_LIBEXECDIR@/cdemu-daemon-system.sh + +[Install] +WantedBy=multi-user.target diff --git a/cdemu-daemon/system/net.sf.cdemu.CDEmuDaemon.service.in b/cdemu-daemon/system/net.sf.cdemu.CDEmuDaemon.service.in index f9cf646b57c3563f..9004c310595273e4 100644 --- a/cdemu-daemon/system/net.sf.cdemu.CDEmuDaemon.service.in +++ b/cdemu-daemon/system/net.sf.cdemu.CDEmuDaemon.service.in @@ -1,5 +1,5 @@ [D-BUS Service] -Name=net.sf.cdemu.CdemuDaemon +Name=net.sf.cdemu.CDEmuDaemon Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/cdemu-daemon-system.sh User=root - +SystemdService=cdemu-daemon.service -- 2.13.1