Commit 9158a74b authored by Natanael Copa's avatar Natanael Copa

setup-disk: fix for detecting disk from given partition

This should fix detecting /dev/cciss/c0d0 from /dev/cciss/c0d0p1
parent 841c6823
...@@ -53,6 +53,17 @@ is_vmware() { ...@@ -53,6 +53,17 @@ is_vmware() {
|| grep -q VMware /proc/ide/hd*/model 2>/dev/null || 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() { install_mounted_root() {
local mnt="$1" local mnt="$1"
local features="ata base bootchart cdrom ext2 ext3 ide scsi usb" local features="ata base bootchart cdrom ext2 ext3 ide scsi usb"
...@@ -69,7 +80,7 @@ install_mounted_root() { ...@@ -69,7 +80,7 @@ install_mounted_root() {
return 1 return 1
fi fi
rootdisk=${rootdev%[0-9]*} rootdisk=$(disk_from_part $rootdev)
echon "Installing system on $rootdev: " echon "Installing system on $rootdev: "
lbu package - | tar -C "$mnt" -zx lbu package - | tar -C "$mnt" -zx
...@@ -82,8 +93,7 @@ install_mounted_root() { ...@@ -82,8 +93,7 @@ install_mounted_root() {
acct linux-grsec alpine-base >/dev/null || return 1 acct linux-grsec alpine-base >/dev/null || return 1
echo "" echo ""
# make things bootable # make things bootable
kernel=$(ls "$mnt"/lib/modules) if [ -e "/sys/block/${rootdev#/dev/}/md" ]; then
if [ "$rootdisk" = "/dev/md" ]; then
local md=${rootdev#/dev/} local md=${rootdev#/dev/}
features="$features raid" features="$features raid"
raidmod=$(cat /sys/block/$md/md/level) raidmod=$(cat /sys/block/$md/md/level)
...@@ -135,8 +145,6 @@ EOF ...@@ -135,8 +145,6 @@ EOF
apk del -q syslinux apk del -q syslinux
} }
# figure out decent default swap size in mega bytes # figure out decent default swap size in mega bytes
find_swap_size() { find_swap_size() {
local memtotal_kb=$(awk '$1 == "MemTotal:" {print $2}' /proc/meminfo) local memtotal_kb=$(awk '$1 == "MemTotal:" {print $2}' /proc/meminfo)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment