Commit graph

226 commits

Author SHA1 Message Date
Michal Sekletar e41256dcec bootctl: replace readdir() loops with FOREACH_DIRENT 2016-01-31 09:44:53 +01:00
Daniel Mack bc9d55c865 bootctl: use DRAW_TREE_RIGHT rather than hard-coded UTF-8 character
Fixes #2384
2016-01-20 13:14:14 +01:00
Thomas Hindoe Paaboel Andersen cf0fbc49e6 tree-wide: sort includes
Sort the includes accoding to the new coding style.
2015-11-16 22:09:36 +01:00
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 8752c5752f util-lib: move more locale-related calls to locale-util.[ch] 2015-10-27 13:25:56 +01:00
Lennart Poettering 0d39fa9c69 util-lib: move more file I/O related calls into fileio.[ch] 2015-10-27 13:25:55 +01:00
Lennart Poettering 3ffd4af220 util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over.
2015-10-25 13:19:18 +01:00
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
Lennart Poettering 1f6b411372 tree-wide: update empty-if coccinelle script to cover empty-while and more
Let's also clean up single-line while and for blocks.
2015-09-09 14:59:51 +02:00
Lennart Poettering 52efd56a63 tree-wide: we place the opening bracket on the same line as the function name
Let's do this everywhere the same way.
2015-08-27 17:48:24 +02:00
Karel Zak a592ab6ae8 bootctl: fix path in log message 2015-08-06 13:59:38 +02:00
Kay Sievers 540536ffd1 systemd-boot: sort /EFI/Linux/*.efi files 2015-07-30 18:28:02 +02:00
Daniel Mack 65c85ef511 Merge pull request #779 from poettering/fflush-and-check
tree-wide: port everything over to fflush_and_check()
2015-07-29 20:43:54 +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 8110e144ff sd-boot: stub - export LoaderDevicePartUUID 2015-07-29 19:36:17 +02:00
Kay Sievers fc7bdb583f systemd-boot: fix whitespace 2015-07-26 00:38:01 +02:00
Kay Sievers 2da6d7b91d Merge pull request #634 from icarlosvenegas/sd-boot-show-efi-cmdline_v2
sd-boot: Show stub cmdline when edit (v2)
2015-07-26 00:35:23 +02:00
Kay Sievers c11ae0bace bootctl: add missing newline 2015-07-25 03:26:32 +02:00
Jose Carlos Venegas Munoz b1da143f2a sd-boot:Show stub cmdline when edit
If Linux efi stub is used, embedded cmdline in efi stub is
not shown. As a result, it is required to rewrite all the
line, if is only required to modify it. This behavior only
happen using Linux efi stub.

This patch allows boot loader to show embedded cmdline when
'e' key is pressed to edit boot loader options.
2015-07-20 14:56:02 -05: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
David Herrmann 59658d1958 boot: use BUILD_ID if VERSION_ID is not present
According to os-release(5), VERSION_ID is not mandatory and BUILD_ID only
needs to be unique underneath VERSION_ID. Therefore, assuming a missing
VERSION_ID field means 'empty', we can rely on BUILD_ID to be unique.

Use BUILD_ID if VERSION_ID is not present. This way, rolling-release
distros can still provide a proper os-release entry without crafting
random VERSION_ID strings.

This fixes #186.
2015-07-09 13:07:27 +02:00
David Herrmann d8c64b7f90 boot: fix memleaks in os-release parser
There is no guarantee that the os-release section contains each key only
once, nor any guarantee that all keys are present. Make sure we properly
free memory in both cases.

Not that it matters much, as we're short-living, anyway. But correct code
is always nicer to read..
2015-07-09 13:02:54 +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
Kay Sievers b40c3dfa32 boot: function parameters are separated by comma 2015-05-12 17:58:59 +02:00
Koen Kooi 0d8d368907 boot/util: add ticks_read() stub 2015-04-11 11:54:45 +02:00
Koen Kooi 8403daa284 boot/util: use x86 ASM only on x86 platforms. 2015-04-11 11:48:39 +02: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 7c5925a448 efi: widen operand to avoid overflow
CID #1287141.
2015-03-13 23:42:16 -04:00
Kay Sievers 4db7e6d781 boot: efi - add config option to disable the command line editor 2015-03-11 23:33:53 +01:00
Zbigniew Jędrzejewski-Szmek 56c70b32af boot/efi: do not assign variable twice
If the highlighted line did not move outside of the visible
region, it should not be necessary to update idx_last.

CID #1287137, #1287138.
2015-03-09 16:45:27 -04:00
Kay Sievers 9d3dec15ae boot: efi - ignore .conf snippets starting with "auto-" 2015-03-01 13:16:10 +01:00
Kay Sievers ea1851b60c boot: efi - remove a couple of Loader* variables 2015-03-01 13:16:10 +01:00
Zbigniew Jędrzejewski-Szmek 1a1db450e5 bootctl: avoid NULL pointer dereference 2015-02-27 17:31:43 -05:00
Marcel Holtmann 2bdbf32183 boot: efi - fix missing include
src/boot/efi/splash.c:312:9: warning: implicit declaration of function ‘graphics_mode’ [-Wimplicit-function-declaration]
         err = graphics_mode(TRUE);
         ^
2015-02-27 03:43:31 +01:00
Kay Sievers 7361099e42 boot: efi - remove custom splash support 2015-02-26 19:51:08 +01:00
Kay Sievers 2f8d336478 boot: efi - split graphics and splash handling 2015-02-26 19:45:08 +01:00
Kay Sievers 37fa369066 boot: efi - support embedded splash image 2015-02-26 18:58:30 +01:00
Kay Sievers 20b1538df6 boot: efi - print generic error message if we fail to execute an image 2015-02-26 01:15:18 +01:00
Kay Sievers a19b0678be boot: efi - remove default boot splash handling 2015-02-26 01:03:29 +01: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
Kay Sievers 11d63aea3a build-sys: update gitignore 2015-02-20 15:42:32 +01:00
Thomas Hindoe Paaboel Andersen 04155c6713 systemd-boot: fix alignment of version in table 2015-02-18 22:19:17 +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
Thomas Hindoe Paaboel Andersen c1ff5570f4 Add missing includes in header files
This fixes various issues found by globally reordering the include
sections of all .c files.
2015-02-12 20:44:32 +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
Lennart Poettering 39883f622f make gcc shut up
If -flto is used then gcc will generate a lot more warnings than before,
among them a number of use-without-initialization warnings. Most of them
without are false positives, but let's make them go away, because it
doesn't really matter.
2014-02-19 17:53:50 +01:00
Greg KH 29804cc1e0 use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set).  So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
2014-01-31 11:55:01 +01:00
Stefan Beller b8265d4f8e boot-efi: Remove superfluous assignment
2 lines after the changed line we assign err to efi_get_variable(...)
unconditionally, so it makes no sense to initialize it to some value.
2013-12-31 17:53:30 +01: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
Kay Sievers c51d84dc09 support acpi firmware performance data (FPDT)
Prefer firmware-provided performance data over loader-exported ones; if
ACPI data is available, always use it, otherwise try to read the loader
data.

The firmware-provided variables start at the time the first EFI image
is executed and end when the operating system exits the boot services;
the (loader) time calculated in systemd-analyze increases.
2013-09-24 15:43:41 +02: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
Thomas Hindoe Paaboel Andersen 090be86534 use streq instead of strcmp 2013-02-13 18:14:20 +01:00
Kay Sievers b05105f0a8 bootctl: always show slashes not backslashes 2013-02-13 17:49:48 +01:00
Kay Sievers 4d34c4951a efi: unify BootXXXX reading 2013-02-13 17:35:20 +01:00
Lennart Poettering 2a2473d89e boot: add stub Makefile symlink 2013-02-13 02:19:03 +01:00
Lennart Poettering 9cde64ff26 efi: various cleanups 2013-02-13 00:12:58 +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