-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-linux-packages.sh
executable file
·37 lines (28 loc) · 1.16 KB
/
build-linux-packages.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
#!/usr/bin/env bash
echo "unsetting env-variable \$DOCKER_HOST"
unset DOCKER_HOST
# change dir to script directory
cd $(dirname $0)
curdir="$(pwd)"
# --- ubuntu 22.04 hat fehler beim bauen
# for linux in debian:11 debian:12 ubuntu:20.04 ubuntu:22.04 ubuntu:24.04
for linux in debian:11 debian:12 ubuntu:20.04 ubuntu:24.04
do
name="${linux/:/_}"
# get mounted directory (just to display or check if container already exists
# and matches the current directory)
containerMountDir="$(docker inspect ${name} | jq -r '.[0].HostConfig.Binds[0]')"
containerMountDir="${containerMountDir/:*/}"
# check path, if container does not exist -> create container
if [ "$curdir" != "$containerMountDir" ]; then
# check path, if container exist, but mounted dir is different -> re-create
if [ "$containerMountDir" != "null" ]; then
echo "delete old container - mounted directory does not match"
docker container rm ${name}
fi
echo "create new container"
docker create -it --name ${name} -w /mnt/ -v $PWD:/mnt/ ${linux} bash -c "./tools/install-deps.sh; ./tools/build-bmxd-deb.sh $(id -u) $(id -g)"
fi
echo "start container and generate debs"
docker start -i ${name}
done