#!/bin/bash XDSSERVER="xds-server" PACKAGE_NAME="agl-${XDSSERVER}" #test if sudoers with NOPASSWD sudo -l | grep NOPASSWD &> /dev/null if [ ! $? -eq 0 ]; then exit 1 fi function getUpdateDebian() { local policy="/tmp/policy" sudo apt-get update &> /dev/null apt-cache policy ${PACKAGE_NAME} > ${policy} cat $policy | grep "Installed" cat $policy | grep "Candidate" rm -f $policy } if [ -f /etc/os-release ]; then source /etc/os-release fi case $ID in "debian") getUpdateDebian;; *) exit 1;; esac