aboutsummaryrefslogtreecommitdiff
path: root/tools/boot/install-boot.sh
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2017-12-15 23:16:27 +0000
committerWarner Losh <imp@FreeBSD.org>2017-12-15 23:16:27 +0000
commit9b544478b12777856bae0ff949e972bb906b8acb (patch)
tree88c72bbc07fbe45b0e4d6c9a0c538cdabb029c72 /tools/boot/install-boot.sh
parent68eadcec0f7c8ab0537d7ffd736eb7d3d3d9a4a9 (diff)
downloadsrc-9b544478b12777856bae0ff949e972bb906b8acb.tar.gz
src-9b544478b12777856bae0ff949e972bb906b8acb.zip
For now, make the gpart commands verbose so we know exactly what's
being installed. Fix problem with gpt + zfs installing the wrong loader... Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=326883
Diffstat (limited to 'tools/boot/install-boot.sh')
-rwxr-xr-xtools/boot/install-boot.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/boot/install-boot.sh b/tools/boot/install-boot.sh
index 7f6bf3c8c342..d2b3eacfa48f 100755
--- a/tools/boot/install-boot.sh
+++ b/tools/boot/install-boot.sh
@@ -15,6 +15,11 @@ die() {
exit 1
}
+doit() {
+ echo $*
+ eval $*
+}
+
find-part() {
dev=$1
part=$2
@@ -30,7 +35,7 @@ boot_nogeli_gpt_zfs_legacy() {
if [ -z "$idx" ] ; then
die "No freebsd-boot partition found"
fi
- gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev
+ doit gpart bootcode -b ${gpt0} -p ${gptzfs2} -i $idx $dev
exit 0
}
@@ -42,7 +47,7 @@ boot_nogeli_gpt_ufs_legacy() {
if [ -z "$idx" ] ; then
die "No freebsd-boot partition found"
fi
- gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev
+ doit gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev
exit 0
}
@@ -58,9 +63,9 @@ boot_nogeli_mbr_zfs_legacy() {
# search to find the freebsd-zfs partition within the slice
# Or just assume it is 'a' because it has to be since it fails otherwise
dd if=${dst}/boot/zfsboot of=/tmp/zfsboot1 count=1
- gpart bootcode -b /tmp/zfsboo1 ${dev}s${s} # Put boot1 into the start of part
+ doit gpart bootcode -b /tmp/zfsboo1 ${dev}s${s} # Put boot1 into the start of part
sysctl kern.geom.debugflags=0x10 # Put boot2 into ZFS boot slot
- dd if=${dst}/boot/zfsboot of=/dev/${dev}s${s} iseek=1 seek=1024
+ doit dd if=${dst}/boot/zfsboot of=/dev/${dev}s${s} iseek=1 seek=1024
sysctl kern.geom.debugflags=0x0
exit 0
@@ -70,12 +75,12 @@ boot_nogeli_mbr_ufs_legacy() {
dev=$1
dst=$2
- gpart bootcode -b ${mbr0} ${dev}
+ doit gpart bootcode -b ${mbr0} ${dev}
s=$(findpart $dev "freebsd-ufs")
if [ -z "$s" ] ; then
die "No freebsd-zfs slice found"
fi
- gpart bootcode -p ${mbr2} ${dev}s${s}
+ doit gpart bootcode -p ${mbr2} ${dev}s${s}
exit 0
}