diff --git a/Makefile.am b/Makefile.am index a04e4531..69b66787 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,11 +31,13 @@ UBUNTU_FLAVOURS = \ xUbuntu_22.04 \ xUbuntu_22.10 \ xUbuntu_23.04 \ - xUbuntu_23.10 + xUbuntu_23.10 \ + xUbuntu_24.04 RASPBIAN_FLAVOURS = \ Raspbian_10 \ - Raspbian_11 + Raspbian_11 \ + Raspbian_12 show-debian: @echo "Debian flavors: $(DEBIAN_FLAVOURS)" diff --git a/data/cleanup.timer b/data/cleanup.timer index 40e7dd70..9c639a33 100644 --- a/data/cleanup.timer +++ b/data/cleanup.timer @@ -5,7 +5,7 @@ Documentation=man:snapper(8) man:snapper-configs(5) [Timer] OnBootSec=10m -OnUnitActiveSec=1d +OnUnitActiveSec=1h [Install] WantedBy=timers.target diff --git a/dists/debian/rules b/dists/debian/rules index a58f42ea..a3681060 100644 --- a/dists/debian/rules +++ b/dists/debian/rules @@ -23,4 +23,3 @@ override_dh_auto_install: dh_auto_install install -D -m 644 data/sysconfig.snapper $$(pwd)/debian/tmp/etc/sysconfig/snapper mv $$(pwd)/debian/tmp/etc/cron.hourly/suse.de-snapper $$(pwd)/debian/tmp/etc/cron.hourly/snapper - mv $$(pwd)/debian/tmp/etc/cron.daily/suse.de-snapper $$(pwd)/debian/tmp/etc/cron.daily/snapper diff --git a/dists/debian/snapper.install b/dists/debian/snapper.install index 77bb37e8..a1d733db 100644 --- a/dists/debian/snapper.install +++ b/dists/debian/snapper.install @@ -1,4 +1,3 @@ -etc/cron.daily/snapper etc/cron.hourly/snapper etc/logrotate.d/snapper usr/bin/snapper diff --git a/dists/debian/snapper.preinst b/dists/debian/snapper.preinst index 758f4c33..75f6768e 100644 --- a/dists/debian/snapper.preinst +++ b/dists/debian/snapper.preinst @@ -18,12 +18,6 @@ version=$2 # will not need this. if [ "$action" = upgrade ]; then - # move /etc/cron.daily/snapper/suse.de-snapper to the correct location - if [ -e /etc/cron.daily/snapper/suse.de-snapper ]; then - mv /etc/cron.daily/snapper/suse.de-snapper /etc/cron.daily/snapper.cron - rm -rf /etc/cron.daily/snapper - mv /etc/cron.daily/snapper.cron /etc/cron.daily/snapper - fi # move /etc/cron.hourly/snapper/suse.de-snapper to the correct location if [ -e /etc/cron.hourly/snapper/suse.de-snapper ]; then mv /etc/cron.hourly/snapper/suse.de-snapper /etc/cron.hourly/snapper.cron diff --git a/doc/snapper.xml.in b/doc/snapper.xml.in index b8495404..282c4292 100644 --- a/doc/snapper.xml.in +++ b/doc/snapper.xml.in @@ -111,7 +111,7 @@ Cleanup Algorithms Snapper provides several algorithms to clean up old snapshots. The - algorithms are executed in a daily cronjob or systemd timer. This can be configured in the + algorithms are executed in an hourly cronjob or systemd timer. This can be configured in the corresponding configurations files along with parameters for every algorithm. diff --git a/package/snapper.changes b/package/snapper.changes index b967ee17..7ab3faf9 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Apr 17 15:00:13 CEST 2024 - aschnell@suse.com + +- run cleanup service every hour (gh#openSUSE/snapper#885) + ------------------------------------------------------------------- Tue Apr 16 17:59:58 CEST 2024 - aschnell@suse.com diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 0839c706..1f8176c2 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -14,10 +14,9 @@ pam_snapper_SCRIPTS = \ endif -EXTRA_DIST = snapper-hourly snapper-daily bash-completion.bash zsh-completion.zsh $(pam_snapper_SCRIPTS) +EXTRA_DIST = snapper-hourly bash-completion.bash zsh-completion.zsh $(pam_snapper_SCRIPTS) install-data-local: install -D snapper-hourly $(DESTDIR)/etc/cron.hourly/suse.de-snapper - install -D snapper-daily $(DESTDIR)/etc/cron.daily/suse.de-snapper install -D --mode a+r,u+w bash-completion.bash $(DESTDIR)/usr/share/bash-completion/completions/snapper install -D --mode a+r,u+w zsh-completion.zsh $(DESTDIR)/usr/share/zsh/site-functions/_snapper diff --git a/scripts/snapper-daily b/scripts/snapper-daily deleted file mode 100755 index 27e7a10b..00000000 --- a/scripts/snapper-daily +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# -# paranoia settings -# -umask 022 -PATH=/sbin:/bin:/usr/sbin:/usr/bin -export PATH - - -# -# get information from /etc/sysconfig/snapper -# -if [ -f /etc/sysconfig/snapper ] ; then - . /etc/sysconfig/snapper -fi - - -# -# run snapper for all configs -# -for CONFIG in $SNAPPER_CONFIGS ; do - - NUMBER_CLEANUP="no" - TIMELINE_CLEANUP="no" - EMPTY_PRE_POST_CLEANUP="no" - - . /etc/snapper/configs/$CONFIG - - if [ "$NUMBER_CLEANUP" = "yes" ] ; then - snapper --config=$CONFIG --quiet cleanup number - fi - - if [ "$TIMELINE_CLEANUP" = "yes" ] ; then - snapper --config=$CONFIG --quiet cleanup timeline - fi - - if [ "$EMPTY_PRE_POST_CLEANUP" = "yes" ] ; then - snapper --config=$CONFIG --quiet cleanup empty-pre-post - fi - -done - -exit 0 diff --git a/scripts/snapper-hourly b/scripts/snapper-hourly index bc6cd4dd..36a41f57 100755 --- a/scripts/snapper-hourly +++ b/scripts/snapper-hourly @@ -17,7 +17,7 @@ fi # -# run snapper for all configs +# run snapper timeline for all configs # for CONFIG in $SNAPPER_CONFIGS ; do @@ -31,4 +31,29 @@ for CONFIG in $SNAPPER_CONFIGS ; do done +# +# run snapper cleanup for all configs +# +for CONFIG in $SNAPPER_CONFIGS ; do + + NUMBER_CLEANUP="no" + TIMELINE_CLEANUP="no" + EMPTY_PRE_POST_CLEANUP="no" + + . /etc/snapper/configs/$CONFIG + + if [ "$NUMBER_CLEANUP" = "yes" ] ; then + snapper --config=$CONFIG --quiet cleanup number + fi + + if [ "$TIMELINE_CLEANUP" = "yes" ] ; then + snapper --config=$CONFIG --quiet cleanup timeline + fi + + if [ "$EMPTY_PRE_POST_CLEANUP" = "yes" ] ; then + snapper --config=$CONFIG --quiet cleanup empty-pre-post + fi + +done + exit 0 diff --git a/snapper.spec.in b/snapper.spec.in index 7a787ede..ca1f502f 100644 --- a/snapper.spec.in +++ b/snapper.spec.in @@ -150,7 +150,6 @@ make %{?_smp_mflags} %make_install rm -f "%{buildroot}/%{_libdir}"/*.la "%{buildroot}/%{pam_security_dir}/pam_snapper.la" rm -f %{buildroot}/etc/cron.hourly/suse.de-snapper -rm -f %{buildroot}/etc/cron.daily/suse.de-snapper %if 0%{?suse_version} install -D -m 644 data/sysconfig.snapper "%{buildroot}%{_fillupdir}/sysconfig.snapper" @@ -186,10 +185,6 @@ if [ -f /etc/cron.hourly/suse.de-snapper ]; then systemctl preset snapper-timeline.timer || : systemctl is-enabled -q snapper-timeline.timer && systemctl start snapper-timeline.timer || : fi -if [ -f /etc/cron.daily/suse.de-snapper ]; then - systemctl preset snapper-cleanup.timer || : - systemctl is-enabled -q snapper-cleanup.timer && systemctl start snapper-cleanup.timer || : -fi %service_add_post snapper-boot.service snapper-boot.timer snapper-cleanup.service snapper-cleanup.timer snapper-timeline.service snapper-timeline.timer snapperd.service %endif