diff options
author | 2012-07-13 14:50:34 +0000 | |
---|---|---|
committer | 2012-07-13 14:50:34 +0000 | |
commit | b6c16072e38f0d8faeadd30143053f16aa6949a5 (patch) | |
tree | b1f65c558ba41e00f489bbd7fc1ef0907a67028c | |
parent | Improve diffability with amd64 (diff) | |
download | wireguard-openbsd-b6c16072e38f0d8faeadd30143053f16aa6949a5.tar.xz wireguard-openbsd-b6c16072e38f0d8faeadd30143053f16aa6949a5.zip |
copy boot loaders using cat and shell redirection rather than cp,
since the latter may insert holes in the target files, which could
be bad for the boot process
ok deraadt@ guenther@
-rw-r--r-- | distrib/alpha/common/install.md | 8 | ||||
-rw-r--r-- | distrib/amd64/common/install.md | 5 | ||||
-rw-r--r-- | distrib/landisk/ramdisk/install.md | 8 | ||||
-rw-r--r-- | distrib/loongson/ramdisk/install.md | 5 | ||||
-rw-r--r-- | distrib/macppc/ramdisk/install.md | 5 | ||||
-rw-r--r-- | distrib/mvme68k/ramdisk/install.md | 5 | ||||
-rw-r--r-- | distrib/mvme88k/ramdisk/install.md | 5 | ||||
-rw-r--r-- | distrib/sparc/install.md | 5 | ||||
-rw-r--r-- | distrib/sparc64/common/install.md | 5 | ||||
-rw-r--r-- | distrib/vax/install.md | 5 |
10 files changed, 34 insertions, 22 deletions
diff --git a/distrib/alpha/common/install.md b/distrib/alpha/common/install.md index af6ef5b20de..34060ea8646 100644 --- a/distrib/alpha/common/install.md +++ b/distrib/alpha/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.33 2012/07/10 14:25:00 halex Exp $ +# $OpenBSD: install.md,v 1.34 2012/07/13 14:50:34 halex Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. @@ -38,10 +38,12 @@ md_installboot() { # use extracted mdec if it exists (may be newer) if [ -d /mnt/usr/mdec ]; then - cp /mnt/usr/mdec/boot /mnt/boot + # Use cat to avoid holes created by cp(1) + cat /mnt/usr/mdec/boot > /mnt/boot /mnt/usr/mdec/installboot /mnt/boot /mnt/usr/mdec/bootxx $_rawdev elif [ -d /usr/mdec ]; then - cp /usr/mdec/boot /mnt/boot + # Use cat to avoid holes created by cp(1) + cat /usr/mdec/boot > /mnt/boot /usr/mdec/installboot /mnt/boot /usr/mdec/bootxx $_rawdev fi } diff --git a/distrib/amd64/common/install.md b/distrib/amd64/common/install.md index 7b3034ba2b9..1472086b241 100644 --- a/distrib/amd64/common/install.md +++ b/distrib/amd64/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.30 2012/07/10 14:25:00 halex Exp $ +# $OpenBSD: install.md,v 1.31 2012/07/13 14:50:34 halex Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -39,7 +39,8 @@ NCPU=$(sysctl -n hw.ncpufound) ((NCPU > 1)) && { DEFAULTSETS="bsd bsd.rd bsd.mp" ; SANESETS="bsd bsd.mp" ; } md_installboot() { - cp /usr/mdec/boot /mnt/boot + # Use cat to avoid holes created by cp(1) + cat /usr/mdec/boot > /mnt/boot if ! /usr/mdec/installboot /mnt/boot /usr/mdec/biosboot ${1} ; then echo "\nFailed to install bootblocks." echo "You will not be able to boot OpenBSD from ${1}." diff --git a/distrib/landisk/ramdisk/install.md b/distrib/landisk/ramdisk/install.md index 9cdbf875d18..d4c0fc13fd6 100644 --- a/distrib/landisk/ramdisk/install.md +++ b/distrib/landisk/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.27 2012/07/10 14:25:00 halex Exp $ +# $OpenBSD: install.md,v 1.28 2012/07/13 14:50:34 halex Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -37,9 +37,11 @@ md_installboot() { # use extracted mdec if it exists (may be newer) if [ -d /mnt/usr/mdec ]; then - cp /mnt/usr/mdec/boot /mnt/boot + # Use cat to avoid holes created by cp(1) + cat /mnt/usr/mdec/boot > /mnt/boot elif [ -d /usr/mdec ]; then - cp /usr/mdec/boot /mnt/boot + # Use cat to avoid holes created by cp(1) + cat /usr/mdec/boot > /mnt/boot fi } diff --git a/distrib/loongson/ramdisk/install.md b/distrib/loongson/ramdisk/install.md index 22cb8b62941..b10cfae7fe2 100644 --- a/distrib/loongson/ramdisk/install.md +++ b/distrib/loongson/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.10 2012/07/13 12:00:48 halex Exp $ +# $OpenBSD: install.md,v 1.11 2012/07/13 14:50:34 halex Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -35,9 +35,10 @@ md_installboot() { local _disk=$1 + # Use cat below to avoid holes created by cp(1) if mount -t ext2fs /dev/${_disk}i /mnt2 && mkdir -p /mnt2/boot && - cp /usr/mdec/boot /mnt2/boot && + cat /usr/mdec/boot > /mnt2/boot/boot && { [[ $(sysctl -n hw.product) != Gdium ]] || cp /mnt/bsd /mnt2/boot/bsd; }; then umount /mnt2 diff --git a/distrib/macppc/ramdisk/install.md b/distrib/macppc/ramdisk/install.md index db855386291..68573de3ae6 100644 --- a/distrib/macppc/ramdisk/install.md +++ b/distrib/macppc/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.51 2012/07/10 14:25:00 halex Exp $ +# $OpenBSD: install.md,v 1.52 2012/07/13 14:50:34 halex Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -45,7 +45,8 @@ md_installboot() { if fdisk $_disk | grep -q 'Signature: 0xAA55'; then if fdisk $_disk | grep -q '^..: 06 '; then if mount /dev/${_disk}i /mnt2 >/dev/null 2>&1; then - cp /usr/mdec/ofwboot /mnt2 + # Use cat to avoid holes created by cp(1) + cat /usr/mdec/ofwboot > /mnt2/ofwboot umount /mnt2 fi fi diff --git a/distrib/mvme68k/ramdisk/install.md b/distrib/mvme68k/ramdisk/install.md index 35235025c4e..c80defd8e80 100644 --- a/distrib/mvme68k/ramdisk/install.md +++ b/distrib/mvme68k/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.41 2012/07/10 14:25:00 halex Exp $ +# $OpenBSD: install.md,v 1.42 2012/07/13 14:50:34 halex Exp $ # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. # @@ -34,7 +34,8 @@ MDTERM=vt100 md_installboot() { - cp /mnt/usr/mdec/bootsd /mnt/boot + # Use cat to avoid holes created by cp(1) + cat /mnt/usr/mdec/bootsd > /mnt/boot /mnt/usr/mdec/installboot /mnt/boot /mnt/usr/mdec/bootxx /dev/r${1}a } diff --git a/distrib/mvme88k/ramdisk/install.md b/distrib/mvme88k/ramdisk/install.md index 9647ac68740..e22195a5bc7 100644 --- a/distrib/mvme88k/ramdisk/install.md +++ b/distrib/mvme88k/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.41 2012/07/10 14:25:00 halex Exp $ +# $OpenBSD: install.md,v 1.42 2012/07/13 14:50:34 halex Exp $ # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. # @@ -37,7 +37,8 @@ NCPU=$(sysctl -n hw.ncpufound) ((NCPU > 1)) && { DEFAULTSETS="bsd bsd.rd bsd.mp" ; SANESETS="bsd bsd.mp" ; } md_installboot() { - cp /mnt/usr/mdec/bootsd /mnt/boot + # Use cat to avoid holes created by cp(1) + cat /mnt/usr/mdec/bootsd > /mnt/boot /mnt/usr/mdec/installboot /mnt/boot /mnt/usr/mdec/bootxx /dev/r${1}a } diff --git a/distrib/sparc/install.md b/distrib/sparc/install.md index 9766a9c0e11..0e8c09cab53 100644 --- a/distrib/sparc/install.md +++ b/distrib/sparc/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.66 2012/07/10 14:25:00 halex Exp $ +# $OpenBSD: install.md,v 1.67 2012/07/13 14:50:34 halex Exp $ # $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $ # # @@ -50,7 +50,8 @@ md_installboot() { return fi - cp ${_prefix}/boot /mnt/boot + # Use cat to avoid holes created by cp(1) + cat ${_prefix}/boot > /mnt/boot sync installboot /mnt/boot ${_prefix}/bootxx /dev/r${1}c } diff --git a/distrib/sparc64/common/install.md b/distrib/sparc64/common/install.md index 1fa5c8219c6..ecfe74969f0 100644 --- a/distrib/sparc64/common/install.md +++ b/distrib/sparc64/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.37 2012/07/10 14:25:00 halex Exp $ +# $OpenBSD: install.md,v 1.38 2012/07/13 14:50:34 halex Exp $ # $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $ # # @@ -53,7 +53,8 @@ md_installboot() { return fi - cp ${_prefix}/ofwboot /mnt/ofwboot + # Use cat to avoid holes created by cp(1) + cat ${_prefix}/ofwboot > /mnt/ofwboot sync ${_prefix}/installboot ${_prefix}/bootblk /dev/r${1}c } diff --git a/distrib/vax/install.md b/distrib/vax/install.md index 05f831130af..31d1bf118c6 100644 --- a/distrib/vax/install.md +++ b/distrib/vax/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.38 2012/07/10 14:25:00 halex Exp $ +# $OpenBSD: install.md,v 1.39 2012/07/13 14:50:34 halex Exp $ # $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $ # # @@ -39,7 +39,8 @@ MDCDDEVS='/^cd[0-9] /s/ .*//p;/^ra[0-9] .* RRD40$/s/ .*//p' MDMTDEVS='/^[ms]t[0-9][0-9]* /s/ .*//p' md_installboot() { - cp /mnt/usr/mdec/boot /mnt/boot + # Use cat to avoid holes created by cp(1) + cat /mnt/usr/mdec/boot > /mnt/boot /sbin/disklabel -B $1 } |