From eca45859109bd36ca26656e0b911d9958f053800 Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 4 Apr 2019 21:00:19 +0000 Subject: [PATCH] modernize, and avoid -a -o --- distrib/amiga/miniroot/install.md | 24 +++++------ distrib/atari/floppies/prepare/install.md | 12 +++--- distrib/hp300/miniroot/install.md | 52 +++++++++++------------ distrib/mvme68k/miniroot/install.md | 8 ++-- distrib/sparc/install.md | 18 ++++---- distrib/sun2/miniroot/install.md | 10 ++--- distrib/sun3/miniroot/install.md | 12 +++--- 7 files changed, 68 insertions(+), 68 deletions(-) diff --git a/distrib/amiga/miniroot/install.md b/distrib/amiga/miniroot/install.md index 2ff7586a6479..e9c08050a59e 100644 --- a/distrib/amiga/miniroot/install.md +++ b/distrib/amiga/miniroot/install.md @@ -1,4 +1,4 @@ -# $NetBSD: install.md,v 1.28 2017/08/15 12:07:23 mlelstv Exp $ +# $NetBSD: install.md,v 1.29 2019/04/04 21:00:19 christos Exp $ # # # Copyright (c) 1996,2006 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ __mount_kernfs() { # # Force kern_fs to be mounted # - if [ ! -d /kern -o ! -e /kern/msgbuf ]; then + if [ ! -d /kern ] || [ ! -e /kern/msgbuf ]; then mkdir /kern > /dev/null 2>&1 /sbin/mount_kernfs /kern /kern >/dev/null 2>&1 fi @@ -126,12 +126,12 @@ md_prep_disklabel() { md_view_labels_possible=1 md_view_labels() { - _DKDEVS=`md_get_diskdevs` + _DKDEVS=$(md_get_diskdevs) echo "If you like, you can now examine the labels of your disks." echo "" echo -n "Available are "${_DKDEVS}". Look at which? [skip this step] " getresp "done" - while [ "X$resp" != "Xdone" ]; do + while [ "${resp:-done}" != "done" ]; do echo "" disklabel ${resp} echo "" @@ -169,9 +169,9 @@ __welcome_banner_1 This program is designed to help you upgrade your NetBSD system in a simple and rational way. -As a reminder, installing the `etc' binary set is NOT recommended. +As a reminder, installing the 'etc' binary set is NOT recommended. Once the rest of your system has been upgraded, you should manually -merge any changes to files in the `etc' set into those files which +merge any changes to files in the 'etc' set into those files which already exist on your system. __welcome_banner_2 fi @@ -194,7 +194,7 @@ __welcome_banner_3 md_not_going_to_install() { cat << \__not_going_to_install_1 -OK, then. Enter `halt' at the prompt to halt the machine. Once the +OK, then. Enter 'halt' at the prompt to halt the machine. Once the machine has halted, power-cycle the system to load new boot code. Note: If you wish to have another try. Just type '^D' at the prompt. After @@ -247,7 +247,7 @@ md_copy_kernel() { echo -n "on the installation filesystem? (y/n) [n] " resp="n" getresp "" - if [ "${resp}" != "y" -a "${resp}" != "Y" ]; then + if [ "${resp}" != "y" ] && [ "${resp}" != "Y" ]; then return fi fi @@ -267,7 +267,7 @@ The following disk devices are installed on your system; please select the disk device containing the partition with the netbsd kernel: __md_copy_kernel_1 - _DKDEVS=`md_get_diskdevs` + _DKDEVS=$(md_get_diskdevs) echo "$_DKDEVS" echo "fd0" echo "" @@ -280,14 +280,14 @@ __md_copy_kernel_1 # Get the directory where the file lives resp="" # force one iteration - while [ "X${resp}" = X"" ]; do + while [ -z "${resp}" ]; do echo "Enter the directory relative to the mount point that" echo -n "contains the file. [${_directory}] " getresp "${_directory}" done _directory=$resp - _sets=`(cd /mnt2/$_directory; ls netbsd* 2> /dev/null)` + _sets=$(cd /mnt2/$_directory; ls netbsd* 2> /dev/null) if [ -z "$_sets" ]; then echo "There are no NetBSD kernels available in \"$1\"" umount -f /mnt2 > /dev/null 2>&1 @@ -331,7 +331,7 @@ md_lib_is_aout() { test -h $1 && return 1 test -f $1 || return 1 - [ "`dd if=$1 bs=1 skip=1 count=3 2> /dev/null`" = "ELF" ] && return 1 + [ "$(dd if=$1 bs=1 skip=1 count=3 2> /dev/null)" = "ELF" ] && return 1 return 0 } diff --git a/distrib/atari/floppies/prepare/install.md b/distrib/atari/floppies/prepare/install.md index 7cbddf6c414e..20cbe7e0e3c9 100644 --- a/distrib/atari/floppies/prepare/install.md +++ b/distrib/atari/floppies/prepare/install.md @@ -1,4 +1,4 @@ -# $NetBSD: install.md,v 1.4 2017/11/25 09:41:45 tsutsui Exp $ +# $NetBSD: install.md,v 1.5 2019/04/04 21:00:19 christos Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ md_set_term() { __mount_kernfs() { # Make sure kernfs is mounted. - if [ ! -d /kern -o ! -e /kern/msgbuf ]; then + if [ ! -d /kern ] || [ ! -e /kern/msgbuf ]; then mkdir /kern > /dev/null 2>&1 /sbin/mount_kernfs /kern /kern fi @@ -125,9 +125,9 @@ You will now be given the opportunity to place disklabels on any additional disks on your system. __md_prep_disklabel_4 - _DKDEVS=`rmel ${1} ${_DKDEVS}` - resp="X" # force at least one iteration - while [ "X$resp" != X"done" ]; do + _DKDEVS=$(rmel ${1} ${_DKDEVS}) + resp="not-done" # force at least one iteration + while [ "$resp" != "done" ]; do labelmoredisks done } @@ -162,7 +162,7 @@ __welcome_banner_1 md_not_going_to_install() { cat << \__not_going_to_install_1 -OK, then. Enter `halt' at the prompt to halt the machine. Once the +OK, then. Enter 'halt' at the prompt to halt the machine. Once the machine has halted, power-cycle the system to load new boot code. Note: If you wish to have another try. Just type '^D' at the prompt. After diff --git a/distrib/hp300/miniroot/install.md b/distrib/hp300/miniroot/install.md index 3407342c138a..003b8f4267fc 100644 --- a/distrib/hp300/miniroot/install.md +++ b/distrib/hp300/miniroot/install.md @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: install.md,v 1.15 2011/02/06 18:26:51 tsutsui Exp $ +# $NetBSD: install.md,v 1.16 2019/04/04 21:00:19 christos Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. @@ -120,10 +120,10 @@ hp300_init_label_scsi_disk() { # $1 is the disk to label # Name the disks we install in the temporary fstab. - if [ "X${_disk_instance}" = "X" ]; then + if [ -z "${_disk_instance}" ]; then _disk_instance="0" else - _disk_instance=`expr $_disk_instance + 1` + _disk_instance=$(expr $_disk_instance + 1) fi _cur_disk_name="install-disk-${_disk_instance}" @@ -168,35 +168,35 @@ __scsi_label_1 _secsize="$resp" resp="" # force one iteration - while [ "X${resp}" = "X" ]; do + while [ -z "${resp}" ]; do echo -n "Number of cylinders? " getresp "" done _cylinders="$resp" - _fudge_cyl=`expr $_cylinders + 1` + _fudge_cyl=$(expr $_cylinders + 1) resp="" # force one iteration - while [ "X${resp}" = "X" ]; do + while [ -z "${resp}" ]; do echo -n "Number of tracks (heads)? " getresp "" done _tracks_per_cyl="$resp" resp="" # force one iteration - while [ "X${resp}" = "X" ]; do + while [ -z "${resp}" ]; do echo -n "Number of disk sectors (blocks)? " getresp "" done _nsectors="$resp" # Calculate some values we need. - _sec_per_cyl=`expr $_nsectors / $_cylinders` - _sec_per_track=`expr $_sec_per_cyl / $_tracks_per_cyl` - _new_c_size=`expr $_sec_per_track \* $_tracks_per_cyl \* $_cylinders` + _sec_per_cyl=$(expr $_nsectors / $_cylinders) + _sec_per_track=$(expr $_sec_per_cyl / $_tracks_per_cyl) + _new_c_size=$(expr $_sec_per_track \* $_tracks_per_cyl \* $_cylinders) # Emit a disktab entry, suitable for getting started. - # What we have is a `c' partition with the total number of - # blocks, and an `a' partition with 1 sector; just large enough + # What we have is a 'c' partition with the total number of + # blocks, and an 'a' partition with 1 sector; just large enough # to open. Don't ask. echo "" >> /etc/disktab echo "# Created by install" >> /etc/disktab @@ -207,18 +207,18 @@ __scsi_label_1 echo " :pc#${_nsectors}:" >> /etc/disktab # Ok, here's what we need to do. First of all, we install - # this initial label by opening the `c' partition of the disk - # and using the `-r' flag for disklabel(8). However, because + # this initial label by opening the 'c' partition of the disk + # and using the '-r' flag for disklabel(8). However, because # of limitations in disklabel(8), we've had to fudge the number # of cylinders up 1 so that disklabel(8) doesn't complain about - # `c' running past the end of the disk, which can be quite + # 'c' running past the end of the disk, which can be quite # common even with OEM HP drives! So, we've given ourselves - # an `a' partition, which is the minimum needed to open the disk + # an 'a' partition, which is the minimum needed to open the disk # so that we can perform the DIOCWDLABEL ioctl. So, once the - # initial label is installed, we open the `a' partition so that + # initial label is installed, we open the 'a' partition so that # we can fix up the number of cylinders and make the size of - # `c' come out to (ncyl * ntracks_per_cyl * nsec_per_track). - # After that's done, we re-open `c' and let the user actually + # 'c' come out to (ncyl * ntracks_per_cyl * nsec_per_track). + # After that's done, we re-open 'c' and let the user actually # edit the partition table. It's horrible, I know. Bleh. disklabel -W ${1} @@ -273,10 +273,10 @@ hp300_init_label_hpib_disk() { # the model number for the provided disk. _hpib_disktype="" if dmesg | grep_check_q "${1}: "; then - _hpib_disktype=HP`dmesg | plain_grep "${1}: " | sort -u | \ - awk '{print $2}'` + _hpib_disktype=HP$(dmesg | plain_grep "${1}: " | sort -u | \ + awk '{print $2}') fi - if [ "X${_hpib_disktype}" = "X" ]; then + if [ -z "${_hpib_disktype}" ]; then echo "" echo "ERROR: $1 doesn't appear to exist?!" rval="1" @@ -361,7 +361,7 @@ md_labeldisk() { # Check to see if installing the default was # successful. If so, go ahead and pop into the # disklabel editor. - if [ "X${rval}" != X"0" ]; then + if [ "${rval}" != "0" ]; then echo "Sorry, can't label this disk." echo "" return; @@ -437,9 +437,9 @@ You will now be given the opportunity to place disklabels on any additional disks on your system. __md_prep_disklabel_4 - _DKDEVS=`rmel ${ROOTDISK} ${_DKDEVS}` - resp="X" # force at least one iteration - while [ "X$resp" != X"done" ]; do + _DKDEVS=$(rmel ${ROOTDISK} ${_DKDEVS}) + resp="not-done" # force at least one iteration + while [ "$resp" != "done" ]; do labelmoredisks done } diff --git a/distrib/mvme68k/miniroot/install.md b/distrib/mvme68k/miniroot/install.md index c04910f9f7d1..05ee112555c4 100644 --- a/distrib/mvme68k/miniroot/install.md +++ b/distrib/mvme68k/miniroot/install.md @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: install.md,v 1.6 2010/03/10 23:13:09 abs Exp $ +# $NetBSD: install.md,v 1.7 2019/04/04 21:00:19 christos Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. @@ -50,7 +50,7 @@ md_set_term() { __mount_kernfs() { # Make sure kernfs is mounted. - if [ ! -d /kern -o ! -e /kern/msgbuf ]; then + if [ ! -d /kern ] || [ ! -e /kern/msgbuf ]; then mkdir /kern > /dev/null 2>&1 /sbin/mount_kernfs /kern /kern >/dev/null 2>&1 fi @@ -161,10 +161,10 @@ Here is an example of what the partition information will look like once you have entered the disklabel editor. Disk partition sizes and offsets are in sector (most likely 512 bytes) units. Make sure these size/offset pairs are on cylinder boundaries (the number of sector per cylinder is -given in the `sectors/cylinder' entry, which is not shown here). +given in the 'sectors/cylinder' entry, which is not shown here). Do not change any parameters except the partition layout and the label name. -It's probably also wisest not to touch the `8 partitions:' line, even +It's probably also wisest not to touch the '8 partitions:' line, even in case you have defined less than eight partitions. [Example] diff --git a/distrib/sparc/install.md b/distrib/sparc/install.md index 51a4c115d9c8..88dd431f6c54 100644 --- a/distrib/sparc/install.md +++ b/distrib/sparc/install.md @@ -1,4 +1,4 @@ -# $NetBSD: install.md,v 1.22 2010/09/25 14:29:13 tsutsui Exp $ +# $NetBSD: install.md,v 1.23 2019/04/04 21:00:19 christos Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -107,10 +107,10 @@ md_checkfordisklabel() { local rval local cfdl - cfdl=`disklabel $1 2>&1 > /dev/null | \ + cfdl=$(disklabel $1 2>&1 > /dev/null | \ sed -n -e '/no disk label/{s/.*/ndl/p;q;}; \ /disk label corrupted/{s/.*/dlc/p;q;}; \ - $s/.*/no/p'` + $s/.*/no/p') if [ x$cfdl = xndl ]; then rval=1 elif [ x$cfdl = xdlc ]; then @@ -155,10 +155,10 @@ Here is an example of what the partition information will look like once you have entered the disklabel editor. Disk partition sizes and offsets are in sector (most likely 512 bytes) units. Make sure these size/offset pairs are on cylinder boundaries (the number of sector per cylinder is -given in the `sectors/cylinder' entry, which is not shown here). +given in the 'sectors/cylinder' entry, which is not shown here). Do not change any parameters except the partition layout and the label name. -It's probably also wisest not to touch the `8 partitions:' line, even +It's probably also wisest not to touch the '8 partitions:' line, even in case you have defined less than eight partitions. [Example] @@ -215,9 +215,9 @@ __welcome_banner_1 This program is designed to help you upgrade your NetBSD system in a simple and rational way. -As a reminder, installing the `etc' binary set is NOT recommended. +As a reminder, installing the 'etc' binary set is NOT recommended. Once the rest of your system has been upgraded, you should manually -merge any changes to files in the `etc' set into those files which +merge any changes to files in the 'etc' set into those files which already exist on your system. __welcome_banner_2 fi @@ -241,7 +241,7 @@ __welcome_banner_3 md_not_going_to_install() { cat << \__not_going_to_install_1 -OK, then. Enter `halt' at the prompt to halt the machine. Once the +OK, then. Enter 'halt' at the prompt to halt the machine. Once the machine has halted, power-cycle the system to load new boot code. __not_going_to_install_1 @@ -268,7 +268,7 @@ md_lib_is_aout() { test -h $1 && return 1 test -f $1 || return 1 - [ "`dd if=$1 bs=1 skip=1 count=3 2> /dev/null`" = "ELF" ] && return 1 + [ "$(dd if=$1 bs=1 skip=1 count=3 2> /dev/null)" = "ELF" ] && return 1 return 0 } diff --git a/distrib/sun2/miniroot/install.md b/distrib/sun2/miniroot/install.md index 8fb3336456a3..83745f3c17bb 100644 --- a/distrib/sun2/miniroot/install.md +++ b/distrib/sun2/miniroot/install.md @@ -1,4 +1,4 @@ -# $NetBSD: install.md,v 1.3 2008/04/30 13:10:49 martin Exp $ +# $NetBSD: install.md,v 1.4 2019/04/04 21:00:19 christos Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -49,7 +49,7 @@ md_set_term() { __mount_kernfs() { # Make sure kernfs is mounted. - if [ ! -d /kern -o ! -e /kern/msgbuf ]; then + if [ ! -d /kern ] || [ ! -e /kern/msgbuf ]; then mkdir /kern > /dev/null 2>&1 /sbin/mount_kernfs /kern /kern fi @@ -176,9 +176,9 @@ __welcome_banner_1 This program is designed to help you upgrade your NetBSD system in a simple and rational way. -As a reminder, installing the `etc' binary set is NOT recommended. +As a reminder, installing the 'etc' binary set is NOT recommended. Once the rest of your system has been upgraded, you should manually -merge any changes to files in the `etc' set into those files which +merge any changes to files in the 'etc' set into those files which already exist on your system. __welcome_banner_2 fi @@ -201,7 +201,7 @@ __welcome_banner_3 md_not_going_to_install() { cat << \__not_going_to_install_1 -OK, then. Enter `halt' at the prompt to halt the machine. Once the +OK, then. Enter 'halt' at the prompt to halt the machine. Once the machine has halted, power-cycle the system to load new boot code. __not_going_to_install_1 diff --git a/distrib/sun3/miniroot/install.md b/distrib/sun3/miniroot/install.md index 9bf48c332316..1eb40750e00a 100644 --- a/distrib/sun3/miniroot/install.md +++ b/distrib/sun3/miniroot/install.md @@ -1,4 +1,4 @@ -# $NetBSD: install.md,v 1.3 2008/04/30 13:10:49 martin Exp $ +# $NetBSD: install.md,v 1.4 2019/04/04 21:00:19 christos Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -49,7 +49,7 @@ md_set_term() { __mount_kernfs() { # Make sure kernfs is mounted. - if [ ! -d /kern -o ! -e /kern/msgbuf ]; then + if [ ! -d /kern ] || [ ! -e /kern/msgbuf ]; then mkdir /kern > /dev/null 2>&1 /sbin/mount_kernfs /kern /kern fi @@ -149,7 +149,7 @@ __md_prep_disklabel_1 md_copy_kernel() { if [ ! -f /mnt/netbsd ]; then - set -- `sysctl -n hw.model` + set -- $(sysctl -n hw.model) echo -n "No kernel set extracted. Copying $1 miniroot kernel..." cp -p /netbsd.$1 /mnt/netbsd echo "done." @@ -176,9 +176,9 @@ __welcome_banner_1 This program is designed to help you upgrade your NetBSD system in a simple and rational way. -As a reminder, installing the `etc' binary set is NOT recommended. +As a reminder, installing the 'etc' binary set is NOT recommended. Once the rest of your system has been upgraded, you should manually -merge any changes to files in the `etc' set into those files which +merge any changes to files in the 'etc' set into those files which already exist on your system. __welcome_banner_2 fi @@ -201,7 +201,7 @@ __welcome_banner_3 md_not_going_to_install() { cat << \__not_going_to_install_1 -OK, then. Enter `halt' at the prompt to halt the machine. Once the +OK, then. Enter 'halt' at the prompt to halt the machine. Once the machine has halted, power-cycle the system to load new boot code. __not_going_to_install_1