From 6b3555bd90c4abd38c996c8d4ace733a76dba320 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sun, 5 Apr 2015 15:12:36 +0300 Subject: [PATCH] Add systemd configure option. Closes #921. --- configure | 28 ++++++++++++++++++++++++++++ configure.ac | 18 ++++++++++++++++++ unixconf.pri | 7 +++++++ 3 files changed, 53 insertions(+) diff --git a/configure b/configure index bbca616f5..b24512800 100755 --- a/configure +++ b/configure @@ -717,6 +717,7 @@ with_geoip_database_embedded with_qtsingleapplication enable_debug enable_gui +enable_systemd enable_webui enable_qt_dbus with_boost @@ -1369,6 +1370,7 @@ Optional Features: --enable-debug Enable debug build --disable-gui Disable the GUI for headless running. Disables QtDBus and the GeoIP Database. + --enable-systemd Install the systemd service file (GUI only). --disable-webui Disable the WebUI. --disable-qt-dbus Disable use of QtDBus (GUI only) @@ -4201,6 +4203,14 @@ else fi +# Check whether --enable-systemd was given. +if test "${enable_systemd+set}" = set; then : + enableval=$enable_systemd; +else + enable_systemd=no +fi + + # Check whether --enable-webui was given. if test "${enable_webui+set}" = set; then : enableval=$enable_webui; @@ -4380,6 +4390,7 @@ case "x$enable_gui" in #( "xyes") : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + enable_systemd=no QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG nogui" ;; #( "xno") : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -4393,6 +4404,23 @@ $as_echo "$enable_gui" >&6; } as_fn_error $? "Unknown option \"$enable_gui\". Use either \"yes\" or \"no\"." "$LINENO" 5 ;; esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install the systemd service file" >&5 +$as_echo_n "checking whether to install the systemd service file... " >&6; } +case "x$enable_systemd" in #( + "xyes") : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + QBT_ADD_CONFIG="$QBT_ADD_CONFIG systemd" ;; #( + "xno") : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG systemd" ;; #( + *) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_systemd" >&5 +$as_echo "$enable_systemd" >&6; } + as_fn_error $? "Unknown option \"$enable_systemd\". Use either \"yes\" or \"no\"." "$LINENO" 5 ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable the WebUI" >&5 $as_echo_n "checking whether to enable the WebUI... " >&6; } case "x$enable_webui" in #( diff --git a/configure.ac b/configure.ac index 30737bec2..35d449cf5 100644 --- a/configure.ac +++ b/configure.ac @@ -42,6 +42,12 @@ AC_ARG_ENABLE(gui, [], [enable_gui=yes]) +AC_ARG_ENABLE(systemd, + [AS_HELP_STRING([--enable-systemd], + [Install the systemd service file (GUI only).])], + [], + [enable_systemd=no]) + AC_ARG_ENABLE(webui, [AS_HELP_STRING([--disable-webui], [Disable the WebUI.])], @@ -84,6 +90,7 @@ AC_MSG_CHECKING([whether to enable the GUI]) AS_CASE(["x$enable_gui"], ["xyes"], [AC_MSG_RESULT([yes]) + enable_systemd=[no] QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG nogui"], ["xno"], [AC_MSG_RESULT([no]) @@ -93,6 +100,17 @@ AS_CASE(["x$enable_gui"], [AC_MSG_RESULT([$enable_gui]) AC_MSG_ERROR([Unknown option "$enable_gui". Use either "yes" or "no".])]) +AC_MSG_CHECKING([whether to install the systemd service file]) +AS_CASE(["x$enable_systemd"], + ["xyes"], + [AC_MSG_RESULT([yes]) + QBT_ADD_CONFIG="$QBT_ADD_CONFIG systemd"], + ["xno"], + [AC_MSG_RESULT([no]) + QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG systemd"], + [AC_MSG_RESULT([$enable_systemd]) + AC_MSG_ERROR([Unknown option "$enable_systemd". Use either "yes" or "no".])]) + AC_MSG_CHECKING([whether to enable the WebUI]) AS_CASE(["x$enable_webui"], ["xyes"], diff --git a/unixconf.pri b/unixconf.pri index a93f50c93..9884c5ef6 100644 --- a/unixconf.pri +++ b/unixconf.pri @@ -31,6 +31,13 @@ INSTALLS += man DIST_PATH = ../dist/unix +# Systemd Service file +nogui:systemd { + systemdService.files = $$DIST_PATH/systemd/qbittorrent-nox.service + systemdService.path = $$PREFIX/lib/systemd/system/ + INSTALLS += systemdService +} + # Menu Icon !nogui { menuicon.files = icons/qBittorrent.desktop