Skip to content

Commit

Permalink
feat(kernel-install): port to POSIX sh, fixups
Browse files Browse the repository at this point in the history
- Port script to POSIX sh
- Fix logic in non-add command handling (|| -> &&)
- Consistently use quoting and braces for variables
  • Loading branch information
vimproved committed Aug 24, 2024
1 parent dfc3d45 commit d534bc4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions hooks/kernel-install/52-ugrd.install
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/bin/bash
#!/bin/sh

COMMAND="${1:?}"
KERNEL_VERSION="${2:?}"

# Do not attempt to create initramfs if the supplied image is already a UKI
[[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]] && exit 0
[ "${KERNEL_INSTALL_IMAGE_TYPE}" = "uki" ] && exit 0

# Only run if the initrd generator is ugrd
[[ ${KERNEL_INSTALL_INITRD_GENERATOR} == "ugrd" ]] || exit 0
[ "${KERNEL_INSTALL_INITRD_GENERATOR}" = "ugrd" ] || exit 0

# only run when the COMMAND is add, and fewer than 5 arguments are passed
[[ "$COMMAND" == "add" || "$#" -lt 5 ]] || exit 0
[ "${COMMAND}" = "add" ] && [ "${#}" -lt 5 ] || exit 0

ugrd "$([[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo --debug)" --no-rotate --kver "$KERNEL_VERSION" "$KERNEL_INSTALL_STAGING_AREA/initrd" || exit 1
ugrd "$([ "${KERNEL_INSTALL_VERBOSE}" = 1 ] && echo --debug)" --no-rotate --kver "${KERNEL_VERSION}" "${KERNEL_INSTALL_STAGING_AREA}/initrd" || exit 1

0 comments on commit d534bc4

Please sign in to comment.