Get rid of useless/confusing subshell
authorkn <kn@openbsd.org>
Wed, 19 Oct 2022 08:24:14 +0000 (08:24 +0000)
committerkn <kn@openbsd.org>
Wed, 19 Oct 2022 08:24:14 +0000 (08:24 +0000)
Other function, same stuff like r1.1210 except here there `>/dev/null 2>&1'
hammer is required to silence the ls(1) test.

The make_dev() call is no longer silenced now but does not print on stdout
anyway;  if making the device fails we'd like to know.

Otherwise if probing the disk fails it continues to be silenced.

(cvs diff -w -U1)
|@@ -2311,3 +2311,2 @@ is_rootdisk() {
|
|- (
|  make_dev $_d
|@@ -2322,6 +2321,6 @@ is_rootdisk() {
|  umount /mnt
|- fi
|+ fi >/dev/null 2>&1
|  rm -f /dev/{r,}$_d?
|+
|  return $_rc
|- ) >/dev/null 2>&1
| }

OK halex

distrib/miniroot/install.sub

index 2665e66..356f15b 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/ksh
-#      $OpenBSD: install.sub,v 1.1212 2022/10/16 08:47:20 kn Exp $
+#      $OpenBSD: install.sub,v 1.1213 2022/10/19 08:24:14 kn Exp $
 #
 # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
 # Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -2309,21 +2309,20 @@ set_timezone() {
 is_rootdisk() {
        local _d=$1 _rc=1
 
-       (
-               make_dev $_d
-               if disklabel $_d | grep -q '^  a: .*4\.2BSD ' &&
-                       mount -t ffs -r /dev/${_d}a /mnt; then
-                       if $UU; then
-                               ls -d /mnt/{auto_upgrade.conf,bin,dev,etc,home,sbin,tmp,usr,var}
-                       else
-                               ls -d /mnt/{bin,dev,etc,home,sbin,tmp,usr,var}
-                       fi
-                       _rc=$?
-                       umount /mnt
+       make_dev $_d
+       if disklabel $_d | grep -q '^  a: .*4\.2BSD ' &&
+               mount -t ffs -r /dev/${_d}a /mnt; then
+               if $UU; then
+                       ls -d /mnt/{auto_upgrade.conf,bin,dev,etc,home,sbin,tmp,usr,var}
+               else
+                       ls -d /mnt/{bin,dev,etc,home,sbin,tmp,usr,var}
                fi
-               rm -f /dev/{r,}$_d?
-               return $_rc
-       ) >/dev/null 2>&1
+               _rc=$?
+               umount /mnt
+       fi >/dev/null 2>&1
+       rm -f /dev/{r,}$_d?
+
+       return $_rc
 }
 
 # Get global root information. ie. ROOTDISK, ROOTDEV and SWAPDEV.