project-config/jenkins/scripts/install-distro-packages.sh
Andreas Jaeger b28913b9c4 Silence distro package install a bit
Use apt-get -q to silence package install a bit, -q is intented for
logging purposes. Use -qq for the update part.

Also, redirect error output test for apt-get to dev/null to avoid
on non apt-get systems a:
"line 40: apt-get: command not found"

Change-Id: Ib25256632fb9c5c6a57a71bcb9f76dc70f5af657
2016-03-26 18:52:07 +01:00

53 lines
1.4 KiB
Bash
Executable File

#!/bin/bash -xe
# set a default path to the preinstalled bindep entrypoint
export BINDEP=${BINDEP:-/usr/bindep-env/bin/bindep}
function is_fedora {
[ -f /usr/bin/yum ] && cat /etc/*release | grep -q -e "Fedora"
}
YUM=yum
if is_fedora; then
YUM=dnf
fi
# figure out which bindep list to use
if [ -n "$PACKAGES" ] ; then
# already set in the calling environment
:
elif [ -e other-requirements.txt ] ; then
# project has its own bindep list
export PACKAGES=other-requirements.txt
else
# use the bindep fallback list preinstalled on the worker
export PACKAGES=/usr/local/jenkins/common_data/bindep-fallback.txt
fi
# an install loop, retrying to check that all requested packages are obtained
try=0
until $BINDEP -b -f $PACKAGES ; do
if [ $try -gt 2 ] ; then
set +x
echo -e "\nERROR: These requested packages were not installed:\n" \
"\n`$BINDEP -b -f $PACKAGES`\n" 1>&2
set -x
exit 1
fi
# don't abort inside the loop, we check for the desired outcome
set +e
if apt-get -v >/dev/null 2>&1 ; then
sudo apt-get -qq update
sudo PATH=/usr/sbin:/sbin:$PATH DEBIAN_FRONTEND=noninteractive \
apt-get -q --option "Dpkg::Options::=--force-confold" \
--assume-yes install `$BINDEP -b -f $PACKAGES`
else
sudo PATH=/usr/sbin:/sbin:$PATH $YUM install -y \
`$BINDEP -b -f $PACKAGES`
fi
set -e
try=$(( $try+1 ))
done