This repository has been archived by the owner on Feb 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
build
executable file
·43 lines (36 loc) · 1.67 KB
/
build
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
#!/bin/bash -ex
ORGA=archimg
TAR_DATE=${TAR_DATE:-$(date +'%Y.%m.01')}
ARCHLINUX_ARCH=x86_64
ARCHLINUX_MIRR=https://archive.archlinux.org/iso
[ $UID -ne 0 ] && echo "This script should get executed as root. Otherwise file special permissions are not set correctly." >&2
mkdir -p Dockerfiles/basement/arch-rootfs
mkdir -p tarballs/${TAR_DATE}
# Download tarball, signature and sha1sums.txt
# Verify sha1sum for tarball
(
cd tarballs/${TAR_DATE} \
&& wget -q --no-cookies \
${ARCHLINUX_MIRR}/${TAR_DATE}/archlinux-bootstrap-${TAR_DATE}-${ARCHLINUX_ARCH}.tar.gz{,.sig} \
${ARCHLINUX_MIRR}/${TAR_DATE}/sha1sums.txt \
&& grep archlinux-bootstrap-${TAR_DATE}-${ARCHLINUX_ARCH}.tar.gz sha1sums.txt \
| sha1sum --check -
)
# Verify the data by its gpg-signature
# https://wiki.archlinux.org/index.php/Category:Getting_and_installing_Arch
gpg --keyserver-options auto-key-retrieve \
--verify tarballs/${TAR_DATE}/archlinux-bootstrap-${TAR_DATE}-${ARCHLINUX_ARCH}.tar.gz.sig
tar xz \
-f tarballs/${TAR_DATE}/archlinux-bootstrap-${TAR_DATE}-${ARCHLINUX_ARCH}.tar.gz \
--strip-components=1 \
--directory=./Dockerfiles/basement/arch-rootfs \
root.${ARCHLINUX_ARCH}/
for repo in base::squash base:full:squash base-devel::nosquash; do
IFS=: read repo tag opt <<< $repo
docker build -f ./Dockerfiles/basement/Dockerfile.${repo}${tag:+_$tag} -t ${ORGA}/${repo}:${tag:+$tag-}${TAR_DATE} ./Dockerfiles/basement
if [ "${opt}" == "squash" ]; then
docker-squash ${ORGA}/${repo}:${tag:+$tag-}${TAR_DATE}
fi
# alias the image with name currenttar instead of actual date to get referenced by static dockerfiles
docker tag ${ORGA}/${repo}:${tag:+$tag-}${TAR_DATE} ${ORGA}/${repo}:${tag:+$tag-}currenttar
done