Commit graph

33 commits

Author SHA1 Message Date
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.

This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.

Also touches a few unrelated include files.
2015-10-24 23:05:02 +02:00
Lennart Poettering 3f6fd1ba65 util: introduce common version() implementation and use it everywhere
This also allows us to drop build.h from a ton of files, hence do so.
Since we touched the #includes of those files, let's order them properly
according to CODING_STYLE.
2015-09-29 21:08:37 +02:00
Karel Zak a592ab6ae8 bootctl: fix path in log message 2015-08-06 13:59:38 +02:00
Lennart Poettering dacd6cee76 tree-wide: port everything over to fflush_and_check()
Some places invoked fflush() directly with their own manual error
checking, let's unify all that by using fflush_and_check().

This also unifies the general error paths of fflush()+rename() file
writers.
2015-07-29 20:31:07 +02:00
Kay Sievers c11ae0bace bootctl: add missing newline 2015-07-25 03:26:32 +02:00
David Herrmann ab822b624b sd-boot: ignore missing /etc/machine-id
If /etc/machine-id is missing (eg., gold images), we should not fail
installing sd-boot. This is a perfectly fine use-case and we should simply
skip installing the default loader config in that case.
2015-07-15 12:04:31 +02:00
Miguel Bernal Marin 68cc17f131 bootctl: fix sdboot to systemd-boot
sdboot was renamed to systemd-boot

Fixes: e7dd673d1e ("gummiboot/sd-boot/systemd-boot: rename galore")

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
2015-07-04 17:03:50 -05:00
Thomas Hindoe Paaboel Andersen dd114e116b bootctl: fix an error check 2015-05-23 13:03:30 +02:00
Thomas Hindoe Paaboel Andersen 717442507b bootctl: ferror must be called before FILE is closed
Otherwise it will not show any error stored
2015-05-22 23:46:36 +02:00
Zbigniew Jędrzejewski-Szmek 551710cf2e bootctl: try to catch all errors
Do not print garbage on non-EFI installations.
2015-05-19 23:41:38 -04:00
Zbigniew Jędrzejewski-Szmek d3226d7796 bootctl: modernization
Use strjoina to avoid error handling, and openat to simplify things.

Some fixes on the way:
- ferror does not set errno, so the return value was wrong in some cases
- errors are propagated in more cases
- EFI/systemd was created, but EFI/systemd-boot was deleted
- something is always printed on error
- when checking the version, comparison was done against "systemd-bo" for some reason
- return value was converted from negative to EXIT_SUCCESS/EXIT_FAILURE twice,
  resulting in EXIT_SUCCESS all the time
2015-05-19 23:41:38 -04:00
Ronny Chevalier 39505e3c3b remove duplicated includes 2015-04-08 02:42:50 +02:00
Lennart Poettering c687863750 util: rework rm_rf() logic
- Move to its own file rm-rf.c

- Change parameters into a single flags parameter

- Remove "honour sticky" logic, it's unused these days
2015-04-06 10:57:53 +02:00
David Herrmann e0d065d405 bootctl: drop redundant parse_argv()
We already call parse_argv() from main(), don't call it here again.
2015-03-19 14:11:54 +01:00
Zbigniew Jędrzejewski-Szmek 1a1db450e5 bootctl: avoid NULL pointer dereference 2015-02-27 17:31:43 -05:00
Thomas Hindoe Paaboel Andersen 3a4efbff2e bootctl: check that partition uuid is valid
It probably is but check anyway to make coverity happy.

CID#1271354
2015-02-25 23:32:50 +01:00
Thomas Hindoe Paaboel Andersen 7cb0f263ad bootctl: fix mem leaks
CID#1271347/1271348
2015-02-25 00:00:32 +01:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00
Tom Gundersen e7dd673d1e gummiboot/sd-boot/systemd-boot: rename galore
What used to be gummiboot, was renamed sd-boot when it was merged into
systemd. Let's try to be a bit more consistent with the rest of systemd
and rename it again as follows:

The EFI bootloader is now called 'systemd-bootx64.efi', and its sources are in
'src/boot/efi/'. The drop-in directory where bootctl will find EFI loaders
is now /usr/lib/systemd/boot/efi/.
2015-02-18 15:23:23 +01:00
Kay Sievers 0974a682d1 bootctl: add sd-boot support 2015-02-17 14:36:59 +01:00
Zbigniew Jędrzejewski-Szmek 601185b43d Unify parse_argv style
getopt is usually good at printing out a nice error message when
commandline options are invalid. It distinguishes between an unknown
option and a known option with a missing arg. It is better to let it
do its job and not use opterr=0 unless we actually want to suppress
messages. So remove opterr=0 in the few places where it wasn't really
useful.

When an error in options is encountered, we should not print a lengthy
help() and overwhelm the user, when we know precisely what is wrong
with the commandline. In addition, since help() prints to stdout, it
should not be used except when requested with -h or --help.

Also, simplify things here and there.
2014-08-03 21:46:07 -04:00
Thomas Hindoe Paaboel Andersen b226deba78 bootctl: remove unused options from getopt_long 2013-11-09 14:11:56 +01:00
Lennart Poettering eb9da376d7 clients: unify how we invoke getopt_long()
Among other things this makes sure we always expose a --version command
and show it in the help texts.
2013-11-06 18:28:39 +01:00
Thomas Hindoe Paaboel Andersen 82de16f92c bootctl: typo fix in help message 2013-11-06 00:29:49 +01:00
Koen Kooi 8b3227c90d bootctl: fix help text
It currently says 'time settings', change that to 'boot settings'.
2013-03-29 15:47:43 +01:00
Kay Sievers 0014c5221e bootctl: ESP --> Partition 2013-03-28 11:42:32 +01:00
Kay Sievers 33696ef458 bootctl: Binary: --> File: 2013-03-28 03:43:29 +01:00
Kay Sievers 3483fab948 bootctl: rename status output header 2013-03-27 13:55:09 +01:00
Kay Sievers 0876dc1c26 bootctl: print Options only when found 2013-03-10 23:18:50 +01:00
Kay Sievers bc6f2e7c62 bootctl: print secure boot flags 2013-03-10 22:48:27 +01:00
Kay Sievers 71bf4f6f6c bootctl: show "n/a" for empty boot option labels 2013-02-17 22:28:21 +01:00
Kay Sievers abb381b3b3 bootctl: print partition uuids as /dev/disk/by-partuuid/... 2013-02-11 23:20:02 +01:00
Kay Sievers 7b4d7cc082 bootctl: add boot loader and firmware interface tool 2013-02-11 19:35:52 +01:00