summaryrefslogtreecommitdiffstats
path: root/setup-disk.in
diff options
context:
space:
mode:
Diffstat (limited to 'setup-disk.in')
-rw-r--r--setup-disk.in12
1 files changed, 9 insertions, 3 deletions
diff --git a/setup-disk.in b/setup-disk.in
index f0e4370..baaf1b9 100644
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -3,6 +3,7 @@
PREFIX=
. "$PREFIX/lib/libalpine.sh"
+MBR=${MBR:-"/usr/share/syslinux/mbr.bin"}
in_list() {
local i="$1"
@@ -55,7 +56,9 @@ install_mounted_root() {
# get a list of slaves
rootdisk=
for i in /sys/block/$md/slaves/*; do
- rootdisk="$rootdisk /dev/${i##*/}"
+ j=${i##*/}
+ i=${j%[0-9]*}
+ rootdisk="$rootdisk /dev/${i}"
done
fi
chroot "$mnt" /sbin/mkinitfs -F "$features" $kernel
@@ -74,7 +77,10 @@ install_mounted_root() {
# fix mbr for all disk devices
for i in $rootdisk; do
- dd if=/usr/share/syslinux/mbr.bin of=$i
+ local errmsg
+ echo "Writing MBR to $i"
+ errmsg=$(dd if="$MBR" of=$i 2>&1) \
+ || echo "$errmsg"
done
echo ""
echo "Installation is done. Please reboot."
@@ -108,7 +114,7 @@ useall() {
if [ -d "$1" ]; then
# install to given mounted root
- install_mounted_root "$1"
+ install_mounted_root "${1%/}"
exit $?
fi