CapillaryUpgrade
@CapillaryUpgrade@lemmy.sdf.org
- Comment on Steam deck, Automount Network Share Library in Gamemode 10 months ago:
No problem!
I hacked this together instead of going to sleep, so it might make your deck explode, but maybe it’s a starting point for you or someone else:
# home-deck-mounts.mount # # Mount units must be named after the destination path, this / replaced by -, like above # # This is a template unit. # That's explained here: https://fedoramagazine.org/systemd-template-unit-files/ # TL;DR: run it like this `netmount@linuxisos.mount` if you want to mount the subdirectory "linuxisos" from SHARE_PATH [Unit] Description=NetMount %I After=graphical.target # This is commented out, because it is implicit for network mounts https://www.freedesktop.org/software/systemd/man/latest/systemd.mount.html#Default%20Dependencies # I keep it here as an example #After=network-online.target #Requires=network-online.target [Mount] # %i expands to what ever you put after the @ when starting/activating the service What=10.10.10.99:/mnt/user/%i Where=/home/deck/mounts/%i Type=nfs Options=exec [Install] WantedBy=default.target
I couldn’t confirm if mount units are allowed to be template units, but if not, just duplicate the service for each path and replace %i.
Say the word if you run into issues!
- Comment on Steam deck, Automount Network Share Library in Gamemode 10 months ago:
Don’t put yourself down! Using systemd wouldn’t make it work “better”, it’s just more “proper” (and a great tool to know in general!)
Great job and keep going!
- Comment on Steam deck, Automount Network Share Library in Gamemode 10 months ago:
This is really cool!
Where did you put the service file?
I don’t mean this as critique, but as possible next project, since your solution works perfectly fine. Systemd has some cool features that could make this project have a bit fewer moving parts:
- a .mount file could replace the mount and unmount script, and handle logging too! (I am pretty sure you would need separate files per mount, though, so “fewer moving parts” might be a bit of a lie, depending on your interpretation)
- that “After=” setting you used, can also be used to check for network connectivity. IIRC it’s “networking.target” on Fedora, at least. You might want to double check the systemd docs if After is the right one for this, as I have a hard remembering the systemd dependency intricacies.
That way you would end up with a .mount file per mounted directory, with logging using journald, and no external scripts.
I really like systemd as it can be a great tool, when you start to break down the complexity of it.
I hope you get well soon and get the best you can from this time.