Skip to content

Commit 224d4b7

Browse files
committed
Adjust hub packaging scripts in cases where no files are found during upgrade
Added --no-run-if-empty option to some find | xargs commands. Ticket: ENT-13214 Changelog: title
1 parent d92bb19 commit 224d4b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packaging/common/cfengine-hub/preinstall.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,13 @@ if [ -d $PREFIX/httpd/htdocs ]; then
397397
# Purge all files in httpd/htdocs with exceptions listed in preserve_during_upgrade.txt
398398
cf_console echo "Keeping only what's listed in preserve_during_upgrade.txt file"
399399
PRESERVE_FILTER="`generate_preserve_filter`"
400-
find "$PREFIX/httpd/htdocs" $PRESERVE_FILTER -type f -print0 | xargs -0 rm
400+
find "$PREFIX/httpd/htdocs" $PRESERVE_FILTER -type f -print0 | xargs --no-run-if-empty -0 rm
401401
elif [ -d $PREFIX/share/GUI ]; then
402402
# Remove only files copied from share/GUI to httpd/htdocs
403403
cf_console echo "Using share/GUI as template"
404404
( cd $PREFIX/share/GUI
405405
# Make list of files in share/GUI and remove "them" from httpd/htdocs
406-
find -type f -print0 | ( cd ../../httpd/htdocs/ && xargs -0 rm -f )
406+
find -type f -print0 | ( cd ../../httpd/htdocs/ && xargs --no-run-if-empty -0 rm -f )
407407
)
408408
else
409409
# Purge all files in httpd/htdocs with hardcoded exceptions:
@@ -413,7 +413,7 @@ if [ -d $PREFIX/httpd/htdocs ]; then
413413
find "$PREFIX/httpd/htdocs" -not \( -path "$PREFIX/httpd/htdocs/public/tmp" -prune \) \
414414
-not \( -name "cf_robot.php" \) \
415415
-not \( -name "settings.ldap.php" \) \
416-
-type f -print0 | xargs -0 -r rm
416+
-type f -print0 | xargs --no-run-if-empty -0 rm
417417
fi
418418
if [ -d $PREFIX/share/GUI -a "x${PKG_TYPE}" = "xrpm" ]; then
419419
# Make sure old files are not copied over together with new files later

0 commit comments

Comments
 (0)