cicerops / autopilot

Just some humble programs to assist in systems maintenance
GNU Affero General Public License v3.0
0 stars 0 forks source link

Comparing software versions on the shell #1

Open amotl opened 2 years ago

amotl commented 2 years ago

Just a note to self.

function checkver {
    pkg_name="$1"
    pkg_vmin="$2"
    pkg_vcur=$(dpkg-query -f='${Version}\n' --show "$pkg_name")
    if $(dpkg --compare-versions "$pkg_vcur" "lt" "$pkg_vmin"); then return 1; fi
}

checkver unattended-upgrades 1.12 || (echo "Too old!" && exit 3)