From: Doug Goldstein Date: Tue, 18 Aug 2015 23:12:54 +0000 (-0500) Subject: Gracefully handle an unsupported distro. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=90976de1e706f6a068d8ce5fecc6174fe9363d32;p=raisin.git Gracefully handle an unsupported distro. When your distro is not supported, handle the case gracefully and let the user know instead of spitting out bash errors. Signed-off-by: Doug Goldstein Reviewed-by: Stefano Stabellini --- diff --git a/lib/common-functions.sh b/lib/common-functions.sh index efde84c..c52174a 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -176,6 +176,7 @@ function get_distro() { ;; *) DISTRO=$os_VENDOR + PKGTYPE="unknown" ;; esac @@ -220,6 +221,16 @@ function _install-package-rpm() { $SUDO yum install -y $* > /dev/null } +function _check-package-unknown() { + error_echo "I don't know distro $DISTRO. It might be missing packages." + return 1 +} + +function _install-package-unknown() { + error_echo "I don't know distro $DISTRO. Cannot install packages." + return 1 +} + # Modifies inherited variable "missing" function check-package() { for p in $*