Module Name: src
Committed By: christos
Date: Thu Mar 7 22:03:16 UTC 2024
Modified Files:
src/usr.sbin/postinstall: postinstall.in
Log Message:
no local in loops, simplify eval (thanks kre)
To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/postinstall/postinstall.in
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.59 src/usr.sbin/postinstall/postinstall.in:1.60
--- src/usr.sbin/postinstall/postinstall.in:1.59 Thu Mar 7 11:54:16 2024
+++ src/usr.sbin/postinstall/postinstall.in Thu Mar 7 17:03:16 2024
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: postinstall.in,v 1.59 2024/03/07 16:54:16 christos Exp $
+# $NetBSD: postinstall.in,v 1.60 2024/03/07 22:03:16 christos Exp $
#
# Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -95,9 +95,10 @@ mkdtemp()
local base="/tmp/_postinstall.$$"
local serial=0
+ local dir
while true; do
- local dir="${base}.${serial}"
+ dir="${base}.${serial}"
mkdir -m 0700 "${dir}" && break
_serial=$((${serial} + 1))
done
@@ -320,11 +321,11 @@ populate_dir()
check_dir "${op}" "${dst}" 755 || return 1
local cmpdir_rv=0
- local f
+ local f fs fd error
for f in "$@"; do
- local fs="${src}/${f}"
- local fd="${dst}/${f}"
- local error=""
+ fs="${src}/${f}"
+ fd="${dst}/${f}"
+ error=""
if [ ! -f "${fd}" ]; then
error="${fd} does not exist"
elif ! cmp -s "${fs}" "${fd}" ; then
@@ -423,8 +424,7 @@ rcconf_is_set()
[ -f "${f}" ] && . "${f}"
done
eval echo -n \"\${${var}}\" 1>&3
- if eval "[ -n \"\${${var}}\" \
- -o \"\${${var}-UNSET}\" != \"UNSET\" ]"; then
+ if eval "[ -n \"\${${var}+SET}\" ]"; then
if [ -n "${verbose}" ]; then
msg \
"Obsolete rc.conf(5) variable '\$${var}' found.${notfixed}"
@@ -963,11 +963,11 @@ do_blocklist()
{
[ -n "$1" ] || err 3 "USAGE: do_blocklist fix|check"
local op="$1"
- local i
+ local i old
# if we are actually using blocklistd
for i in /var/db/blacklist.db /etc/blacklistd.conf; do
- local old="${DEST_DIR}${i}"
+ old="${DEST_DIR}${i}"
if [ ! -f "${old}" ]; then
continue
elif [ "$1" = "check" ]; then
@@ -1068,6 +1068,7 @@ do_catpages()
{
local op="$1"
local failed=0
+ local manbase sec
for manbase in /usr/share/man /usr/X11R6/man /usr/X11R7/man; do
for sec in 1 2 3 4 5 6 7 8 9; do
obsolete_catpages "$1" "${DEST_DIR}${manbase}" "${sec}"
@@ -2200,8 +2201,8 @@ do_rc()
${extra_scripts}
failed=$(( ${failed} + $? ))
+ local i rc_file
for i in ${rc_external_files}; do
- local rc_file
case $i in
*d) rc_file=${i};;
*) rc_file=${i}d;;
@@ -2527,6 +2528,7 @@ do_x11()
notfixed="${NOT_FIXED}"
fi
+ local d
# check if /usr/X11R6/lib/X11 needs to migrate to /etc/X11
if [ -n "${libx11}" ]; then
for d in \