Ver código fonte

updated poweradmin run.sh

tags/v2.0.0
Robin Thoni 7 anos atrás
pai
commit
6795440df5
4 arquivos alterados com 51 adições e 24 exclusões
  1. 8
    0
      poweradmin/Dockerfile
  2. 41
    0
      poweradmin/common.sh
  3. 1
    23
      poweradmin/run.sh
  4. 1
    1
      poweradmin/vars-files

+ 8
- 0
poweradmin/Dockerfile Ver arquivo

@@ -3,6 +3,8 @@ FROM robinthoni/debian-multiarch:jessie
3 3
 # FROM https://github.com/ZHAJOR/Docker-Apache-2.4-Php-5.6-for-Laravel
4 4
 MAINTAINER Robin Thoni <robin@rthoni.com>
5 5
 
6
+ARG CONFIG_DIR=/etc/default/config-files/
7
+
6 8
 RUN apt-get update && apt-get -y install\
7 9
         apache2=2.4.*\
8 10
         libapache2-mod-php5\
@@ -34,8 +36,14 @@ COPY ./vars-vars /etc/vars-vars
34 36
 
35 37
 COPY ./vars-files /etc/vars-files
36 38
 
39
+COPY ./common.sh /common.sh
40
+
37 41
 COPY ./run.sh /run.sh
38 42
 
43
+RUN mkdir "${CONFIG_DIR}"
44
+
45
+COPY ./poweradmin-2.1.7/inc/config.inc.php "${CONFIG_DIR}"/config.inc.php
46
+
39 47
 EXPOSE 80
40 48
 
41 49
 CMD ["/run.sh"]

+ 41
- 0
poweradmin/common.sh Ver arquivo

@@ -0,0 +1,41 @@
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
+}

+ 1
- 23
poweradmin/run.sh Ver arquivo

@@ -1,28 +1,6 @@
1 1
 #! /usr/bin/env bash
2 2
 
3
-replace_var()
4
-{
5
-  file="${1}"
6
-  var="${2}"
7
-  sed -e "s?${var}?${!var}?g" -i "${file}"
8
-}
9
-
10
-replace_vars()
11
-{
12
-  file="${1}"
13
-  for var in $(cat /etc/vars-vars)
14
-  do
15
-    replace_var "${file}" "${var}"
16
-  done
17
-}
18
-
19
-replace_files()
20
-{
21
-  for file in $(cat /etc/vars-files)
22
-  do
23
-    replace_vars "${file}"
24
-  done
25
-}
3
+. /common.sh
26 4
 
27 5
 replace_files
28 6
 

+ 1
- 1
poweradmin/vars-files Ver arquivo

@@ -1 +1 @@
1
-/var/www/html/inc/config.inc.php
1
+config.inc.php /var/www/html/inc/config.inc.php

Carregando…
Cancelar
Salvar