ansible-plugin-container-co.../scripts/bindep-install
Kevin Carter f2364022a6 Build skel to separate the OSA connection plugin
This change implements the basic skeleton to create a new repo for the
OSA connection plugin. This change will allow the connection plugin to
be installed standalone, and maintained by a larger community.

This change has pruned the git history so that all of the old history
and commiters record for the connection plugin remains intact.

Signed-off-by: Kevin Carter <kevin@cloudnull.com>
2019-08-08 23:12:40 -05:00

49 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
## Shell Opts ----------------------------------------------------------------
set -o pipefail
set -xeuo
## Vars ----------------------------------------------------------------------
export BINDEP_FILE="${BINDEP_FILE:-$(dirname $(readlink -f ${BASH_SOURCE[0]}))/../bindep.txt}"
## Main ----------------------------------------------------------------------
# Source distribution information
source /etc/os-release || source /usr/lib/os-release
PKG_MGR=$(command -v dnf || command -v yum || command -v apt || command -v zypper)
# NOTE(cloudnull): Get a list of packages to install with bindep. If packages
# need to be installed, bindep exits with an exit code of 1.
BINDEP_PKGS=$(bindep -b -f "${BINDEP_FILE}" test || true)
if [[ ${#BINDEP_PKGS} > 0 ]]; then
case "${ID,,}" in
amzn|rhel|centos|fedora|ubuntu|debian)
sudo "${PKG_MGR}" install -y ${BINDEP_PKGS}
;;
*suse*)
sudo "${PKG_MGR}" -n install ${BINDEP_PKGS}
;;
esac
fi