Fix: Skip sigul installation on Ubuntu
[releng/global-jjb.git] / shell / sigul-install.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> sigul-install.sh"
12
13 # Ensure we fail the job if any steps fail.
14 set -e -o pipefail
15
16 OS=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
17 if ! [[ "${OS}" =~ ^(fedora|centos|redhat) ]]; then
18     echo "INFO: Skip step, sigul install not available on platform ${OS}"
19     exit 0
20 fi
21
22 if command -v sigul &>/dev/null; then
23     echo "Sigul already installed; skipping installation."
24 else
25     # Setup sigul RPM repo
26     echo "[fedora-infra-sigul]
27 name=Fedora builder packages for sigul
28 baseurl=https://kojipkgs.fedoraproject.org/repos-dist/epel\$releasever-infra/latest/\$basearch/
29 enabled=1
30 gpgcheck=1
31 gpgkey=https://infrastructure.fedoraproject.org/repo/infra/RPM-GPG-KEY-INFRA-TAGS
32 includepkgs=sigul*
33 skip_if_unavailable=True" > fedora-infra-sigul.repo
34
35     sudo cp fedora-infra-sigul.repo /etc/yum.repos.d
36     rm fedora-infra-sigul.repo
37
38     # install sigul
39     sudo yum install -y -q sigul
40 fi;