The mount command won't work when activating a swap partition/file, so we should call swapon instead.
https://github.com/ArchiveTeam/glowing-computing-machine/tree/fstab-swap
The mount command won't work when activating a swap partition/file, so we should call swapon instead.
https://github.com/ArchiveTeam/glowing-computing-machine/tree/fstab-swap
This idea kind of makes sense, because swap partitions in /etc/fstab get swaponed at boot.
But, the implementation doesn't take the types into account. The
mountedproperty takes a FilePath for the mountpoint, but for swap that needs to be "none", which is not really a file-path. Also, thefstabbedproperty has a separateSwapPartitiontype, so makingmountsupport swap partitions without using that type feels wrong.It might be simpler all round to treat swap partitions being able to be specified in /etc/fstab as a historical accident, which it kind of is (increasingly so, since eg systemd has other ways to accomplish that), and instead of shoehorning this into the
mountedproperty, add a newswaponedproperty.Yes, perhaps if it took an Option FilePath (am I saying this correctly in Haskellese?) it would be nicer.
I don't mind much how it's structured; this was just the smallest obvious change, since it was failing to mount it. Perhaps breaking it up into smaller, more primitive, pieces would help. Fstab.mounted could = Fstab.fstabbed
onChangeFstab.mounted, for instance, and then I could write Fstab.fstabbedonChangeSwap.swapEnabled (oh, but Fstab.fstabbed already exists; I'm not using it because it replaces the whole file, which seems like an odd thing to do. Maybe call it Fstab.listed instead?).Also, for maximum irony I was just perusing your most recent dozen commits or so, and saw you enable Apt.serviceInstalledRunning "swapspace" on one of your machines. That's amazing; I had no idea it existed! I am re-evaluating all of my life choices now.
I like the idea of composing smaller properties to build the current property, and add flexability.
Renaming the existing
fstabbedwould probably be too much bother. (Also, I think I picked that name because it kind of hints that the existing fstab does not come out alive.)(The swapspace package is great if you can eat the now tiny overhead of a swap file compared to a swap partition.)
Merged. Have not tested it either.
On my Debian system, the swapon command does not support the
--no-headingsthat you used. It's--noheadingshere. Is that a typo in your patch?I've simply removed that option for now, since it probably won't hurt if it treats the heading like another device that's swapped on.