Add mass-delta-builder
[platform/core/system/upgrade-tools.git] / mass-delta-builder / mass-builder-run.sh
1 #!/bin/sh
2
3 if [ $# -le 2 ]; then
4         echo "Arguments missing"
5         echo "    $0 <cfg_dir> <images_dir> <deltas_dir> [last_delta]"
6         echo ""
7         echo "example:"
8         echo "    $0 ./cfg ./images ./deltas 20221110.0"
9         exit 1
10 fi
11
12 CFG_DIR=$(realpath "$1")
13 IMAGES_DIR=$(realpath "$2")
14 DELTAS_DIR=$(realpath "$3")
15 LAST_DELTA=$4
16
17 if [ ! -d "$CFG_DIR" ]; then
18         echo "The given cfg_dir is not a directory"
19         exit 1
20 fi
21
22 if [ ! -d "$IMAGES_DIR" ]; then
23         echo "The given images_dir is not a directory"
24         exit 1
25 fi
26
27 if [ ! -d "$DELTAS_DIR" ]; then
28         echo "The given deltas_dir is not a directory"
29         exit 1
30 fi
31
32 exec docker run --privileged=true --rm \
33                 --name delta_builder \
34                 --mount=type=bind,source="$IMAGES_DIR",destination=/images \
35                 --mount=type=bind,source="$DELTAS_DIR",destination=/result \
36                 --mount=type=bind,source="$CFG_DIR",destination=/app/cfg \
37                 delta_builder ./pre_run.sh $LAST_DELTA