summaryrefslogtreecommitdiff
path: root/ci/gh-install.sh
blob: f39331b140b76eddd1e32a41603a7dc419497a99 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash

# Copyright © 2015-2016 Collabora Ltd.
# Copyright © 2021 Endless OS Foundation LLC
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

set -euo pipefail
set -x

# Get the OS release info
. /etc/os-release

case "$ID" in
    (debian|ubuntu)
        # Make debconf run non-interactively since its questions can't
        # be answered.
        export DEBIAN_FRONTEND=noninteractive

        # Debian upstream data:
        # https://tracker.debian.org/pkg/ostree
        # https://salsa.debian.org/debian/ostree
        # https://salsa.debian.org/debian/ostree/-/blob/debian/master/debian/control
        #
        # Ubuntu package data:
        # https://packages.ubuntu.com/source/impish/ostree
        #
        # Use libfuse3-dev unless otherwise specified
        case " $* " in
            (*\ libfuse-dev\ *)
                ;;

            (*\ libfuse3-dev\ *)
                ;;

            (*)
                set -- "$@" libfuse3-dev
                ;;
        esac

        # TODO: fetch this list from the Debian packaging git repository?

        # First construct a list of Build-Depends common to all
        # versions. This includes build-essential, which is assumed to
        # be installed on all Debian builders. We also add gjs to allow
        # the JS tests to run even though gjs is explicitly disable in
        # Debian.
        PACKAGES=(
            attr
            autoconf
            automake
            bison
            build-essential
            ca-certificates
            cpio
            debhelper
            dh-exec
            docbook-xml
            docbook-xsl
            e2fslibs-dev
            elfutils
            fuse
            gnupg
            gobject-introspection
            gtk-doc-tools
            libarchive-dev
            libattr1-dev
            libavahi-client-dev
            libavahi-glib-dev
            libcap-dev
            libfuse-dev
            libgirepository1.0-dev
            libglib2.0-dev
            libglib2.0-doc
            libgpgme-dev
            liblzma-dev
            libmount-dev
            libselinux1-dev
            libsoup2.4-dev
            libsystemd-dev
            libtool
            libcap2-bin
            procps
            python3
            python3-yaml
            xsltproc
            zlib1g-dev
        )

        # Additional common packages:
        #
        # gjs - To allow running JS tests even though this has been
        # disabled in Debian for a while.
        #
        # gnome-desktop-testing - To eventually allow running the
        # installed tests.
        #
        # libcurl4-openssl-dev - To allow building the cURL fetch
        # backend in addition to the soup fetch backend.
        #
        # systemd - To get the unit and generator paths from systemd.pc
        # rather than passing them as configure options.
        PACKAGES+=(
            gjs
            gnome-desktop-testing
            libcurl4-openssl-dev
            systemd
        )

        # Distro specific packages. Matching is on VERSION_CODENAME from
        # /etc/os-release. Debian testing and unstable may not have this
        # set, so assume an empty or unset value represents those.

        # hexdump was previously provided by bsdmainutils but is now in
        # bsdextrautils.
        case "${VERSION_CODENAME:-}" in
            (buster|focal|bionic)
                PACKAGES+=(bsdmainutils)
                ;;
            (*)
                PACKAGES+=(bsdextrautils)
                ;;
        esac

        apt-get -y update
        apt-get -y install "${PACKAGES[@]}" "$@"
        ;;

    (*)
        echo "Don't know how to set up ${ID}" >&2
        exit 1
        ;;
esac

# vim:set sw=4 sts=4 et: