Hello community,
here is the log from the commit of package clone-master-clean-up for
openSUSE:Factory checked in at 2019-10-16 09:18:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/clone-master-clean-up (Old)
and /work/SRC/openSUSE:Factory/.clone-master-clean-up.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "clone-master-clean-up"
Wed Oct 16 09:18:38 2019 rev:2 rq:738667 version:1.5
Changes:
--------
---
/work/SRC/openSUSE:Factory/clone-master-clean-up/clone-master-clean-up.changes
2019-08-08 14:23:33.472347657 +0200
+++
/work/SRC/openSUSE:Factory/.clone-master-clean-up.new.2352/clone-master-clean-up.changes
2019-10-16 09:18:43.166936529 +0200
@@ -1,0 +2,18 @@
+Tue Oct 8 13:24:41 UTC 2019 - [email protected]
+
+- Bump version to 1.5
+- Don't show output from pushd/popd
+- Make snapper snapshot removal more generic
+ The output format is not really meant for machine reading, it's
+ format has changed thus the simple parser broke.
+ This now makes the parser more generic (using data from d-bus),
+ also now it is ensured the snapshots are deleted in the correct
+ order.
+ (bsc#1149322)
+
+-------------------------------------------------------------------
+Tue Aug 27 07:06:00 UTC 2019 - Jan Engelhardt <[email protected]>
+
+- Use noun phrase in descriptions.
+
+-------------------------------------------------------------------
@@ -77 +94,0 @@
-
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ clone-master-clean-up.spec ++++++
--- /var/tmp/diff_new_pack.hlB7VN/_old 2019-10-16 09:18:43.806934880 +0200
+++ /var/tmp/diff_new_pack.hlB7VN/_new 2019-10-16 09:18:43.810934870 +0200
@@ -1,7 +1,7 @@
#
# spec file for package clone-master-clean-up
#
-# Copyright (c) 2017 SUSE LLC
+# Copyright (c) 2017-2019 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,16 +12,17 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
+
Name: clone-master-clean-up
-Version: 1.4
+Version: 1.5
Release: 0
-License: GPL-2.0+
-Summary: Clean up a system for cloning preparation
-Url: https://www.suse.com
+Summary: Tool to clean up a system for cloning preparation
+License: GPL-2.0-or-later
Group: System/Management
+Url: https://www.suse.com
Source0: clone-master-clean-up.sh
Source1: clone-master-clean-up.1
Source2: sysconfig.clone-master-clean-up
@@ -29,7 +30,10 @@
Source10: LICENSE
Source11: README.md
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Requires: systemd sed curl coreutils
+Requires: coreutils
+Requires: curl
+Requires: sed
+Requires: systemd
Requires(post): %fillup_prereq
BuildArch: noarch
@@ -37,9 +41,9 @@
%define _fillupdir /var/adm/fillup-templates
%endif
-
%description
-Clean up a system for cloning preparation by cleaning up usage history and log
files, etc.
+A tool to clean up a system for cloning preparation by cleaning up
+usage history and log files, etc.
%prep
@@ -65,8 +69,8 @@
%fillup_only -n clone-master-clean-up
%files
-%doc %{basename:%{S:11}}
-%license %{basename:%{S:10}}
+%doc README.md
+%license LICENSE
%{_sbindir}/*
%{_mandir}/man1/*
%{_fillupdir}/*
@@ -74,3 +78,5 @@
%dir %{_sysconfdir}/%{name}
%{_datadir}/%{name}/custom_remove.template
%ghost %config %{_sysconfdir}/%{name}/custom_remove
+
+%changelog
++++++ clone-master-clean-up.sh ++++++
--- /var/tmp/diff_new_pack.hlB7VN/_old 2019-10-16 09:18:43.878934694 +0200
+++ /var/tmp/diff_new_pack.hlB7VN/_new 2019-10-16 09:18:43.882934684 +0200
@@ -71,12 +71,12 @@
done
echo 'Clearing systemd journal'
-pushd /etc/systemd
+pushd /etc/systemd > /dev/null
cp journald.conf journald.conf.bak
echo -e '\nSystemMaxUse=1K' >> journald.conf
systemctl restart systemd-journald
mv journald.conf.bak journald.conf
-popd
+popd > /dev/null
echo 'Clearing systemd machine ID file'
truncate -s 0 /etc/machine-id
@@ -108,14 +108,59 @@
echo 'Enabling YaST Firstboot if necessary'
[ -e /etc/YaST2/firstboot.xml ] && touch /var/lib/YaST2/reconfig_system
+
if [ "$CMCU_RSNAP" = "yes" ]; then
+SNAPPER_CMD="snapper delete"
if [ -d /.snapshots ]; then
- echo "Remove all btrfs snapshots from /.snapshot"
- for s in `snapper list | awk '/pre/||/post/{print $3}'`; do
- snapper delete $s
- done
+ echo "Removing all pre/post btrfs snapshots from /.snapshot"
+ snapshots=$(dbus-send --type=method_call --system --print-reply \
+ --dest=org.opensuse.Snapper \
+ /org/opensuse/Snapper \
+ org.opensuse.Snapper.ListSnapshots string:root \
+ 2>/dev/null | awk -- "
+BEGIN {arr=0; cnt=0; u2=0; u4=0; del=0}
+/array \[/ {arr++}
+/struct {/ {if (arr==1) cnt++}
+/}/ {if(arr==1&&--cnt==0){if(del==1) print id \"|\" lst;del=0;u4=0;u2=0}}
+/\]/ {arr--}
+# Don't delete current snapshot
+/string "current"/ {if (arr==1 && cnt==1) del=0}
+# ID: 1st uint32 value of each top struct in top array
+/uint32/ {if (arr==1 && cnt==1) if (++u4==1)id=\$2; else if (u4==2)lst=\$2}
+# Type: 1st uint16 value of each top struct in top array
+/uint16/ {if (arr==1 && cnt==1){if (++u2==1) {if (\$2==1 || \$2==2){del=1}}}}
+")
+
+ # Create chains
+ OFS=$IFS
+ IFS=" "
+ while read line; do
+ [[ $line =~ ([^\|]+)\|(.*) ]]
+ last[${BASH_REMATCH[1]}]=${BASH_REMATCH[2]};
+ [ -z "${next[${BASH_REMATCH[1]}]}" ] && next[${BASH_REMATCH[1]}]=0
+ next[${BASH_REMATCH[2]}]=${BASH_REMATCH[1]}
+ done <<< $snapshots
+ IFS=$OFS
+ # Find end of each chain and work backwards
+ for i in ${!next[@]}; do
+ [ -n "${next[$i]}" ] || continue # unpopulated
+ a=${next[$i]}; unset next[$i]; b=$i
+ while true; do
+ if [ $a -eq 0 ]
+ then
+ while true; do
+ unset next[$b]; $SNAPPER_CMD $b
+ b=${last[$b]}
+ [ $b -eq 0 ] && break 2
+ done
+ else
+ b=$a; a=${next[$a]}; unset next[$b]
+ fi
+ done
+ done
fi
fi
+
if [ "$CMCU_ZYPP_REPOS" = "yes" ]; then
echo "Clean up all zypper repositories"
rm -rf /etc/zypp/repos.d/*