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}"
# 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
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.
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
}