diff options
-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) |