summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrpe <rpe@openbsd.org>2014-04-19 16:50:52 +0000
committerrpe <rpe@openbsd.org>2014-04-19 16:50:52 +0000
commit77cf9be1f7448832983f5a226c415661f2a27d1c (patch)
treedf757ed1f618a9cf04fd8f0e2cd256bd60d24b93
parentMore KNF. (diff)
downloadwireguard-openbsd-77cf9be1f7448832983f5a226c415661f2a27d1c.tar.xz
wireguard-openbsd-77cf9be1f7448832983f5a226c415661f2a27d1c.zip
Simplify things by using the return code of ask_yn() directly instead
of looking in resp. No need to specify 'no' as default answer. It's the default for ask_yn() anyway. OK krw@ halex@
-rw-r--r--distrib/miniroot/install.sh8
-rw-r--r--distrib/miniroot/install.sub16
2 files changed, 8 insertions, 16 deletions
diff --git a/distrib/miniroot/install.sh b/distrib/miniroot/install.sh
index e13d226fa9d..91c01c07ffc 100644
--- a/distrib/miniroot/install.sh
+++ b/distrib/miniroot/install.sh
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sh,v 1.246 2014/03/20 20:01:28 krw Exp $
+# $OpenBSD: install.sh,v 1.247 2014/04/19 16:50:52 rpe Exp $
# $NetBSD: install.sh,v 1.5.2.8 1996/08/27 18:15:05 gwr Exp $
#
# Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback
@@ -69,8 +69,7 @@ _fsent=
# Remove traces of previous install attempt.
rm -f /tmp/fstab*
-ask_yn "Use DUIDs rather than device names in fstab?" yes
-[[ $resp == y ]] && FSTABFLAG=-F
+ask_yn "Use DUIDs rather than device names in fstab?" yes && FSTABFLAG=-F
while :; do
DISKS_DONE=$(addel "$DISK" $DISKS_DONE)
@@ -209,8 +208,7 @@ fi
if _time=$(http_time) && _now=$(date +%s) &&
(( _now - _time > 120 || _time - _now > 120 )); then
_tz=/mnt/usr/share/zoneinfo/$TZ
- ask_yn "Time appears wrong. Set to '$(TZ=$_tz date -r "$(http_time)")'?" yes
- if [[ $resp == y ]]; then
+ if ask_yn "Time appears wrong. Set to '$(TZ=$_tz date -r "$(http_time)")'?" yes; then
# We do not need to specify TZ below since both date
# invocations use the same one
date $(date -r "$(http_time)" "+%Y%m%d%H%M.%S") >/dev/null
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index fa3e8fec5fe..46a6d1e47af 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.759 2014/04/16 13:12:22 krw Exp $
+# $OpenBSD: install.sub,v 1.760 2014/04/19 16:50:52 rpe Exp $
#
# Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback
# All rights reserved.
@@ -1477,8 +1477,7 @@ install_cdrom() {
}
install_disk() {
- ask_yn "Is the disk partition already mounted?"
- if [[ $resp == n ]]; then
+ if ! ask_yn "Is the disk partition already mounted?"; then
get_drive "disk" '$(bsort $(get_dkdevs))' \
'$(bsort $(rmel $ROOTDISK $(get_dkdevs)))' || return
mount_mnt2 $resp || return
@@ -1499,8 +1498,7 @@ install_nfs() {
NFS_PATH=$resp
# Determine use of TCP
- ask_yn "Use TCP transport? (requires TCP-capable NFS server)"
- [[ $resp == y ]] && _tcp=-T
+ ask_yn "Use TCP transport? (requires TCP-capable NFS server)" && _tcp=-T
# Mount the server
mount_nfs $_tcp -o ro -R 5 $NFS_ADDR:$NFS_PATH /mnt2 || return
@@ -1696,10 +1694,7 @@ mount_fs() {
if [[ -n $_fail ]]; then
# One or more mounts failed. Continue or abort?
echo "\nWARNING! The following filesystems were not properly mounted:$_fail"
- ask_yn "Continue anyway?" no
- if [[ $resp == n ]]; then
- exit
- fi
+ ask_yn "Continue anyway?" || exit
fi
}
@@ -1725,8 +1720,7 @@ getdevname() {
check_fs() {
local _dev _dn _mp _fstype _rest _fail _f _passno
- ask_yn "Force checking of clean non-root filesystems?"
- [[ $resp == y ]] && _f=f
+ ask_yn "Force checking of clean non-root filesystems?" && _f=f
while read _dev _mp _fstype _rest _rest _passno _rest; do
_dn=$(getdevname "$_dev")