File: __install

package info (click to toggle)
mongo-c-driver 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 47,088 kB
  • sloc: ansic: 193,670; python: 7,780; cpp: 1,493; sh: 659; makefile: 78
file content (48 lines) | stat: -rwxr-xr-x 1,988 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env sh

# Install the named packages using the platform's package manager.
# This script "just does the right thing" to install a package as a step in a
#   caching container build, as a bare "pkg-tool install" might be insufficient
#   or subtly broken, and we only really care about installing a list of packages
#
# Usage: <script> [pkgs...]

set -eu

if test -f /etc/debian_version ; then
    # We *must* do a repo update as part of the install step in a single cache
    # layer, as a cached apt-get update can become stale while a later
    # apt-get install is invalidated
    apt-get -y update
    # DEBIAN_FRONTEND suppresses all interactivity. For some reason some
    # packages like to prompt as part of their config, even if we're not on
    # a TTY.
    test $# = 0 || env DEBIAN_FRONTEND=noninteractive \
        apt-get -y install -- "$@"
elif test -f /etc/redhat-release || grep 'ID="amzn"' /etc/os-release >/dev/null 1>&2; then
    if test -f /usr/bin/dnf; then
        # 'dnf' will "do the right thing"
        test $# = 0 || dnf install -y -- "$@"
    elif test -f /usr/bin/yum; then
        test $# = 0 || yum install -y -- "$@"
        # 'yum' happily ignores missing packages. Use 'rpm -q' to check that
        # everything we requested actually got installed.
        test $# = 0 || if ! rpm -q -- "$@"; then
            echo "$0: Failing because one or more packages requested are not available"
            exit 1
        fi
    else
        echo "No package manager here?" 1>&2
        exit 1
    fi
elif test -f /etc/SuSE-brand \
     || (test -f /etc/os-release && grep "opensuse" /etc/os-release); then
    test $# = 0 || zypper --non-interactive install "$@"
elif test -f /etc/arch-release; then
    test $# = 0 || pacman --sync --refresh --sysupgrade --quiet --noconfirm -- "$@"
elif test -f /etc/alpine-release; then
    test $# = 0 || apk add -- "$@"
else
    echo "$0: We don't know how to manage packages on this system" 1>&2
    exit 1
fi