PR install/53622 (probably)

When used as part of a network based install kernel, the SMALL "test" (aka [)
does not support -a or -o, so rewrite these scripts to avoid using that.
This commit is contained in:
kre 2018-09-22 13:17:46 +00:00
parent 217f541c2d
commit 795cf30baa
7 changed files with 23 additions and 23 deletions

View File

@ -77,19 +77,19 @@ build_resolv_conf()
eval_nd_dns()
{
eval ltime=\$nd${i}_rdnss${j}_lifetime
if [ -z "$ltime" -o "$ltime" = 0 ]; then
if [ -z "$ltime" ] || [ "$ltime" = 0 ]; then
rdnss=
else
eval rdnss=\$nd${i}_rdnss${j}_servers
fi
eval ltime=\$nd${i}_dnssl${j}_lifetime
if [ -z "$ltime" -o "$ltime" = 0 ]; then
if [ -z "$ltime" ] || [ "$ltime" = 0 ]; then
dnssl=
else
eval dnssl=\$nd${i}_dnssl${j}_search
fi
[ -z "$rdnss" -a -z "$dnssl" ] && return 1
[ -z "${rdnss}${dnssl}" ] && return 1
[ -n "$rdnss" ] && new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss"
[ -n "$dnssl" ] && new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl"
@ -130,9 +130,9 @@ add_resolv_conf()
fi
# If we don't have any configuration, remove it
if [ -z "$new_domain_name_servers" -a \
-z "$new_domain_name" -a \
-z "$new_domain_search" ]; then
if [ -z "$new_domain_name_servers" ] &&
[ -z "$new_domain_name" ] &&
[ -z "$new_domain_search" ]; then
remove_resolv_conf
return $?
fi

View File

@ -29,7 +29,7 @@ lookup_hostname()
set_hostname()
{
if [ -z "$new_host_name" -a -z "$new_fqdn_name" ]; then
if [ -z "${new_host_name}${new_fqdn_name}" ]; then
export new_host_name="$(lookup_hostname)"
fi
}

View File

@ -87,8 +87,8 @@ need_hostname()
fi
elif [ -n "$old_host_name" ]; then
if ${hfqdn}; then
if [ -n "$old_domain_name" -a \
"$old_host_name" = "${old_host_name#*.}" ]
if [ -n "$old_domain_name" ] &&
[ "$old_host_name" = "${old_host_name#*.}" ]
then
[ "$hostname" = \
"$old_host_name.$old_domain_name" ]
@ -131,8 +131,8 @@ set_hostname()
fi
elif [ -n "$new_host_name" ]; then
if ${hfqdn}; then
if [ -n "$new_domain_name" -a \
"$new_host_name" = "${new_host_name#*.}" ]
if [ -n "$new_domain_name" ] &&
[ "$new_host_name" = "${new_host_name#*.}" ]
then
try_hostname "$new_host_name.$new_domain_name"
else

View File

@ -96,7 +96,7 @@ build_ntp_conf()
printf %s "$servers" >> "$cf"
echo "$signature_base_end${header:+ $from }$header" >> "$cf"
else
[ -e "$ntp_conf" -a -e "$cf" ] || return
[ -e "$ntp_conf" ] && [ -e "$cf" ] || return
fi
# If we changed anything, restart ntpd

View File

@ -8,7 +8,7 @@ ypbind_pid()
make_yp_conf()
{
[ -z "$new_nis_domain" -a -z "$new_nis_servers" ] && return 0
[ -z "${new_nis_domain}${new_nis_servers}" ] && return 0
cf=/etc/yp.conf."$ifname"
rm -f "$cf"
echo "$signature" > "$cf"

View File

@ -41,7 +41,7 @@ make_yp_binding()
fi
nd="$(best_domain)"
if [ $? = 0 -a "$nd" != "$(domainname)" ]; then
if [ $? = 0 ] && [ "$nd" != "$(domainname)" ]; then
domainname "$nd"
if [ -n "$ypbind_restart_cmd" ]; then
eval $ypbind_restart_cmd

View File

@ -107,7 +107,7 @@ remove_markers()
# Compare two files.
comp_file()
{
[ -e "$1" -a -e "$2" ] || return 1
[ -e "$1" ] && [ -e "$2" ] || return 1
if type cmp >/dev/null 2>&1; then
cmp -s "$1" "$2"
@ -187,11 +187,11 @@ syslog()
valid_domainname()
{
name="$1"
[ -z "$name" -o ${#name} -gt 255 ] && return 1
[ -z "$name" ] || [ ${#name} -gt 255 ] && return 1
while [ -n "$name" ]; do
label="${name%%.*}"
[ -z "$label" -o ${#label} -gt 63 ] && return 1
[ -z "$label" ] || [ ${#label} -gt 63 ] && return 1
case "$label" in
-*|_*|*-|*_) return 1;;
*[![:alnum:]_-]*) return 1;;
@ -231,16 +231,16 @@ detect_init()
# systems we try to detect them first.
status="@STATUSARG@"
: ${status:=status}
if [ -x /bin/systemctl -a -S /run/systemd/private ]; then
if [ -x /bin/systemctl ] && [ -S /run/systemd/private ]; then
_service_exists="/bin/systemctl --quiet is-enabled \$1.service"
_service_status="/bin/systemctl --quiet is-active \$1.service"
_service_cmd="/bin/systemctl \$2 \$1.service"
elif [ -x /usr/bin/systemctl -a -S /run/systemd/private ]; then
elif [ -x /usr/bin/systemctl ] && [ -S /run/systemd/private ]; then
_service_exists="/usr/bin/systemctl --quiet is-enabled \$1.service"
_service_status="/usr/bin/systemctl --quiet is-active \$1.service"
_service_cmd="/usr/bin/systemctl \$2 \$1.service"
elif [ -x /sbin/rc-service -a \
-s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ]
elif [ -x /sbin/rc-service ] && [ -s /libexec/rc/init.d/softlevel ] ||
[ -s /run/openrc/softlevel ]
then
_service_exists="/sbin/rc-service -e \$1"
_service_cmd="/sbin/rc-service \$1 -- -D \$2"
@ -259,7 +259,7 @@ detect_init()
elif [ -x /usr/bin/sv ]; then
_service_exists="/usr/bin/sv status \$1 >/dev/null 2>&1"
_service_cmd="/usr/bin/sv \$2 \$1"
elif [ -e /etc/slackware-version -a -d /etc/rc.d ]; then
elif [ -e /etc/slackware-version ] && [ -d /etc/rc.d ]; then
_service_exists="[ -x /etc/rc.d/rc.\$1 ]"
_service_cmd="/etc/rc.d/rc.\$1 \$2"
_service_status="/etc/rc.d/rc.\$1 status >/dev/null 2>&1"
@ -274,7 +274,7 @@ detect_init()
done
if [ -e /etc/arch-release ]; then
_service_status="[ -e /var/run/daemons/\$1 ]"
elif [ "$x" = "/etc/rc.d" -a -e /etc/rc.d/rc.subr ]; then
elif [ "$x" = "/etc/rc.d" ] && [ -e /etc/rc.d/rc.subr ]; then
_service_status="$x/\$1 check >/dev/null 2>&1"
fi
fi