summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-05-23 09:28:42 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-05-23 09:28:42 +0000
commitb89d96cbb198f554f03d75b7ea15c7d88dc4b732 (patch)
tree0d558901abbdde342831e641e53e70016bb58c80
parentb92c930df4ed2f5dc749eba2f098294f4a934d30 (diff)
downloadalpine-conf-b89d96cbb198f554f03d75b7ea15c7d88dc4b732.tar.bz2
alpine-conf-b89d96cbb198f554f03d75b7ea15c7d88dc4b732.tar.xz
setup-disk: write mbr to correct devices when use raid
and strip trailing / from mounted partition
-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