summaryrefslogtreecommitdiffstats
path: root/redhat/build/install_rpm_package.sh
blob: 93e2b5036838c43abc2000bffc82285e567aafd7 (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
#!/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/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