2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[#1574] ${var+x}, ${var-x} changes

This commit is contained in:
Andrei Pavel
2020-12-11 16:23:27 +02:00
parent 9d11a99101
commit e2f4e55cd5
3 changed files with 16 additions and 12 deletions

View File

@@ -709,7 +709,7 @@ fi
shift
# Ok, let's process parameters (if there are any)
while [ -n "${1+x}" ]
while test "${#}" -gt 0
do
option=${1}
case ${option} in

View File

@@ -192,6 +192,7 @@ test_finish() {
else
# Dump log file for debugging purposes if specified and exists.
# Otherwise the code below would simply call cat.
# Use ${var+x} to test if ${var} is defined.
if test -n "${LOG_FILE+x}" && test -s "${LOG_FILE}"; then
printf 'Log file dump:\n'
cat "${LOG_FILE}"
@@ -348,7 +349,8 @@ set_logger() {
# PID file path is by default <kea-install-dir>/var/run/kea, but can be
# overridden by the environmental variable.
PID_FILE_PATH="@runstatedir@/@PACKAGE@/"
if [ -n "${KEA_PIDFILE_DIR+x}" ]; then
# Use ${var+x} to test if ${var} is defined.
if test -n "${KEA_PIDFILE_DIR+x}" && test -n "${KEA_PIDFILE_DIR}"; then
PID_FILE_PATH="${KEA_PIDFILE_DIR}"
fi
@@ -470,6 +472,7 @@ get_log_messages() {
fi
_GET_LOG_MESSAGES=0
# If log file is not present, the number of occurrences is 0.
# Use ${var+x} to test if ${var} is defined.
if test -n "${LOG_FILE+x}" && test -s "${LOG_FILE}"; then
# Grep log file for the logger message occurrences and remove
# whitespaces, if any.
@@ -536,35 +539,36 @@ cleanup() {
kill_processes_by_name "kea-lfc"
# Remove temporary files.
if test -n "${LOG_FILE+x}"; then
# Use ${var+x} to test if ${var} is defined.
if test -n "${LOG_FILE+x}" && test -n "${LOG_FILE}"; then
rm -rf "${LOG_FILE}"
rm -rf "${LOG_FILE}.lock"
fi
# Use asterisk to remove all files starting with the given name,
# in case the LFC has been run. LFC creates files with postfixes
# appended to the lease file name.
if test -n "${LEASE_FILE+x}"; then
if test -n "${LEASE_FILE+x}" && test -n "${LEASE_FILE}"; then
rm -rf "${LEASE_FILE}"*
fi
if test -n "${CFG_FILE+x}"; then
if test -n "${CFG_FILE+x}" && test -n "${CFG_FILE}"; then
rm -rf "${CFG_FILE}"
fi
if test -n "${DHCP4_CFG_FILE+x}"; then
if test -n "${DHCP4_CFG_FILE+x}" && test -n "${DHCP4_CFG_FILE}"; then
rm -rf "${DHCP4_CFG_FILE}"
fi
if test -n "${DHCP6_CFG_FILE+x}"; then
if test -n "${DHCP6_CFG_FILE+x}" && test -n "${DHCP6_CFG_FILE}"; then
rm -rf "${DHCP6_CFG_FILE}"
fi
if test -n "${D2_CFG_FILE+x}"; then
if test -n "${D2_CFG_FILE+x}" && test -n "${D2_CFG_FILE}"; then
rm -rf "${D2_CFG_FILE}"
fi
if test -n "${CA_CFG_FILE+x}"; then
if test -n "${CA_CFG_FILE+x}" && test -n "${CA_CFG_FILE}"; then
rm -rf "${CA_CFG_FILE}"
fi
if test -n "${NC_CFG_FILE+x}"; then
if test -n "${NC_CFG_FILE+x}" && test -n "${NC_CFG_FILE}"; then
rm -rf "${NC_CFG_FILE}"
fi
if test -n "${KEACTRL_CFG_FILE+x}"; then
if test -n "${KEACTRL_CFG_FILE+x}" && test -n "${KEACTRL_CFG_FILE}"; then
rm -rf "${KEACTRL_CFG_FILE}"
fi
}

View File

@@ -30,7 +30,7 @@ set -eu
exit_code=
while [ -n "${1+x}" ]
while test "${#}" -gt 0
do
option=${1}
case ${option} in