sw-collector: Iterate through history logs
The logrotate function causes the apt history to be split into several parts at arbitrary points in time. If history.log only is parsed then some package installation changes stored in zipped backup history files might get lost. Thus sw-collector now searches all backup history files until a date older than the current event stored in the collector.db database is found, so that no entries get overlooked.
This commit is contained in:
@@ -21,7 +21,7 @@ INC=$INC,gnat,gprbuild,acpid,acpi-support-base,libldns-dev,libunbound-dev
|
||||
INC=$INC,dnsutils,libsoup2.4-dev,ca-certificates,unzip,libsystemd-dev
|
||||
INC=$INC,python3,python3-setuptools,python3-dev,python3-pip,apt-transport-https
|
||||
INC=$INC,libjson-c-dev,libxslt1-dev,libapache2-mod-wsgi-py3
|
||||
INC=$INC,libxerces-c-dev,libgcrypt20-dev,traceroute,iptables
|
||||
INC=$INC,libxerces-c-dev
|
||||
case "$BASEIMGSUITE" in
|
||||
bullseye)
|
||||
INC=$INC,libiptc-dev
|
||||
@@ -53,6 +53,7 @@ esac
|
||||
SERVICES="apache2 dbus isc-dhcp-server slapd bind9 freeradius"
|
||||
INC=$INC,${SERVICES// /,}
|
||||
# packages to install via APT, for SWIMA tests
|
||||
APT1="libgcrypt20-dev traceroute iptables"
|
||||
APT="tmux"
|
||||
# additional services to disable
|
||||
SERVICES="$SERVICES systemd-timesyncd.service"
|
||||
@@ -136,6 +137,12 @@ log_status $?
|
||||
log_action "Update package sources"
|
||||
execute_chroot "apt-get update"
|
||||
log_action "Install packages via APT"
|
||||
execute_chroot "apt-get -y install $APT1"
|
||||
log_action "Move history.log to history.log.1"
|
||||
execute_chroot "mv /var/log/apt/history.log /var/log/apt/history.log.1"
|
||||
log_action "Compress history.log.1 to history.log.1.gz"
|
||||
execute_chroot "gzip /var/log/apt/history.log.1"
|
||||
log_action "Install more packages via APT"
|
||||
execute_chroot "apt-get -y install $APT"
|
||||
log_action "Install packages from custom repo"
|
||||
execute_chroot "apt-get -y upgrade"
|
||||
|
||||
Reference in New Issue
Block a user