]> granicus.if.org Git - sysstat/commitdiff
Makefile: Remove all reports and data files if requested
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 20 Jun 2020 08:36:26 +0000 (10:36 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 20 Jun 2020 08:41:45 +0000 (10:41 +0200)
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>
Makefile.in

index 4fdbf2b42218166b69a22529d2e53ce686b1570b..4741ae4b3cbcdacba416e68d913e54db996fbc3d 100644 (file)
@@ -422,9 +422,8 @@ install_base: all sa1 sa2 sysstat.sysconfig install_man install_nls
        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)