Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib modernize, and avoid -a -o



details:   https://anonhg.NetBSD.org/src/rev/3ae0d4189715
branches:  trunk
changeset: 840384:3ae0d4189715
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 04 21:00:19 2019 +0000

description:
modernize, and avoid -a -o

diffstat:

 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(-)

diffs (truncated from 454 to 300 lines):

diff -r 352f744531e8 -r 3ae0d4189715 distrib/amiga/miniroot/install.md
--- a/distrib/amiga/miniroot/install.md Thu Apr 04 20:51:35 2019 +0000
+++ b/distrib/amiga/miniroot/install.md Thu Apr 04 21:00:19 2019 +0000
@@ -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 @@
        #
        # 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_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 @@
 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 @@
 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 @@
                        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 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 @@
 
        # 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 @@
        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 -r 352f744531e8 -r 3ae0d4189715 distrib/atari/floppies/prepare/install.md
--- a/distrib/atari/floppies/prepare/install.md Thu Apr 04 20:51:35 2019 +0000
+++ b/distrib/atari/floppies/prepare/install.md Thu Apr 04 21:00:19 2019 +0000
@@ -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 @@
 
 __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 @@
 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 @@
 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 -r 352f744531e8 -r 3ae0d4189715 distrib/hp300/miniroot/install.md
--- a/distrib/hp300/miniroot/install.md Thu Apr 04 20:51:35 2019 +0000
+++ b/distrib/hp300/miniroot/install.md Thu Apr 04 21:00:19 2019 +0000
@@ -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 @@
        # $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 @@
        _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 @@
        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 @@
        # 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 @@
                        # 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 @@
 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 -r 352f744531e8 -r 3ae0d4189715 distrib/mvme68k/miniroot/install.md
--- a/distrib/mvme68k/miniroot/install.md       Thu Apr 04 20:51:35 2019 +0000
+++ b/distrib/mvme68k/miniroot/install.md       Thu Apr 04 21:00:19 2019 +0000
@@ -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 @@
 
 __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 @@
 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.



Home | Main Index | Thread Index | Old Index