[Build][Bug] Fix apt-get remove version not lock issue (#12193) (#12352)

Why I did it
Fix apt-get remove/purge version not locked issue when the apt-get options not specified.

How I did it
Add a space character before and after the command line parameters.

Co-authored-by: xumia <59720581+xumia@users.noreply.github.com>
This commit is contained in:
mssonicbld 2022-10-13 10:09:19 +08:00 committed by GitHub
parent 66fa1920bb
commit 63ed7b75cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,7 @@ if [ "$INSTALL" == y ]; then
[ "$lock_result" == y ] && release_apt_installation_lock
exit $command_result
else
if [[ "$1" == "purge" || "$@" == *" purge "* || "$@" == *" remove "* ]]; then
if [[ " $@ " == *" purge "* || " $@ " == *" remove "* ]]; then
# When running the purge command, collect the debian versions
dpkg-query -W -f '${Package}==${Version}\n' >> $POST_VERSION_PATH/purge-versions-deb
chmod a+wr $POST_VERSION_PATH/purge-versions-deb