summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-05-04 07:51:56 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-05-04 07:51:56 +0000
commit2de61b4892cae48e9dfd264ee8b4207b51f3d242 (patch)
treee639349280442d3d1e09cf9f541721c7c36f6631
parent10abad1c4e005e6ddd9a59fada07720e42227486 (diff)
downloadalpine-conf-2de61b4892cae48e9dfd264ee8b4207b51f3d242.tar.bz2
alpine-conf-2de61b4892cae48e9dfd264ee8b4207b51f3d242.tar.xz
setup-bootable: handle cciss devices better
-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