-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Plug-in enabled systemd services/target
Contributes-To: #21
- Loading branch information
nephros
committed
Nov 27, 2022
1 parent
af35a90
commit 6256ffa
Showing
7 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Bugger! log collect plugin system | ||
|
||
In order to add your script for collecting logs to the Bugger! log collector, do the following: | ||
|
||
|
||
1. create a shell script which outputs logging to standard output | ||
2. place the script into `/usr/share/harbour-bugger/scripts` | ||
3. name the script `gather-logs-$YOURNAME.sh` | ||
4. use the systemd template service `[email protected]` to add your script to the plugin service. | ||
5. e.g. do `systemctl --user enable harbour-bugger-gather-logs-plugin@$YOURNAME.service` | ||
|
||
Notes: | ||
|
||
- log output will be written to `~/Documents/YYYY-MM-DD-harbour-bugger-gather-logs-plugin_$YOURNAME.log` | ||
- `[email protected]` uses `Protectsystem=full`, so don't expect any location to be writable in your script. | ||
- scripts are run in systemd user scope. You can't be root. If you need to be root, use `pkexec` to prompt users for the lock code/fingerprint. | ||
- Bugger! will run the log creation, but will not add the created log files in the app. Users will have to select them manually. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ Name: harbour-bugger | |
# << macros | ||
|
||
Summary: Bug reporting helper | ||
Version: 0.10.1 | ||
Version: 0.10.2 | ||
Release: 1 | ||
Group: Applications | ||
License: ASL 2.0 | ||
|
@@ -90,17 +90,26 @@ desktop-file-install --delete-original \ | |
|
||
%preun | ||
# >> preun | ||
%systemd_user_preun harbour-bugger-gather-logs.target | ||
%systemd_user_preun harbour-bugger-gather-logs.service | ||
%systemd_user_preun [email protected] | ||
%systemd_user_preun harbour-bugger-gather-android-logs.service | ||
# << preun | ||
|
||
%post | ||
# >> post | ||
%systemd_user_post harbour-bugger-gather-logs.target | ||
%systemd_user_post harbour-bugger-gather-logs.service | ||
%systemd_user_post [email protected] | ||
%systemd_user_post harbour-bugger-gather-android-logs.service | ||
# << post | ||
|
||
%postun | ||
# >> postun | ||
%systemd_user_postun harbour-bugger-gather-logs.target | ||
%systemd_user_postun harbour-bugger-gather-logs.service | ||
%systemd_user_postun [email protected] | ||
%systemd_user_postun harbour-bugger-gather-android-logs.service | ||
# << postun | ||
|
||
%files | ||
|
@@ -110,6 +119,8 @@ desktop-file-install --delete-original \ | |
%config %{_sysconfdir}/sailjail/permissions/%{name}.profile | ||
%config %{_sysconfdir}/firejail/%{name}.local | ||
%dir %{_datadir}/%{name} | ||
%dir %{_datadir}/%{name}/scripts | ||
%{_datadir}/%{name}/scripts/README_logcollect.md | ||
%{_datadir}/%{name}/translations/*.qm | ||
%{_datadir}/%{name}/qml/* | ||
%{_userunitdir}/*.target | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Description=Collect Logfiles | ||
Documentation=https://github.com/sailfishos-chum/bugger/README_logcollect.md | ||
Documentation=/usr/share/harbour-bugger/scripts/README_logcollect.md | ||
Before=harbour-bugger-gather-logs.target | ||
|
||
[Service] | ||
Type=oneshot | ||
ProtectSystem=full | ||
ReadWritePaths=%h/Documents | ||
ExecStart=/bin/sh -c "\ | ||
/usr/share/harbour-bugger/scripts/gather-logs-%i.sh > %h/Documents/$(date -I)_%N_%i.log; \ | ||
/usr/bin/chmod 0600 %h/Documents/$(date -I)_%N*json %h/Documents/$(date -I)_%N*log; \ | ||
/usr/bin/chown %u %h/Documents/$(date -I)_%N*json %h/Documents/$(date -I)_%N*log; \ | ||
" | ||
|
||
[Install] | ||
WantedBy=harbour-bugger-gather-logs.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[Unit] | ||
Description=Collect Log files for Bugger! | ||
Documentation=https://github.com/sailfishos-chum/bugger/README_logcollect.md | ||
Documentation=/usr/share/harbour-bugger/scripts/README_logcollect.md | ||
DefaultDependencies=no | ||
After=user-session.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
OTHER_FILES += $${TARGET}-gather-logs.target\ | ||
$${TARGET}-gather-logs.service\ | ||
$${TARGET}-gather-logs-plugin@.service \ | ||
$${TARGET}-gather-android-logs.service | ||
|
||
INSTALLS += sdservice | ||
|
||
sdservice.files = $$PWD/$${TARGET}-gather-logs.target \ | ||
$$PWD/$${TARGET}-gather-logs.service \ | ||
$$PWD/$${TARGET}-gather-logs-plugin@.service \ | ||
$$PWD/$${TARGET}-gather-android-logs.service | ||
sdservice.path = $$INSTALL_ROOT/usr/lib/systemd/user | ||
|