3 [[ $EUID == 0 ]] ||
exec sudo
-E "$script" "$@"
5 if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
6 shopt -s inherit_errexit
2>/dev
/null ||
: # ignore fail in bash < 4.4
8 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" exit status: $?, PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR
14 # this is taken from partition.DEFAULT
16 for disk
in $
(lsblk
-do name
,tran
-n |
awk '$2 ~ "^(sata|nvme)$" { print $1 }'); do
17 case $
(cat /sys
/block
/$disk/queue
/rotational
) in
18 0) ssds
+=(/dev
/$disk) ;;
20 *) echo "$0: error: unknown /sys/block/$disk/queue/rotational: \
21 $(cat $disk/queue/rotational)" ;;
25 # this is from /a/bin/fai/fai/config/scripts/GRUB_EFI/10-setup
26 GROOT
=$
(grub-probe
-tdrive -d ${ssds[@]})
28 grub-install
--no-floppy --modules=part_gpt
"$GROOT"