The ESP may be an automount partition, so try touching a file in each
candidate location so as to trigger an automounts.
This is the same way systemd attempts to find it:
https://github.com/systemd/systemd/blob/f565b86/src/shared/bootspec.c#L1014-L1018
I've also changed the function to return an error if no ESP is found.
The previous behaviour (an empty string) just results in a crash later
on.
When no ESP is found, the `bundle` command will have no default for the
`esp` flag. Passing an empty string to it as a default results in no
value being show in the output of `--help`.
This seemed like the most reasonable compromise instead of panicking.
Fixes#78
Most distros (I think) default to stuffing this into `/boot` so our ESP
selection is going to mess this up more often then not.
Signed-off-by: Morten Linderud <morten@linderud.pw>
Should probably try include some documentation to this, but this changes
the default from /proc/cmdline to /etc/kernel/cmdline.
This is partially a standard and a bit more flexible for everyday use
for most people.
https://www.freedesktop.org/software/systemd/man/kernel-install.htmlFixes#39
Signed-off-by: Morten Linderud <morten@linderud.pw>
Using the function also removed code that had hardcoded globals for the
location of some files instead of using the dbpath parameter.
Add error checking around the function where appropriate.
Also fail early when creating a new bundle if it isn't possible to
access the bundle database.
Signed-off-by: Érico Rolim <erico.erc@gmail.com>