123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #! /usr/bin/env bash
-
- export CONFIG_DIR="/etc/default/config-files/"
-
- replace_var()
- {
- file="${1}"
- var="${2}"
- sed -e "s?${var}?${!var}?g" -i "${file}"
- }
-
- replace_vars()
- {
- file="${1}"
- for var in $(cat /etc/vars-vars)
- do
- replace_var "${file}" "${var}"
- done
- }
-
- replace_files()
- {
- cat /etc/vars-files | while read line
- do
- filesrc="${CONFIG_DIR}$(echo "${line}" | awk '{print $1}')"
- filedst=$(echo "${line}" | awk '{print $2}')
- if [ -f "${filesrc}" ]
- then
- echo "Expanding file ${filesrc} to ${filedst}"
- cp "${filesrc}" "${filedst}"
- replace_vars "${filedst}"
- else
- echo "File ${filesrc} does not exist. Skipping."
- fi
- done
- }
-
- replace_files
-
- cd /var/www &&
- dotnet __RUN_ME.DLL
- sleep infinity
|