diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-10-05 18:59:18 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-10-05 18:59:18 +0000 |
commit | 9158a74b3a3bf91c4bfd5d3cf118794cb53a48a9 (patch) | |
tree | d275cd3a32089036d2892dbafdef0ee7dffb732b /setup-disk.in | |
parent | 841c6823ac8a3f1e17af457722c8b7ea2abf8cb4 (diff) | |
download | alpine-conf-9158a74b3a3bf91c4bfd5d3cf118794cb53a48a9.zip |
setup-disk: fix for detecting disk from given partition
This should fix detecting /dev/cciss/c0d0 from /dev/cciss/c0d0p1
Diffstat (limited to 'setup-disk.in')
-rw-r--r-- | setup-disk.in | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/setup-disk.in b/setup-disk.in index c11d20c..266284f 100644 --- a/setup-disk.in +++ b/setup-disk.in @@ -53,6 +53,17 @@ is_vmware() { || grep -q VMware /proc/ide/hd*/model 2>/dev/null } +# Find the disk device from given partition +disk_from_part() { + local i= part=${1#/dev/} + for i in /sys/block/*/$part; do + i=${i%/*} + echo "/dev/${i##*/}" + return 0 + done + return 1 +} + install_mounted_root() { local mnt="$1" local features="ata base bootchart cdrom ext2 ext3 ide scsi usb" @@ -69,7 +80,7 @@ install_mounted_root() { return 1 fi - rootdisk=${rootdev%[0-9]*} + rootdisk=$(disk_from_part $rootdev) echon "Installing system on $rootdev: " lbu package - | tar -C "$mnt" -zx @@ -82,8 +93,7 @@ install_mounted_root() { acct linux-grsec alpine-base >/dev/null || return 1 echo "" # make things bootable - kernel=$(ls "$mnt"/lib/modules) - if [ "$rootdisk" = "/dev/md" ]; then + if [ -e "/sys/block/${rootdev#/dev/}/md" ]; then local md=${rootdev#/dev/} features="$features raid" raidmod=$(cat /sys/block/$md/md/level) @@ -135,8 +145,6 @@ EOF apk del -q syslinux } - - # figure out decent default swap size in mega bytes find_swap_size() { local memtotal_kb=$(awk '$1 == "MemTotal:" {print $2}' /proc/meminfo) |