Gracefully handle an unsupported distro.
PATCH 1/1 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 <[email protected]>
--- lib/common-functions.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)
lib/common-functions.sh +11 -0
@@ -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 $*
Signature · 1 line
2.4.6
Quoted 4 lines · Doug Goldstein
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 <[email protected]>
Thanks for the patch!
Reviewed-by Stefano Stabellini <[email protected]>
Quoted 32 lines
lib/common-functions.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)lib/common-functions.sh +11
-0@@ -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 $*