Skip to content

Commit e49f050

Browse files
author
Mathieu Mitchell
committed
[TinyIPA] Avoid running rm with no parameters
Currently, during ramdisk optimization steps, the find tool is used to look for files to remove. We pipe all files found by find to the rm command running as sudo. This is necessary because of the ownership of the files to be removed. This commit uses the "--no-run-if-empty" GNU extension to xargs. This extension should be present on all machines running the TinyIPA build, because non-GNU systems simply cannot build TinyIPA. An alternative would have been to use the -delete flag to find, and to run find as root. Change-Id: I78854c8901433b7d45e014dd18e7a5ff794a9c45 Closes-bug: #1661219
1 parent 5b1a217 commit e49f050

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎imagebuild/tinyipa/finalise-tinyipa.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,14 @@ if $PYOPTIMIZE_TINYIPA; then
158158
set +e
159159
$CHROOT_CMD /bin/bash -c "python -OO -m compileall /usr/local/lib/python2.7"
160160
set -e
161-
find $FINALDIR/usr/local/lib/python2.7 -name "*.py" -not -path "*ironic_python_agent/api/config.py" | sudo xargs rm
162-
find $FINALDIR/usr/local/lib/python2.7 -name "*.pyc" | sudo xargs rm
161+
find $FINALDIR/usr/local/lib/python2.7 -name "*.py" -not -path "*ironic_python_agent/api/config.py" | sudo xargs --no-run-if-empty rm
162+
find $FINALDIR/usr/local/lib/python2.7 -name "*.pyc" | sudo xargs --no-run-if-empty rm
163163
else
164164
sudo sed -i "s/PYTHONOPTIMIZE=1/PYTHONOPTIMIZE=0/" "$FINALDIR/opt/bootlocal.sh"
165165
fi
166166

167167
# Delete unnecessary Babel .dat files
168-
find $FINALDIR -path "*babel/locale-data/*.dat" -not -path "*en_US*" | sudo xargs rm
168+
find $FINALDIR -path "*babel/locale-data/*.dat" -not -path "*en_US*" | sudo xargs --no-run-if-empty rm
169169

170170
# Allow an extension to be added to the generated files by specifying
171171
# $BRANCH_PATH e.g. export BRANCH_PATH=master results in tinyipa-master.gz etc

0 commit comments

Comments
 (0)