summaryrefslogtreecommitdiffstats
path: root/redhat/build/install_rpm_package.sh
blob: 7adb128a5ea85081b8fa90aa8b006e208c21b6ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash

LOCKFILE="/tmp/lock.${0##*/}"
while [ -e "${LOCKFILE}" ]; do
  echo "Waiting for lock file '${LOCKFILE}' to vanish."
  sleep 3
done

PKGNAME="${1}"

if [ -x /usr/bin/dnf ]; then
  PKGINST="sudo dnf install -y --refresh --nogpgcheck"
elif [ -x /usr/sbin/urpmi ]; then
  PKGINST='sudo urpmi --auto --no-verify-rpm'
elif [ -x /usr/bin/zypper ]; then
  PKGINST="sudo zypper install -y"
elif [ -x /usr/bin/yum ]; then
  PKGINST='sudo yum install -y'
elif [ -x /usr/bin/apt-get ]; then
  PKGINST='sudo apt-get install -y'
fi

# Gets RPM package name and development package (if any)
RPM_PKGNAME="$(get_rpm_package_name.sh ${PKGNAME} devel)"

# Installing main package
eval ${PKGINST} ${RPM_PKGNAME} || exit 1