Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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