Export status without colors
This commit is contained in:
parent
66bdae2365
commit
9c7731e5aa
|
@ -7,6 +7,8 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
|
|||
|
||||
### Changed
|
||||
|
||||
* Export status without colors
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
|
14
minifirewall
14
minifirewall
|
@ -147,6 +147,9 @@ fi
|
|||
# }
|
||||
## Beware that commands executed from included files are not modified by this trick.
|
||||
|
||||
remove_colors() {
|
||||
sed -r 's/\x1B\[(;?[0-9]{1,3})+[mGK]//g'
|
||||
}
|
||||
syslog_info() {
|
||||
if [ -x "${LOGGER_BIN}" ]; then
|
||||
${LOGGER_BIN} -t "${NAME}" -p daemon.info "$1"
|
||||
|
@ -268,9 +271,9 @@ check_unpersisted_state() {
|
|||
elif [ -z "${diff_bin}" ]; then
|
||||
printf "${YELLOW}skip state comparison (Can't find diff command)${RESET}\n" >&2
|
||||
else
|
||||
# store current state
|
||||
# store current state (without colors)
|
||||
mkdir -p "$(dirname "${STATE_FILE_CURRENT}")"
|
||||
status_without_numbers > "${STATE_FILE_CURRENT}"
|
||||
status_without_numbers | remove_colors > "${STATE_FILE_CURRENT}"
|
||||
|
||||
# clean previous diff file
|
||||
rm -f "${STATE_FILE_DIFF}"
|
||||
|
@ -310,9 +313,9 @@ report_state_changes() {
|
|||
check_unpersisted_state
|
||||
fi
|
||||
|
||||
# Then reset the known state
|
||||
# Then reset the known state (without colors)
|
||||
mkdir -p "$(dirname "${STATE_FILE_LATEST}")"
|
||||
status_without_numbers > "${STATE_FILE_LATEST}"
|
||||
status_without_numbers | remove_colors > "${STATE_FILE_LATEST}"
|
||||
|
||||
# But if there is a previous known state
|
||||
# let's compare with the new known state
|
||||
|
@ -920,8 +923,9 @@ stop() {
|
|||
|
||||
printf "${BLUE}flushing all rules and accepting everything${RESET}\n"
|
||||
|
||||
# Save previous state (without colors)
|
||||
mkdir -p "$(dirname "${STATE_FILE_PREVIOUS}")"
|
||||
status_without_numbers > "${STATE_FILE_PREVIOUS}"
|
||||
status_without_numbers | remove_colors > "${STATE_FILE_PREVIOUS}"
|
||||
|
||||
# Delete all rules
|
||||
${IPT} -F INPUT
|
||||
|
|
Loading…
Reference in a new issue