Skip to content

Commit f567f7e

Browse files
henrywangcgwalters
authored andcommitted
Fix destructive-cleanup failure when no old packages exist
When rpm -qa returns no packages, xargs would still invoke rpm -e with no arguments, causing failure with "no packages given for erase" (exit code 123). Add -r flag to xargs to skip execution when input is empty. Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
1 parent f92bf57 commit f567f7e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

contrib/scripts/fedora-bootc-destructive-cleanup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -xeuo pipefail
55

66
# Remove all RPMs installed in the physical root (i.e. the previous OS)
77
mount -o remount,rw /sysroot
8-
rpm -qa --root=/sysroot --dbpath=/usr/lib/sysimage/rpm | xargs rpm -e --root=/sysroot --dbpath=/usr/lib/sysimage/rpm
8+
rpm -qa --root=/sysroot --dbpath=/usr/lib/sysimage/rpm | xargs -r rpm -e --root=/sysroot --dbpath=/usr/lib/sysimage/rpm
99

1010
# Remove all container images (including the one that was used to install)
1111
# Note that this does not remove stopped containers, and so some storage

0 commit comments

Comments
 (0)