From 403da08a56350b84171ad3149363f61d81c4475e Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Tue, 11 Oct 2022 07:59:14 +0800 Subject: [PATCH] [Build][Bug] Fix apt-get remove version not lock issue (#12193) 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. --- src/sonic-build-hooks/hooks/apt-get | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-build-hooks/hooks/apt-get b/src/sonic-build-hooks/hooks/apt-get index 068293a3e3..3f099375c0 100755 --- a/src/sonic-build-hooks/hooks/apt-get +++ b/src/sonic-build-hooks/hooks/apt-get @@ -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