Commit b89d96cb authored by Natanael Copa's avatar Natanael Copa

setup-disk: write mbr to correct devices when use raid

and strip trailing / from mounted partition
parent b92c930d
......@@ -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
......
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