Mercurial > hg > orthanc-gcp
annotate Resources/debian-internal.sh @ 46:a45844994a67
distinguishing docker-based builds between buster and bullseye
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 19 Aug 2021 10:36:34 +0200 |
parents | Resources/debian-stable-internal.sh@eb09eb1251b9 |
children |
rev | line source |
---|---|
10
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 #!/bin/bash |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 set -ex |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 BUILD_TYPE=$1 |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 USER_ID=$2 |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 GROUP_ID=$3 |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 # Create the same user and group than the one who is running the |
46
a45844994a67
distinguishing docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
34
diff
changeset
|
10 # "./debian-{distro}-compile.sh" script on the hosting system (*) |
10
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 groupadd -g ${GROUP_ID} -r orthanc |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 useradd -u ${USER_ID} -r -g orthanc orthanc |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 # Static build using the root user |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 apt-get update |
34 | 16 apt-get install -y cmake build-essential unzip mercurial |
10
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 mkdir /tmp/build |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 cd /tmp/build |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 cp -r /source /tmp/source-writeable |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 cmake /tmp/source-writeable \ |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 -DSTATIC_BUILD=ON \ |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 -DCMAKE_INSTALL_PREFIX=/target |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 make -j`nproc` |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 # Copy the installation to the host filesystem, using the |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 # newly-created user "orthanc" (*) that corresponds to the user who is |
46
a45844994a67
distinguishing docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
34
diff
changeset
|
31 # running "./debian-{distro}-compile.sh" script. This allows to avoid |
10
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 # files owned by the "root" user on the host filesystem. |
340f02ddaabf
build script for Debian stable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 su -c "cp /tmp/build/libOrthancGoogleCloudPlatform.so /target" orthanc |