From fd41590ca989b34f756c944ce22f46dcb6a06a4e Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Mon, 14 Oct 2024 15:37:56 +1100 Subject: [PATCH] feat: Add apt hold script --- hold.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 hold.sh diff --git a/hold.sh b/hold.sh new file mode 100755 index 0000000..588699f --- /dev/null +++ b/hold.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Package to hold +PACKAGE=$1 + +if [ -z "$PACKAGE" ]; then + echo "Usage: hold " + 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 \ No newline at end of file