fix(script): Infer drive from file system when needed
This commit is contained in:
parent
1c1c52c958
commit
5e2393751e
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
boot_dir='/boot/syslinux'
|
boot_dir='/boot/syslinux'
|
||||||
boot_dir="${boot_dir%/}"
|
boot_dir="${boot_dir%/}"
|
||||||
boot_disk="$(findmnt --noheadings --target "${boot_dir}" --output 'SOURCE')" || {
|
boot_fs="$(findmnt --noheadings --target "${boot_dir}" --output 'SOURCE')" || {
|
||||||
printf -- '%s\n' \
|
printf -- '%s\n' \
|
||||||
'Unable to identify boot drive for '"'${boot_dir}'"' boot dir.' \
|
'Unable to identify boot drive for '"'${boot_dir}'"' boot dir.' \
|
||||||
'Cowardly exiting. No syslinux files nor MBR were overwritten.'
|
'Cowardly exiting. No syslinux files nor MBR were overwritten.'
|
||||||
@ -15,6 +15,14 @@ if [[ "$(<<<"${boot_fs}" wc -l)" -gt '1' ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
boot_disk="$(lsblk --output 'NAME' --json --tree | jq --raw-output '.[][] | select(.children | length > 0) | select(.children[].name=="'"${boot_fs}"'") | .name')"
|
||||||
|
if [[ ! "${boot_disk}" ]]; then
|
||||||
|
# There's no parent drive over "${boot_fs}" meaning "${boot_fs}" itself
|
||||||
|
# already is the parent. This is a file system on a drive and not on a
|
||||||
|
# partition.
|
||||||
|
boot_disk="${boot_fs}"
|
||||||
|
fi
|
||||||
|
|
||||||
find "${boot_dir}" -type f -iname '*.c32' -delete
|
find "${boot_dir}" -type f -iname '*.c32' -delete
|
||||||
rsync -a '/usr/lib/syslinux/bios/'*'.c32' "${boot_dir}"'/'
|
rsync -a '/usr/lib/syslinux/bios/'*'.c32' "${boot_dir}"'/'
|
||||||
extlinux --install "${boot_dir}"
|
extlinux --install "${boot_dir}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user