summaryrefslogtreecommitdiff
path: root/libre/syslinux/syslinux-install_update
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-02-17 22:32:10 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-02-17 22:32:10 -0300
commita5c7a2d156c741b045d0b9ee5c287122197a7143 (patch)
treee83e555987ed2e381694f99f1bb6a41986727990 /libre/syslinux/syslinux-install_update
parentcfdcacf50147ab467719f65e348aa0739f8bc8f4 (diff)
syslinux-6.03-4.parabola1: fix btrfs boot issue - FS#48214 -> https://bugs.archlinux.org/task/48214
Diffstat (limited to 'libre/syslinux/syslinux-install_update')
-rw-r--r--libre/syslinux/syslinux-install_update50
1 files changed, 29 insertions, 21 deletions
diff --git a/libre/syslinux/syslinux-install_update b/libre/syslinux/syslinux-install_update
index a4481644e..c2653dc25 100644
--- a/libre/syslinux/syslinux-install_update
+++ b/libre/syslinux/syslinux-install_update
@@ -51,6 +51,28 @@ check_is_in() {
return 1
}
+get_disk() {
+ local part=$1
+ if [[ ! -b "${part}" ]]; then
+ echo >&2 "error: '$part' is not a valid block device!"
+ exit 1
+ fi
+
+ case "$part" in
+ *[[:digit:]]p[[:digit:]]*)
+ local disk="${part%%p$partnum}" # get everything before p1
+ ;;
+ *)
+ local disk="${part%%[[:digit:]]*}"
+ ;;
+ esac
+ if [[ ! -b "${disk}" ]]; then
+ echo >&2 "error: '$disk' is not a valid block device!"
+ exit 1
+ fi
+ echo $disk
+}
+
# return true when blockdevice is an md raid, otherwise return a unset value
# get all devices that are part of raid device $1
device_is_raid() {
@@ -169,14 +191,14 @@ getBoot() {
exit 1
fi
boot="boot"
- bootpart="$bootdev"
+ bootpart="$(readlink -f "$bootdev")"
elif [[ $rootfs ]]; then
if ! check_is_in "$rootfs" "${syslinux_fs[@]}"; then
echo "/ (root) file system is not supported by Syslinux"
exit 1
fi
boot="root"
- bootpart="$rootdev"
+ bootpart="$(readlink -f "$rootdev")"
else
echo "Could not find filesystem on / (root) or /boot."
exit 1
@@ -194,12 +216,12 @@ get_boot_devices() {
slaves=$(mdraid_all_slaves "$bootpart")
for slave in ${slaves[@]}; do
- local disk="${slave%%[[:digit:]]*}"
+ local disk=$(get_disk "$slave")
device_is_gpt "$disk" && local ptb="GPT" || local ptb="MBR"
bootdevs[$slave]="$ptb"
done
else
- local disk="${bootpart%%[[:digit:]]*}"
+ local disk=$(get_disk "$bootpart")
device_is_gpt "$disk" && local ptb="GPT" || local ptb="MBR"
bootdevs[$bootpart]="$ptb"
fi
@@ -220,7 +242,7 @@ set_active() {
for dev in "${!bootdevs[@]}"; do
local ptb="${bootdevs[$dev]}"
if [[ "$ptb" = GPT ]]; then
- local disk="${dev%%[[:digit:]]*}" #ex: /dev/sda
+ local disk=$(get_disk "$dev")
clear_gpt_attr2 "$disk"
fi
done
@@ -229,14 +251,7 @@ set_active() {
for part in "${!bootdevs[@]}"; do
local ptb="${bootdevs[$part]}"
local partnum="${part##*[[:alpha:]]}"
- case "$part" in
- *[[:digit:]]p[[:digit:]]*)
- local disk="${part%%p$partnum}" # get everything before p1
- ;;
- *)
- local disk="${part%%[[:digit:]]*}"
- ;;
- esac
+ local disk=$(get_disk "$part")
if [[ "$ptb" = MBR ]]; then
if sfdisk "$disk" --activate "$partnum" &>/dev/null; then
@@ -271,14 +286,7 @@ install_mbr() {
for part in "${!bootdevs[@]}"; do
local partnum="${part##*[[:alpha:]]}"
- case "$part" in
- *[[:digit:]]p[[:digit:]]*)
- local disk="${part%%p$partnum}" # get everything before p1
- ;;
- *)
- local disk="${part%%[[:digit:]]*}"
- ;;
- esac
+ local disk=$(get_disk "$part")
local ptb="${bootdevs[$part]}"
# We want to install to the root of the block device