When option --enable-clean-sa-dir, sysstat used to remove compressed
reports and data files in /var/log/sa directory only when they had
been compressed using gzip.
Update Makefile to look for other compression programs. Also remove
files using the format saYYYYMMDD or sarYYYYMMDD.
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
mkdir -p $(DESTDIR)$(SA_LIB_DIR)
mkdir -p $(DESTDIR)$(SA_DIR)
ifeq ($(CLEAN_SA_DIR),y)
- find $(DESTDIR)$(SA_DIR) \( -name 'sar??' -o -name 'sa??' -o -name 'sar??.gz' -o -name 'sa??.gz' \) \
- -exec rm -f {} \;
- -rmdir --ignore-fail-on-non-empty $(DESTDIR)$(SA_DIR)/[0-9]?????
+ find $(DESTDIR)$(SA_DIR) -type f | egrep "/sar?[0-9]{2,8}(\.(Z|gz|bz2|xz|lz|lzo))?$$" | xargs rm -f
+ find $(DESTDIR)$(SA_DIR) -type f | egrep "/sar?[0-9]{2,8}$$" | xargs rm -f
endif
mkdir -p $(DESTDIR)$(BIN_DIR)
mkdir -p $(DESTDIR)$(DOC_DIR)