]> git.ipfire.org Git - thirdparty/pdns.git/blob - build-scripts/docker/generate-repo-files.sh
984b98b3ea5d1ed49e0e39294be6e1cd3e408ff9
[thirdparty/pdns.git] / build-scripts / docker / generate-repo-files.sh
1 #!/bin/sh
2 #
3 # - `docker build --no-cache --pull --file Dockerfile.auth-41.ubuntu-bionic --tag auth-41.ubuntu-bionic .`
4 # - `docker run -it auth-41.ubuntu-bionic`
5 # - `docker run -it auth-41.ubuntu-bionic /bin/bash`
6 # - `pdns_recursor`
7
8 if [ "$1" = "" -o "$1" = "-?" -o "$1" = "-h" -o "$1" = "--help" ]; then
9 echo "Usage: generate-repo-files.sh RELEASE"
10 echo
11 echo " • RELEASE: [ auth-40 | auth-41 | auth-42 | auth-43 |"
12 echo " rec-40 | rec-41 | rec-42 | rec-43 |"
13 echo " dnsdist-15 ]"
14 exit 1
15 fi
16
17
18 write_centos()
19 {
20 OS=centos
21 VERSION=$1
22 PKG=$2
23 CMD=$3
24
25 cat <<EOF > Dockerfile.$RELEASE.$OS-$VERSION
26 FROM $OS:$VERSION
27
28 RUN yum install -y epel-release bind-utils
29 EOF
30
31 if [ "$VERSION" = "6" -o "$VERSION" = "7" ]; then
32 cat <<EOF >> Dockerfile.$RELEASE.$OS-$VERSION
33 RUN yum install -y yum-plugin-priorities
34 EOF
35 fi
36
37 cat <<EOF >> Dockerfile.$RELEASE.$OS-$VERSION
38 RUN curl -o /etc/yum.repos.d/powerdns-$RELEASE.repo https://repo.powerdns.com/repo-files/$OS-$RELEASE.repo
39 RUN yum install -y $PKG
40 EOF
41
42 if [ "$RELEASE" = "rec-43" ]; then
43 cat <<EOF >> Dockerfile.$RELEASE.$OS-$VERSION
44
45 RUN mkdir /var/run/pdns-recursor
46 EOF
47 fi
48
49 cat <<EOF >> Dockerfile.$RELEASE.$OS-$VERSION
50
51 CMD $CMD --version
52 EOF
53 }
54
55
56 write_debian_or_ubuntu()
57 {
58 OS=$1
59 VERSION=$2
60 PKG=$3
61 CMD=$4
62
63 cat <<EOF > pdns.list.$RELEASE.$OS-$VERSION
64 deb [arch=amd64] http://repo.powerdns.com/$OS $VERSION-$RELEASE main
65 EOF
66
67 # For the following two maybe only create depending on package, but
68 # it's not really a big deal.
69
70 # if not exists
71 cat <<EOF > dnsdist.debian-and-ubuntu
72 Package: dnsdist*
73 Pin: origin repo.powerdns.com
74 Pin-Priority: 600
75 EOF
76
77 # if not exists
78 cat <<EOF > pdns.debian-and-ubuntu
79 Package: pdns-*
80 Pin: origin repo.powerdns.com
81 Pin-Priority: 600
82 EOF
83
84 cat <<EOF > Dockerfile.$RELEASE.$OS-$VERSION
85 FROM $OS:$VERSION
86
87 RUN apt-get update
88 RUN apt-get install -y curl gnupg dnsutils
89
90 COPY dnsdist.debian-and-ubuntu /etc/apt/preferences.d/dnsdist
91 COPY pdns.debian-and-ubuntu /etc/apt/preferences.d/pdns
92 COPY pdns.list.$RELEASE.$OS-$VERSION /etc/apt/sources.list.d/pdns.list
93
94 RUN curl https://repo.powerdns.com/FD380FBB-pub.asc | apt-key add -
95 RUN apt-get update
96 RUN apt-get install -y $PKG
97 EOF
98
99 if [ "$RELEASE" = "rec-43" ]; then
100 cat <<EOF >> Dockerfile.$RELEASE.$OS-$VERSION
101
102 RUN mkdir /var/run/pdns-recursor
103 EOF
104 fi
105
106 cat <<EOF >> Dockerfile.$RELEASE.$OS-$VERSION
107
108 CMD $CMD --version
109 EOF
110 }
111
112
113 write_debian()
114 {
115 write_debian_or_ubuntu debian $1 $2 $3
116 }
117
118
119 write_ubuntu()
120 {
121 write_debian_or_ubuntu ubuntu $1 $2 $3
122 }
123
124
125 RELEASE=$1
126
127 if [ "$RELEASE" = "auth-40" ]; then
128 write_centos 6 pdns pdns_server
129 write_centos 7 pdns pdns_server
130 write_debian jessie pdns-server pdns_server
131 write_debian stretch pdns-server pdns_server
132 write_ubuntu trusty pdns-server pdns_server
133 write_ubuntu xenial pdns-server pdns_server
134 elif [ "$RELEASE" = "auth-41" ]; then
135 write_centos 6 pdns pdns_server
136 write_centos 7 pdns pdns_server
137 write_debian jessie pdns-server pdns_server
138 write_debian stretch pdns-server pdns_server
139 write_ubuntu trusty pdns-server pdns_server
140 write_ubuntu xenial pdns-server pdns_server
141 write_ubuntu bionic pdns-server pdns_server
142 elif [ "$RELEASE" = "auth-42" -o "$RELEASE" = "auth-43" ]; then
143 write_centos 6 pdns pdns_server
144 write_centos 7 pdns pdns_server
145 write_centos 8 pdns pdns_server
146 write_debian stretch pdns-server pdns_server
147 write_debian buster pdns-server pdns_server
148 write_ubuntu xenial pdns-server pdns_server
149 write_ubuntu bionic pdns-server pdns_server
150 elif [ "$RELEASE" = "rec-40" ]; then
151 write_centos 6 pdns-recursor pdns_recursor
152 write_centos 7 pdns-recursor pdns_recursor
153 write_debian jessie pdns-recursor pdns_recursor
154 write_debian stretch pdns-recursor pdns_recursor
155 write_ubuntu trusty pdns-recursor pdns_recursor
156 write_ubuntu xenial pdns-recursor pdns_recursor
157 elif [ "$RELEASE" = "rec-41" ]; then
158 write_centos 6 pdns-recursor pdns_recursor
159 write_centos 7 pdns-recursor pdns_recursor
160 write_debian jessie pdns-recursor pdns_recursor
161 write_debian stretch pdns-recursor pdns_recursor
162 write_ubuntu trusty pdns-recursor pdns_recursor
163 write_ubuntu xenial pdns-recursor pdns_recursor
164 write_ubuntu bionic pdns-recursor pdns_recursor
165 elif [ "$RELEASE" = "rec-42" -o "$RELEASE" = "rec-43" ]; then
166 write_centos 6 pdns-recursor pdns_recursor
167 write_centos 7 pdns-recursor pdns_recursor
168 write_centos 8 pdns-recursor pdns_recursor
169 write_debian stretch pdns-recursor pdns_recursor
170 write_debian buster pdns-recursor pdns_recursor
171 write_ubuntu xenial pdns-recursor pdns_recursor
172 write_ubuntu bionic pdns-recursor pdns_recursor
173 elif [ "$RELEASE" = "dnsdist-15" ]; then
174 write_centos 6 dnsdist dnsdist
175 write_centos 7 dnsdist dnsdist
176 write_centos 8 dnsdist dnsdist
177 write_debian stretch dnsdist dnsdist
178 write_debian buster dnsdist dnsdist
179 write_ubuntu xenial dnsdist dnsdist
180 write_ubuntu bionic dnsdist dnsdist
181 else
182 echo "Invalid release: $RELEASE"
183 exit 1
184 fi