diff --git a/application/application.pro b/application/application.pro
index cf833d0..41aafa3 100644
--- a/application/application.pro
+++ b/application/application.pro
@@ -14,6 +14,7 @@ TARGET = harbour-batterybuddy
CONFIG += console sailfishapp sailfishapp_i18n
+# Keep this in sync with "service.pro"
VER = 2.2
REL = 2
@@ -42,9 +43,7 @@ DISTFILES += qml/harbour-batterybuddy.qml \
qml/pages\LicensePage.qml \
qml/cover/CoverPage.qml \
../rpm/harbour-batterybuddy.spec \
- service/clear-write-permissions.sh \
service/harbour-batterybuddy.service \
- service/set-write-permissions.sh \
translations/*.ts \
harbour-batterybuddy.desktop \
qml/pages/MainPage.qml \
@@ -59,17 +58,14 @@ SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
TRANSLATIONS += translations/*.ts
-OTHER_FILES += service/clear-write-permissions.sh \
- service/harbour-batterybuddy.service \
- service/set-write-permissions.sh
+# Executable provided by "service.pro"
+OTHER_FILES += service/harbour-batterybuddy.service
service.files = service
service.path = /usr/share/$${TARGET}
INSTALLS += service
-SUBDIRS += service
-
# Begin: include sound files
#OTHER_FILES += sounds/upperLimit.ogg \
diff --git a/service/harbour-batterybuddy.service b/application/service/harbour-batterybuddy.service
similarity index 80%
rename from service/harbour-batterybuddy.service
rename to application/service/harbour-batterybuddy.service
index 2a073d0..a7a4be5 100644
--- a/service/harbour-batterybuddy.service
+++ b/application/service/harbour-batterybuddy.service
@@ -18,11 +18,7 @@
Description=Battery Buddy file permission daemon
[Service]
-Type=oneshot
-ExecStart=/usr/share/harbour-batterybuddy/service/set-write-permissions.sh
-RemainAfterExit=true
-ExecStop=/usr/share/harbour-batterybuddy/service/clear-write-permissions.sh
-StandardOutput=journal
+ExecStart=/usr/bin/harbour-batterybuddy-daemon
[Install]
WantedBy=multi-user.target
diff --git a/application/update-spec-version.sh b/application/update-spec-version.sh
index eaed225..1f987c1 100755
--- a/application/update-spec-version.sh
+++ b/application/update-spec-version.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-SPEC=rpm/$1.spec
+SPEC=../rpm/$1.spec
if [[ $(grep "^Version: $2$" $SPEC | wc -l) = 0 ]]
then
sed -i "/^Version: /c\Version: $2" $SPEC
diff --git a/rpm/harbour-batterybuddy.spec b/rpm/harbour-batterybuddy.spec
index 1279f0f..44ea69a 100644
--- a/rpm/harbour-batterybuddy.spec
+++ b/rpm/harbour-batterybuddy.spec
@@ -71,7 +71,6 @@ desktop-file-install --delete-original \
%posttrans
systemctl disable --now harbour-batterybuddy.service
cp %{_datadir}/%{name}/service/harbour-batterybuddy.service /etc/systemd/system/
-chmod 755 %{_datadir}/%{name}/service/*.sh
systemctl enable --now harbour-batterybuddy.service
%postun
diff --git a/service/clear-write-permissions.sh b/service/clear-write-permissions.sh
deleted file mode 100755
index 6cf0128..0000000
--- a/service/clear-write-permissions.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-# Battery Buddy, a Sailfish application to prolong battery lifetime
-#
-# Copyright (C) 2019-2020 Matti Viljanen
-#
-# Battery Buddy is free software: you can redistribute it and/or modify it under the terms of the
-# GNU General Public License as published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# Battery Buddy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-# See the GNU General Public License for more details. You should have received a copy of the GNU
-# General Public License along with Battery Buddy. If not, see .
-#
-# Author: Matti Viljanen
-
-chmod 644 /sys/class/power_supply/battery/input_suspend 2>/dev/null
-chmod 644 /sys/class/power_supply/battery/charging_enabled 2>/dev/null
-chmod 644 /sys/class/power_supply/usb/charger_disable 2>/dev/null
-exit 0
diff --git a/service/service.pro b/service/service.pro
index bf82242..ebb87f9 100644
--- a/service/service.pro
+++ b/service/service.pro
@@ -1,8 +1,16 @@
TARGET = harbour-batterybuddy-daemon
-CONFIG = qt c++11 sailfish_build
+CONFIG = qt console c++11 sailfish_build
-QT = dbus network xml
+QT = core network
+
+# Keep this in sync with "application.pro"
+VER = 2.2
+REL = 2
+
+VERSION = $${VER}-$${REL}
+DEFINES += APP_VERSION=\"\\\"$$VERSION\\\"\"
+DEFINES += APP_NAME=\"\\\"$$TARGET\\\"\"
HEADERS += \
src/filewatcher.h
@@ -13,8 +21,6 @@ SOURCES += \
OTHER_FILES += harbour-batterybuddy-daemon.service
-#include($$PWD/../common/common.pri)
-
service.path = /usr/lib/systemd/user/
service.files += harbour-batterybuddy-daemon.service
target.path = /usr/bin/
diff --git a/service/set-write-permissions.sh b/service/set-write-permissions.sh
deleted file mode 100755
index e7328a1..0000000
--- a/service/set-write-permissions.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-# Battery Buddy, a Sailfish application to prolong battery lifetime
-#
-# Copyright (C) 2019-2020 Matti Viljanen
-#
-# Battery Buddy is free software: you can redistribute it and/or modify it under the terms of the
-# GNU General Public License as published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# Battery Buddy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-# See the GNU General Public License for more details. You should have received a copy of the GNU
-# General Public License along with Battery Buddy. If not, see .
-#
-# Author: Matti Viljanen
-
-chmod 666 /sys/class/power_supply/battery/input_suspend 2>/dev/null
-chmod 666 /sys/class/power_supply/battery/charging_enabled 2>/dev/null
-chmod 666 /sys/class/power_supply/usb/charger_disable 2>/dev/null
-exit 0