Commit Graph

18 Commits (049)

Author SHA1 Message Date
Javier Martinez Canillas f4947f8793 51-dracut-rescue.install: Don't install BLS fragment in /boot/efi on EFI
For EFI systems, the BLS fragments were stored in the EFI System Partition
(ESP) while in non-EFI systems it was stored in /boot.

For consistency, it's better to always store the BLS fragments in the same
path regardless of the firmware interface used.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-07-02 12:28:04 +02:00
Javier Martinez Canillas 4f55387829 51-dracut-rescue.install: fix exit status code
After the $COMMAND case statement, the exit status of the last executed
command is added to the $ret variable.

But for the "add" pattern, this last executed command is an arithmetic
expression that also adds the exit status $? to the $ret variable. If
both $? and $ret are 0, then the arithmetic expression evaluates to 0
so is considered false and has an exit status of 1.

This makes the script to wrongly exit with an status code of 1 when it
should had been 0.

  case "$COMMAND" in
      add)
      ...
          ((ret+=$?))
	  # $ret is 0 here
          ;;
  ...
  esac

  ((ret+=$?))
  # $ ret is 1 here

  exit $ret

Since $ret is set in the case statement, just exit with that status code
and remove the last arithmetic expression that wrongly sets $ret to 1.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-07-02 11:33:41 +02:00
Javier Martinez Canillas f8c24964cd 51-dracut-rescue.install: fix initramfs not generated in /boot case
Commit 5e574046e76e ("5?-dracut*.install: Allow scripts to install
the initramfs in /boot dir") added support to generate initramfs
images in the /boot directory and copy the respective BLS files.

Unfortunately, it broke the rescue initramfs generation when it's
not installed on /boot due not checking for the correct condition.

It checks for the 0-rescue sub-dir to exist, but this is created so
instead if the parent sub-dir exists has to be checked. Also, check
if the destination directory is /boot or not, instead if it exists.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-03-12 09:05:40 +01:00
Javier Martinez Canillas b39b8452d2 5?-dracut*.install: Allow scripts to install the initramfs in /boot dir
The GRUB 2 bootloaders expect the initrd to be installed in /boot instead
of /boot/$MACHINE_ID/$KERNEL_VERSION/{linux,initrd}, so if that directory
doesn't exists, install the initramfs images on the /boot directory.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-03-01 14:50:30 +01:00
Yu Watanabe b71d162a7a kernel-install: Skip to create initrd if /etc/machine-id is missing or empty
From systemd-234, kernel-install plugins are called even if /etc/machine-id
is missing or empty, and in that case BOOT_DIR_ABS is a fake directory.
So, let's skip to create initrd in that case.
2017-06-02 18:07:25 +09:00
Yu Watanabe b29901c083 rescue: use proper path for 0-rescue.conf 2016-10-19 12:22:54 +09:00
Harald Hoyer 10e59202c7 51-dracut-rescue.install: fix kernel cmdline parsing
filter out any "initrd=" option
2015-05-18 13:27:16 +02:00
Harald Hoyer a601870064 5?-dracut*.install: better parsing of /proc/cmdline
"read -r -d '' -a" does, what we want.
2015-05-13 12:02:14 +02:00
Harald Hoyer 8cd8820547 use cp --reflink=auto
saves some space, if the destination is on the same filesystem on some
filesystems
2015-05-13 12:02:10 +02:00
Dimitri John Ledkov a7d3ad67c7 Support /usr/lib/kernel/cmdline fallback path for /etc/kernel/cmdline. 2015-02-19 10:50:58 +01:00
Harald Hoyer 967cc19ab1 remove all vim and emacs code format comments 2014-08-29 13:38:47 +02:00
Harald Hoyer 95957248a1 51-dracut-rescue.install: fixed /proc/cmdline read 2014-08-15 14:56:59 +02:00
Harald Hoyer 8652d5493d 51-dracut-rescue.install: fixed rescue image creation 2013-08-07 10:33:15 +02:00
Harald Hoyer 478aa7dac1 51-dracut-rescue-postinst.sh,51-dracut-rescue.install: use systemd-machine-id-setup
if /etc/machine-id is empty, use systemd-machine-id-setup
2013-03-20 07:08:29 +01:00
Harald Hoyer c0c6c74d99 51-dracut-rescue.install: create directory, if it does not exist 2013-03-13 09:32:14 +01:00
Harald Hoyer 2fa6fd3aaa add 51-dracut-rescue-postinst.sh
also fixup 51-dracut-rescue.install to read in dracut conf
2013-03-11 18:58:32 +01:00
Harald Hoyer 8d28614e4f 51-dracut-rescue.install: do not unset installonly on remove 2013-03-11 15:12:49 +01:00
Harald Hoyer d837ac3984 add /lib/kernel/install.d/51-dracut-rescue.install
Upon installation of a kernel, check if a rescue image is already
available and if not, create a non-hostonly generic initramfs image with
the rescue module added.
2013-03-09 15:16:31 +01:00