diff options
author | Aric Gardner <agardner@linuxfoundation.org> | 2016-07-18 11:53:13 -0400 |
---|---|---|
committer | Aric Gardner <agardner@linuxfoundation.org> | 2016-07-18 12:00:28 -0400 |
commit | d38eb777b696f0458fa1f5fa5e00383e365dde6e (patch) | |
tree | fe5b74544ba7cb869dcc518b332802b6db712857 /utils | |
parent | 0300af7e215c2f945244dcc1ddb2f771a6ac111b (diff) |
Add support for ubuntu (keep support for centos)
Compass signing was failing on ubuntu
Change-Id: Ieda6cfd67c7b36045b0a30c01a0eb3f0e7165710
Signed-off-by: Aric Gardner <agardner@linuxfoundation.org>
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/gpg_import_key.sh | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/utils/gpg_import_key.sh b/utils/gpg_import_key.sh index 80b7c397e..bb11f0d45 100755 --- a/utils/gpg_import_key.sh +++ b/utils/gpg_import_key.sh @@ -7,15 +7,32 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## - function isinstalled { -if rpm -q "$@" >/dev/null 2>&1; then - true - else - echo installing "$1" - sudo yum install "$1" - false + +source /etc/os-release; echo ${ID/*, /} + +if [[ ${ID/*, /} =~ "centos" ]]; then + if rpm -q "$@" >/dev/null 2>&1; then + true + else + echo installing "$1" + sudo yum install "$1" + false + fi + +elif [[ ${ID/*, /} =~ "ubuntu" ]]; then + if dpkg-query -W -f'${Status}' "$@" 2>/dev/null | grep -q "ok installed"; then + true + else + echo installing "$1" + sudo apt-get install -y "$1" + false + fi +else + echo "Distro not supported" + exit 0 fi + } if ! isinstalled gnupg2; then |