Commit Graph

31 Commits

Author SHA1 Message Date
Jörg Thalheim ff12a7954c treewide: more portable bash shebangs
As in 2a5fcfae02
and in 3e67e5c992
using /usr/bin/env allows bash to be looked up in PATH
rather than being hard-coded.

As with the previous changes the same arguments apply
- distributions have scripts to rewrite shebangs on installation and
  they know what locations to rely on.
- For tests/compilation we should rather rely on the user to have setup
  there PATH correctly.

In particular this makes testing from git easier on NixOS where do not provide
/bin/bash to improve compose-ability.
2020-03-05 17:27:07 +01:00
Zbigniew Jędrzejewski-Szmek 51be9a8c41 kernel-install: add a check that the vmlinuz arg is sane 2019-04-03 11:25:40 +02:00
Zbigniew Jędrzejewski-Szmek cf73f65089 kernel-install: create the entry directory only if $BOOT/$MACHINE_ID exists
Things are currently fairly ugly in Fedora: we create $BOOT/$MACHINE_ID/$KERNEL_VERSION/,
and then 20-grub.install that is installed by grub2-common.rpm wants to remove that
directory before 50-dracut.install get a chance to run. 50-dracut.install
checks for the presence of that directory to decide where to install the
kernel. So let's make the creation of the directory conditional. Previous
commit changes bootctl install to create $BOOT/$MACHINE_ID, and this commit
makes kernel-install not create it. In effect, the entry directory will only be
created if 'bootctl install' or something else created the parent directory.

https://bugzilla.redhat.com/show_bug.cgi?id=1648907
2019-03-12 09:45:16 +01:00
Zbigniew Jędrzejewski-Szmek d271c5d345 kernel-install: rename $BOOT_DIR[_ABS] to $ENTRY_DIR[_ABS]
"BOOT" is misleading, because it sounds like this refers to /boot or $BOOT,
when in fact it refers to some subdirectory. Those variable names are purely
interal, so we can change them. $BOOT_DIR_ABS was used in NEWS, but it should
not be (because it is an internal detail), so the old NEWS entry is reworded to
use "entry directory".
2019-03-12 09:45:16 +01:00
Zbigniew Jędrzejewski-Szmek 7054308a8d kernel-install: add --verbose
This makes it easier to see what is going on. Documentation for
--verbose and --help is added to the man page. Our plugins are updated
to also log a bit.
2019-03-11 15:49:53 +01:00
Marc-Antoine Perennou d279b185c0 kernel-install: fix dracut initrd detection (240 backward compatibility) (#11570)
* kernel-install: fix initrd when called as installkernel

Running make install from the kernel runs e.g.:
installkernel 4.20.5 arch/x86/boot/bzImage System.map "/boot"

Since 0912c0b80e this would
cal 90-loaderentry.install with those arguments:
add 4.20.5 /boot/... arch/x86/boot/bzImage System.map "/boot"

The two last arguments would then be handled as the initrd files.
As System.map exists in current directory but not in /boot/...
it would get copied there, and used as initrd intead of the initrd
which has been generated by dracut.

With this change, nothing changes when kernel-install is called
directly, but when it's called as installkernel, we now pass
thos arguments to 90-loaderentry.install:
add 4.20.5 /boot/... arch/x86/boot/bzImage initrd
initrd is thus detected as the file to use for the initrd, and as it
exists, nothing is copied over and the initrd line generated is
consistent with what one would expect

* kernel-install: fix dracut initrd detection when called directly

This brings back the systemd 240 behaviour when called directly too

* kernel-install: unify initrd fallback

* kernel-install: move initrd fallback handling to 90-loaderentry.install

* kernel-install: move initrd fallback just before creating loader entry
2019-01-27 17:32:21 +01:00
Mike Auty 0912c0b80e Add multiple initrd file support to kernel-install
Instead of having just a single INITRD field, add support for all
additional parameters being INITRD fields in order.

Signed-off-by: Mike Auty <mike.auty@gmail.com>
2019-01-18 13:49:52 +01:00
ikelos 04ca4d191b Improve kernel-install support for initrd files. (#11281)
The current support in kernel-install for initrd images doesn't copy
over the initrd file or allow a means for it to be specified (it
requires a specific filename in a particular directory).

This patchset adds support for (optionally) providing the name of
initial ramdisk file to copied over and used by kernel-install.
2018-12-30 04:01:10 +09:00
Zbigniew Jędrzejewski-Szmek 25612ecba4 tree-wide: drop copyright lines for more authors
Acks in https://github.com/systemd/systemd/issues/9320.
2018-06-22 16:39:45 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Zbigniew Jędrzejewski-Szmek d9215cd838 Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
Yu Watanabe 9d8813b3b4 kernel-install: support the case /etc/machine-id is missing or empty (#5975)
Some .install plugins does not require that machine ID is set such as
20-grubby.install for Fedora and 50-depmod.install.
To support such plugins to run without valid machine-id, this commit
makes the following change:
* if /etc/machine-id is missing or empty, create temporary directory
  and set its path to BOOT_DIR_ABS,
* run the .install helpers with KERNEL_INSTALL_MACHINE_ID environment
  variable that'd be empty if /etc/machine-id is missing or empty.
This may be useful for installing kernel for e.g. stateless systems
which initialize machine-id while booting the systems.
2017-05-30 09:45:10 -04:00
Michal Schmidt db1e2bfc4f kernel-install: avoid process substitution
bash implements process substitution using /dev/fd/N (this is documented
in man bash). We'd like kernel-install to work in chrooted RPM
scriptlets without /dev.

We can use here-strings instead. bash uses temporary files to implement
those.
2017-01-11 15:34:54 -05:00
Yu Watanabe 9156493171 kernel-install: use exit instead of return (#4565)
/bin/kernel-install: line 143: return: can only `return' from a function or sourced script

https://bugzilla.redhat.com/show_bug.cgi?id=1391829
2016-11-04 08:58:41 -04:00
Zbigniew Jędrzejewski-Szmek eb93312810 kernel-install: allow plugins to terminate the procedure (#4174)
Replaces #4103.
2016-09-24 09:03:54 -04:00
Martin Pitt 7ce9cc1545 Revert "kernel-install: Add KERNEL_INSTALL_NOOP (#4103)"
Further discussion showed that this better gets addressed at the packaging
level.

This reverts commit 34210af7c6.
2016-09-17 16:39:00 +02:00
Colin Walters 34210af7c6 kernel-install: Add KERNEL_INSTALL_NOOP (#4103)
Will be used by rpm-ostree (and likely lorax) to suppress
RPM->kernel->%posttrans->dracut runs, and basically everything
else this script is doing.

I'll also likely change the `kernel.spec` to respect this as well.
2016-09-14 07:57:43 +02:00
Lennart Poettering 5b8411a2aa kernel-install: when searching for location to place kernel consider /efi
With this change kernel-install will now first look for an existing kernel
installation in /efi, /boot and /boot/efi. If none is found, /efi is used if it
is a mount point, otherwise /boot/efi if it is one. If nothing of that worked
/boot is used without further checking.

This means /boot should be the default unless something was installed before or
something else was explicitly mounted.
2016-07-21 11:37:59 +02:00
Harald Hoyer 340defcd06 kernel-install: recognize /boot/efi mountpoint (#3751)
install everything in /boot/efi, if this is a mountpoint
2016-07-19 12:10:09 +02:00
Sébastien Luttringer d838db0d3b kernel-install: fix help output
Kernel install doesn't need the second argument on his command line when
removing.
This is correctly documented in the man page.
2013-12-09 23:19:16 -05:00
Zbigniew Jędrzejewski-Szmek a6c3d202b1 kernel-install: add -h/--help 2013-12-08 19:26:51 -05:00
Tom Gundersen ea52e2aee8 kernel-install: add compat with 'installkernel'
If 'kernel-install' is called as 'installkernel' it will be compatible with the
syntax used by the kernel's build system.

This means it can be called by doing 'make install' in a kernel build
directory, if the correct symlink has been installed (which we don't do by
default yet).

[Edit harald@redhat.com: removed basename and use shift]
2013-10-01 17:40:30 +02:00
Harald Hoyer 8f51399e75 kernel-install: add default install scripts
Do the depmod in the kernel-install hooks, so hooks can produce/install
kernel modules and be part of the depmod.

Also move the basic boot loader entry creation and removal to a
plugin script.

If PRETTY_NAME is not defined in /etc/os-release, fallback to
PRETTY_NAME="Linux $KERNEL_VERSION".

Add documentation for everything in the man page.
2013-05-06 16:19:02 +02:00
Mantas Mikulėnas 6886b0449d kernel-install: Clean up
- Consistent use of $VAR vs ${VAR}
- Consistent use of && vs 'if'
- Add error checking to some places
- Consistent error messages ("Can't" vs "Cannot", etc.)
- Function declarations at the top
- Miscellaneous adjustments
2013-04-30 12:14:35 +02:00
Marc-Antoine Perennou d82d87dac1 kernel-install: don't make unused parameter mandatory
We only use the image name in the case we're adding a kernel

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2013-04-08 17:00:04 +02:00
Harald Hoyer 82673dd410 kernel-install: rename the loader entry filename
The wildcard matching the default loader entry should always be able to point to
the same machine.

So instead of sorting by <distribution>-<kernel-version>-<machine-id>
we better sort by <machine-id>-<kernel-version>.
2013-02-26 15:21:23 +01:00
Harald Hoyer 4120b92f8e kernel-install: create the loader entries with absolute paths relative to /boot 2013-02-26 10:56:07 +01:00
Harald Hoyer d1ebea5f2c kernel-install: replace URLs with man pages in the error messages 2013-02-26 08:56:45 +01:00
Harald Hoyer 6557484fb1 kernel-install: fixed paths in boot loader entry
For the loader entry a relative path has to be used.
2013-02-26 08:52:17 +01:00
Kay Sievers 61f99b6064 kernel-install: remove LANG= 2013-02-25 23:18:57 +01:00
Harald Hoyer 81516adcb7 kernel-install: add kernel-install tool 2013-02-25 18:58:06 +01:00