RSS
 

apt-(un)hold

Copy the below code and paste it into /usr/local/bin/apt-hold and then symlink /usr/local/bin/apt-hold to /usr/local/bin/apt-unhold for the finish.

#!/bin/bash
[ "${EUID}" == "0" ] || exit 0

BASENAME=$(basename $0)
case "$1" in
    ""|"-h"|"--help")
        echo "usage: ${BASENAME} <packagename> ..."
        exit;;
esac
while [ ! -z "$1" ]
do
    case "${BASENAME}" in
        apt-hold)
            echo -n "Holding $1 "
            echo "$1 hold" | dpkg --set-selections
            echo "done";;
        apt-unhold)
            echo -n "Unholding $1 "
            echo "$1 install" | dpkg --set-selections
            echo "done";;
        *)
            exit;;
    esac
    shift
done

Share

Leave a Reply