feat: Add apt hold script

This commit is contained in:
Nathan Woodburn 2024-10-14 15:37:56 +11:00
parent 4b46755c22
commit fd41590ca9
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

18
hold.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# Package to hold
PACKAGE=$1
if [ -z "$PACKAGE" ]; then
echo "Usage: hold <package_name>"
echo "Set or unset a package on hold"
exit 1
fi
# Check to see if the package is already on hold using apt-mark showhold
if ! apt-mark showhold | grep -q "$PACKAGE"; then
sudo apt-mark hold $PACKAGE
else
echo "$PACKAGE is already on hold unholding..."
sudo apt-mark unhold $PACKAGE
fi