Bläddra i källkod

Converted tftpd

tags/v3.0.0
Robin Thoni 5 år sedan
förälder
incheckning
03354c8dd9

+ 8
- 23
tftpd/Dockerfile Visa fil

@@ -1,28 +1,13 @@
1
-FROM robinthoni/debian-multiarch:jessie
1
+FROM debian:stretch
2 2
 
3
-MAINTAINER Robin Thoni <robin@rthoni.com>
3
+ADD https://raw.githubusercontent.com/robin-thoni/docker-utils/v1.3.0/setup.sh /tmp/docker-utils-setup.sh
4
+RUN sh /tmp/docker-utils-setup.sh
5
+ENTRYPOINT ["gcf-entrypoint"]
4 6
 
5
-ARG CONFIG_DIR=/etc/default/config-files/
6
-
7
-RUN apt-get update && apt-get -y install\
7
+RUN pkgs-install\
8 8
         tftpd-hpa\
9
-        xinetd &&\
10
-        apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
11
-
12
-RUN rm -rf /var/log/*
13
-
14
-COPY ./vars-vars /etc/vars-vars
15
-
16
-COPY ./vars-files /etc/vars-files
17
-
18
-COPY ./common.sh /common.sh
19
-
20
-COPY ./run.sh /run.sh
21
-
22
-RUN mkdir "${CONFIG_DIR}"
23
-
24
-COPY xinetd.tftp.conf "${CONFIG_DIR}"/tftp
9
+        xinetd
25 10
 
26
-EXPOSE 80
11
+COPY ./config /etc/salt/base/
27 12
 
28
-CMD ["/run.sh"]
13
+CMD ["xinetd", "-dontfork"]

+ 0
- 41
tftpd/common.sh Visa fil

@@ -1,41 +0,0 @@
1
-export CONFIG_DIR="/etc/default/config-files/"
2
-
3
-resolv_host()
4
-{
5
-  hostname="${1}"
6
-  ip=$(getent hosts "${hostname}" | cut -d' ' -f1)
7
-  echo "${ip}"
8
-}
9
-
10
-replace_var()
11
-{
12
-  file="${1}"
13
-  var="${2}"
14
-  sed -e "s?${var}?${!var}?g" -i "${file}"
15
-}
16
-
17
-replace_vars()
18
-{
19
-  file="${1}"
20
-  for var in $(cat /etc/vars-vars)
21
-  do
22
-    replace_var "${file}" "${var}"
23
-  done
24
-}
25
-
26
-replace_files()
27
-{
28
-  cat /etc/vars-files | while read line
29
-  do
30
-    filesrc="${CONFIG_DIR}$(echo "${line}" | awk '{print $1}')"
31
-    filedst=$(echo "${line}" | awk '{print $2}')
32
-    if [ -f "${filesrc}" ]
33
-    then
34
-      echo "Expanding file ${filesrc} to ${filedst}"
35
-      cp "${filesrc}" "${filedst}"
36
-      replace_vars "${filedst}"
37
-    else
38
-      echo "File ${filesrc} does not exist. Skipping."
39
-    fi
40
-  done
41
-}

+ 4
- 0
tftpd/config/states/tftpd/init.sls Visa fil

@@ -0,0 +1,4 @@
1
+tftpd-config:
2
+  file.managed:
3
+    - name: /etc/xinetd.d/tftp
4
+    - source: salt://tftpd/xinetd.tftp.conf

tftpd/xinetd.tftp.conf → tftpd/config/states/tftpd/xinetd.tftp.conf Visa fil


+ 0
- 7
tftpd/run.sh Visa fil

@@ -1,7 +0,0 @@
1
-#! /usr/bin/env bash
2
-
3
-. /common.sh
4
-
5
-replace_files
6
-
7
-exec xinetd -dontfork

+ 0
- 1
tftpd/vars-files Visa fil

@@ -1 +0,0 @@
1
-tftp /etc/xinetd.d/tftp

+ 0
- 22
tftpd/vars-vars Visa fil

@@ -1,22 +0,0 @@
1
-DHCP_DNS_MASTER
2
-DHCP_DNS_SERVERS
3
-DHCP_TFTP_SERVER
4
-DHCP_ROUTERS
5
-DHCP_UNIFI_CONTROLLER_IP
6
-
7
-DHCP_DOMAIN
8
-DHCP_SITE_DOMAIN
9
-DHCP_DYN_IPS_DOMAIN
10
-DHCP_REV_DOMAIN
11
-
12
-DHCP_SUBNET
13
-DHCP_NETMASK
14
-DHCP_IP_FIRST
15
-DHCP_IP_LAST
16
-DHCP_BROADCAST
17
-
18
-DNS_FORWARDER_IP_1
19
-DNS_FORWARDER_IP_2
20
-DNS_TSIG_KEY_INTERNAL_SECRET
21
-DNS_TSIG_KEY_EXTERNAL_SECRET
22
-DNS_TSIG_KEY_RNDC_SECRET

Laddar…
Avbryt
Spara