-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_with_docker.sh
57 lines (49 loc) · 1.94 KB
/
test_with_docker.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
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
# Undupes: Find duplicate files.
# Copyright (C) 2024 Mmanu Chaturvedi <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# SPDX-License-Identifier: AGPL-3.0
# SPDX-FileCopyrightText: 2024 Mmanu Chaturvedi <[email protected]>
set -euo pipefail
function cleanup() {
declare -r ret=$?
if [[ $ret -ne 0 ]]; then
exit $ret
fi
}
trap cleanup EXIT
export BUILD_DIR="${BUILD_DIR:-${PWD}/build_docker}"
export UNDUPES_VERSION=1.0.0
declare -a IMAGE_LIST=(
ubuntu:24.04
ubuntu:22.04
ubuntu:20.04
debian:bookworm
debian:bullseye
)
for image in ${IMAGE_LIST[@]}; do
undupes_image=${image}_undupes
if [[ $(docker images -q ${undupes_image} | wc -l) -ne 1 ]]; then
docker build --tag ${undupes_image} --build-arg="IMAGE_NAME=${image}" .
fi
docker run --rm --env BUILD_DIR -v $PWD:/undupes -it ${undupes_image} \
bash -c 'rm -rf ${BUILD_DIR}; bash -x install.sh;'
# Installing twice on purspose to check overwriting.
docker run --rm --env UNDUPES_VERSION -v $PWD:/undupes -it ${undupes_image} \
bash -c 'wget https://raw.githubusercontent.com/m-chaturvedi/undupes/master/install_deb -O - | bash && \
wget https://raw.githubusercontent.com/m-chaturvedi/undupes/master/install_deb -O - | bash && \
diff <(undupes) /undupes/tests/io/undupes_help.out'
done
echo "All tests passed. All packages built."