-
Notifications
You must be signed in to change notification settings - Fork 16
/
assemble-system-image.sh
executable file
·48 lines (40 loc) · 1.4 KB
/
assemble-system-image.sh
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 bash
# Copyright (c) 2020 Foundries.io
# SPDX-License-Identifier: BSD-3-Clause
set -o errexit
set -o pipefail
HERE="$(dirname $(readlink -f $0))"
. "$HERE/helpers.sh"
SECRETS=${SECRETS-/secrets}
# if the container is started with `-u $(id -u ${USER}):$(id -g ${USER})` then HOME='/'
if [ "${HOME}" = "/" ]; then
HOME="/root"
fi
TARGETS="${TARGETS}"
TARGET_VERSION="${TARGET_VERSION-${H_BUILD}}"
# destination for a resultant system image
OUT_IMAGE_DIR="${OUT_IMAGE_DIR-/archive}"
APP_SHORTLIST="${APP_SHORTLIST-""}"
COMPOSE_APP_TYPE=${COMPOSE_APP_TYPE-""}
# directory to preload/dump/snapshot apps images to
FETCH_DIR="${FETCH_DIR-$(mktemp -u -d -p /var/cache/apps)}"
require_params FACTORY OUT_IMAGE_DIR
if [ -z "${TARGETS}" ] && [ -z "${TARGET_VERSION}" ]; then
echo "Neither Target name list (TARGETS) nor Target version (aka H_BUILD) are specified !!!"
exit 1
fi
load_extra_certs
if [ -f /secrets/container-registries ] ; then
PYTHONPATH=$HERE $HERE/apps/login_registries /secrets/container-registries
fi
export PYTHONPATH=${HERE}
status Running: Assemble System Image script
/usr/local/bin/dind "${HERE}/assemble.py" \
--factory "${FACTORY}" \
--token "$(cat "${SECRETS}/osftok")" \
--target-version "${TARGET_VERSION}" \
--out-image-dir "${OUT_IMAGE_DIR}" \
--fetch-dir "${FETCH_DIR}" \
--targets "${TARGETS}" \
--app-shortlist="${APP_SHORTLIST}" \
--app-type="${COMPOSE_APP_TYPE}"