Bring back the oneshot permission daemon (initial commit)
This commit is contained in:
parent
8e3ab2024a
commit
6899638969
3 changed files with 21 additions and 9 deletions
|
@ -44,6 +44,9 @@ DISTFILES += qml/harbour-batterybuddy.qml \
|
|||
qml/cover/CoverPage.qml \
|
||||
../rpm/harbour-batterybuddy.spec \
|
||||
service/harbour-batterybuddy.service \
|
||||
service/harbour-batterybuddy-oneshot.service \
|
||||
service/restore-write-permissions.sh \
|
||||
service/set-write-permissions.sh \
|
||||
translations/*.ts \
|
||||
harbour-batterybuddy.desktop \
|
||||
qml/pages/MainPage.qml \
|
||||
|
@ -59,11 +62,15 @@ SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
|
|||
TRANSLATIONS += translations/*.ts
|
||||
|
||||
# Executable provided by "service.pro"
|
||||
OTHER_FILES += service/harbour-batterybuddy.service
|
||||
|
||||
# Two services, actually
|
||||
OTHER_FILES += service/harbour-batterybuddy.service \
|
||||
service/harbour-batterybuddy-oneshot.service \
|
||||
service/restore-write-permissions.sh \
|
||||
service/set-write-permissions.sh
|
||||
service.files = service
|
||||
service.path = /usr/share/$${TARGET}
|
||||
|
||||
# Include images
|
||||
images.files = images
|
||||
images.path = /usr/share/$${TARGET}
|
||||
|
||||
|
|
|
@ -69,10 +69,15 @@ desktop-file-install --delete-original \
|
|||
# << files
|
||||
|
||||
%posttrans
|
||||
systemctl disable --now harbour-batterybuddy-oneshot.service
|
||||
systemctl disable --now harbour-batterybuddy.service
|
||||
cp %{_datadir}/%{name}/service/harbour-batterybuddy-oneshot.service /etc/systemd/system/
|
||||
cp %{_datadir}/%{name}/service/harbour-batterybuddy.service /etc/systemd/system/
|
||||
systemctl enable --now harbour-batterybuddy-oneshot.service
|
||||
systemctl enable --now harbour-batterybuddy.service
|
||||
|
||||
%postun
|
||||
systemctl disable --now harbour-batterybuddy-oneshot.service
|
||||
systemctl disable --now harbour-batterybuddy.service
|
||||
rm /etc/systemd/system/harbour-batterybuddy-oneshot.service
|
||||
rm /etc/systemd/system/harbour-batterybuddy.service
|
||||
|
|
|
@ -76,15 +76,15 @@ Battery::Battery(Settings *newSettings, QTimer *newUpdater, QTimer *newNotifier,
|
|||
if(chargingEnabledFile) {
|
||||
// This should always succeed, since the service is started as root
|
||||
if(chargingEnabledFile->open(QIODevice::WriteOnly)) {
|
||||
qInfo() << "Controlling charging via" << chargingEnabledFile->fileName();
|
||||
chargingEnabledFile->close();
|
||||
// qInfo() << "Controlling charging via" << chargingEnabledFile->fileName();
|
||||
// chargingEnabledFile->close();
|
||||
|
||||
originalPerms = chargingEnabledFile->permissions();
|
||||
// originalPerms = chargingEnabledFile->permissions();
|
||||
|
||||
if(originalPerms | customPerms) {
|
||||
chargingEnabledFile->setPermissions(customPerms);
|
||||
qDebug() << "Charger control file permissions updated.";
|
||||
}
|
||||
// if(originalPerms | customPerms) {
|
||||
// chargingEnabledFile->setPermissions(customPerms);
|
||||
// qDebug() << "Charger control file permissions updated.";
|
||||
// }
|
||||
}
|
||||
else {
|
||||
delete chargingEnabledFile;
|
||||
|
|
Loading…
Reference in a new issue