summaryrefslogtreecommitdiffstats
path: root/setup-bootable.in
diff options
context:
space:
mode:
Diffstat (limited to 'setup-bootable.in')
-rw-r--r--setup-bootable.in19
1 files changed, 17 insertions, 2 deletions
diff --git a/setup-bootable.in b/setup-bootable.in
index 70f20e7..2bd8903 100644
--- a/setup-bootable.in
+++ b/setup-bootable.in
@@ -64,6 +64,22 @@ is_read_only() {
return 1
}
+# find what disk this partition belongs to
+find_disk_dev() {
+ local i= sysfsname=${1#/dev/}
+ sysfsname=${sysfsname//\/!} # cciss/c0d0 -> cciss!c0d0
+ if [ -e /sys/block/$sysfsname ]; then
+ echo "/dev/${sysfsname//!/'/'}"
+ return 0
+ fi
+ for i in /sys/block/*/$sysfsname; do
+ [ -e "$i" ] || continue
+ echo "$i" | cut -d/ -f4 | sed -e 's:!:/:g' -e 's:^:/dev/:'
+ return 0
+ done
+ return 1
+}
+
usage() {
cat <<__EOF__
$prog $version
@@ -149,13 +165,12 @@ eval $(blkid $dest | cut -d: -f2-)
vecho "Using $dest as target (mounted on $destdir)"
-
# find parent device (i.e sda)
dev="$dest"
while [ -L "$dev" ]; do
dev=$(readlink -f $dev)
done
-parent_dev=/dev/$(basename $(dirname /sys/block/*/$(basename $dev)))
+parent_dev=$(find_disk_dev)
# check if this files exist and not in upgrade mode
if [ -z "$upgrade" ] && [ -z "$force" ]; then