FS#78741 - [borgmatic] Add systemd user unit

Attached to Project: Arch Linux
Opened by Cvlc12 (Cvlc) - Thursday, 08 June 2023, 22:53 GMT
Last edited by Daniel M. Capella (polyzen) - Monday, 19 June 2023, 03:41 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Daniel M. Capella (polyzen)
Christian Heusel (gromit)
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Wouldn't it be useful to ship systemd user units on top of the system units ? i.e. (I think) add the following to the PKGBUILD?

`install -Dm644 -t "$pkgdir"/usr/lib/systemd/user sample/systemd/*`

Additional info:
* package version(s) : 1.7.14
This task depends upon

Closed by  Daniel M. Capella (polyzen)
Monday, 19 June 2023, 03:41 GMT
Reason for closing:  Implemented
Additional comments about closing:  1.7.14-3 thanks to gromit 🚀
Comment by Christian Heusel (gromit) - Saturday, 10 June 2023, 07:39 GMT
Hey cedric! It looks like borgmatic already includes the requested systemd unit since version 1.3.23 so I think this is already implemented. (https://gitlab.archlinux.org/archlinux/packaging/packages/borgmatic/-/blob/main/PKGBUILD#L46)
You can find the units in /usr/lib/systemd/system/borgmatic.{service,timer} and can just use them from there as usual as systemd already looks for units in this location (you can check i.e. by running systemctl cat borgmatic.timer).

Let me know if I missed something!
Comment by Christian Heusel (gromit) - Saturday, 10 June 2023, 07:46 GMT
Ahem I missed something, since this request is about user units ...
Comment by Cvlc12 (Cvlc) - Saturday, 10 June 2023, 09:32 GMT
Hi!

Thanks, yes I was talking about user units, apparently the one provided doesn't seem to be work as is when launched with '--user', so it's not as easy as copying the unit files to "/usr/lib/systemd/user" or ~/.config/ etc...

I'm not comfortable enough with systemd to understand what needs to be changed or if that might introduce other problems or security issues unfortunately !

But it seems that the Borg docs recommend running it as non root if root is not required. It also poses problems with SSH keys, etc...
Comment by Dan Helfman (witten) - Saturday, 10 June 2023, 17:57 GMT Comment by Cvlc12 (Cvlc) - Sunday, 11 June 2023, 08:31 GMT
Ah, thanks very interesting.

Would it make sense for the Arch package to install a similar file + timer to /usr/lib/systemd/usr ?

Otherwise I'll reference it in the wiki when I have a moment next week.
Comment by Dan Helfman (witten) - Wednesday, 14 June 2023, 21:59 GMT
> Would it make sense for the Arch package to install a similar file + timer to /usr/lib/systemd/usr ?

Sure. I've just checked the sample one into the borgmatic source in case that helps. (Untested by me though.)

https://projects.torsion.org/borgmatic-collective/borgmatic/src/branch/main/sample/systemd/borgmatic-user.service
Comment by Cvlc12 (Cvlc) - Sunday, 18 June 2023, 18:15 GMT
> Sure. I've just checked the sample one into the borgmatic source in case that helps. (Untested by me though.)

Thanks !

I just checked the new PKGBUILD, but it seems wrong, it installs the system service twice. Shouldn't it be :

install -Dm644 -t "$pkgdir"/usr/lib/systemd/system/ sample/systemd/borgmatic.*
install -Dm644 -t "$pkgdir"/usr/lib/systemd/user/ sample/systemd/borgmatic-user.*

borgmatic-user.timer is a symbolic link though, so unsure if that causes any problems
Comment by Christian Heusel (gromit) - Sunday, 18 June 2023, 23:18 GMT
@cvlc, yes that does not work and this attempt is from before when @witten checked in the user file into the repo :)
I have currently prepared a MR for this (https://gitlab.archlinux.org/archlinux/packaging/packages/borgmatic/-/merge_requests/1#9b9baac1eb9b72790eef5540a1685306fc43fd6c_50_53), but since you cant view it here is the current PKGBUILD: https://gist.github.com/christian-heusel/12579bd9a2263a09051edcf6bf36caf0
Comment by Dan Helfman (witten) - Sunday, 18 June 2023, 23:19 GMT
And if the symlink is causing problems, I'd be happy to change it. It's just exactly the same timer file for both user and system-level.

Loading...