Skip to content

Add installation scripts - #2

Open
marta-lewandowska wants to merge 1 commit into
rhboot:mainfrom
marta-lewandowska:add_the_scripts
Open

Add installation scripts#2
marta-lewandowska wants to merge 1 commit into
rhboot:mainfrom
marta-lewandowska:add_the_scripts

Conversation

@marta-lewandowska

Copy link
Copy Markdown
Contributor

Add two scripts that:

  • install nmbl
  • create efi entries for nmbl-cloud and nmbl-workstation
    Installation script will later be part of bootupd8r and will be installed by it instead.

@marta-lewandowska

Copy link
Copy Markdown
Contributor Author

@nfrayer @lsandov1 and here are additional installation scripts... this stuff needs to be committed (or rejected!) before my last PR makes sense... which will make the changes to install to /usr/lib and add a few more touches

Comment thread install_bootloader
@@ -0,0 +1,23 @@
#!/usr/bin/bash

if [[ ! -d /sys/firmware/efi/ ]] || [[ $# < 3 ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets use two separate if statements if possible, because each condition check different semantic things

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also -lt instead of <

Comment thread install_bootloader
#!/usr/bin/bash

if [[ ! -d /sys/firmware/efi/ ]] || [[ $# < 3 ]]; then
exit 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this consider an error? if yes, let's exit with non-zero

Comment thread install_bootloader

FROM_DIR=/usr/lib/${PKG}/${VER}/${ARCH}/EFI/${DISTRO}
EFI_DIR=/boot/efi/EFI/${DISTRO}
if [[ -d ${EFI_DIR}/b ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

folder 'b' looks suspicious (the name), or is it a typo?

Comment thread install_bootloader
EFI_DIR=${EFI_DIR}/b
fi

cp ${FROM_DIR}/* ${EFI_DIR}/.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shellcheck is complaining on several lines on this script including this one

install_bootloader 3 43 error SC2071 < is for string comparisons. Use -lt instead. (sh-shellcheck)
install_bootloader 13 10 error SC2071 > is for string comparisons. Use -gt instead. (sh-shellcheck)
install_bootloader 23 4 info SC2086 Double quote to prevent globbing and word splitting. (sh-shellcheck)
install_bootloader 23 18 info SC2086 Double quote to prevent globbing and word splitting. (sh-shellcheck)

Comment thread install_bootloader
@@ -0,0 +1,23 @@
#!/usr/bin/bash

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please include the following bash settings

set -eu
set -o pipefail

Comment thread make_efi_entries
@@ -0,0 +1,29 @@
#!/usr/bin/bash

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please include the following bash settings

set -eu
set -o pipefail

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also several warnings/infos when running shellcheck, so lets fix all or most of them

Comment thread make_efi_entries
@@ -0,0 +1,29 @@
#!/usr/bin/bash

if [[ ! -f /sys/firmware/efi/ ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-d instead of -f

Comment thread make_efi_entries
AR=x64
if [[ $arch = aarch64 ]]; then
AR=aa64;
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe no other archs are considered at this time

Comment thread make_efi_entries
if [[ -f /etc/kernel/cmdline ]]; then
BOOT_OPTIONS="$(tr -s ' ' < /etc/kernel/cmdline)"
else
BOOT_OPTIONS="$(tr -s '\n' < /proc/cmdline | sed -e 's/BOOT_IMAGE=[^ ]*//')"

@lsandov1 lsandov1 May 22, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would lead a leading space

Comment thread nmbl-builder.spec.in

Source0: nmbl-builder-%{VERSION}.tar.xz
Source1: make_efi_entries
Source2: install_bootloader

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at some point [1], grub would install a similar script on the same place so perhaps we should rename this one ?

[1] https://src.fedoraproject.org/rpms/grub2/pull-request/170

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants