OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.8 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: lib/jailing/parse-config
  5. # Copyright (C) 2006 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. # Copyright (C) 1998 - 2003 Clifford Wolf
  8. #
  9. # More information can be found in the files COPYING and README.
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; version 2 of the License. A copy of the
  14. # GNU General Public License can be found in the file COPYING.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. # Revwrite --with-<option>=<pkg_path> in confopt
  17. # to correct <path> when <option> is relative to
  18. # a jailed package.
  19. #
  20. jail_confopt_paths_rewrite() {
  21. # This list will grow
  22. for y in mysql postgresql openldap apache; do
  23. if eval "[ \"\${SDECFG_JAILING_$y}\" = 1 ]" ; then
  24. # Correct eventual misconfigured jail
  25. # To be removed!
  26. if eval "[ ! \"\${SDECFG_JAILDIR_$y}\" ]" ; then
  27. eval "export \${SDECFG_JAILDIR_$y}=\
  28. \"${SDECFG_BASEJAIL}/$y\""
  29. fi
  30. eval "y_path=$root/\"\${SDECFG_JAILDIR_$y}/usr\""
  31. var_append LDFLAGS ' ' "-L/${y_path}/lib"
  32. # Set correct optname and y_path
  33. # This will grow too
  34. case "$y" in
  35. postgresql) optname=pgsql ;;
  36. openldap) optname=ldap ;;
  37. apache) optname=apxs2
  38. y_path=${y_path}/sbin/apxs ;;
  39. *) optname=$y ;;
  40. esac
  41. # Rewrite
  42. confopt=$(eval "echo $confopt" | xargs -n1 | sed " \
  43. s|^--with-${optname}=shared.*$|--with-${optname}=shared,${y_path}|g; \
  44. s|^--with-${optname}=[^,]*$|--with-${optname}=${y_path}|g; \
  45. " | xargs)
  46. # Sometime pkg has internal support for <optname> so
  47. # if there's no =... or =shared it means internal
  48. # support want to be used.
  49. # Only mysql in php is using this ... for now
  50. if [ ! "`echo ${has_internal} | grep $optname`" ] ; then
  51. confopt=$(echo $confopt | xargs -n1 | sed " \
  52. s|^--with-${optname}$|--with-${optname}=${y_path}|g \
  53. " | xargs)
  54. fi
  55. fi
  56. done
  57. export LDFLAGS
  58. unset y optname y_path
  59. }
  60. jail_samejail() {
  61. eval "export SDECFG_JAILING_$1=\"\$SDECFG_JAILING_$2\""
  62. eval "export SDECFG_JAILDIR_$1=\"\$SDECFG_JAILDIR_$2\""
  63. }
  64. if [ "${SDECFG_JAILING}" = 1 ] ; then
  65. [ "$pkg" = php ] && jail_samejail php apache
  66. [ "$pkg" = subversion ] && jail_samejail subversion apache
  67. if eval "[ \"\${SDECFG_JAILING_$pkg}\" = 1 ]" ; then
  68. . $base/lib/jailing/jail-functions
  69. . $base/lib/jailing/package-functions
  70. if eval "[ ! \"\${SDECFG_JAILDIR_$pkg}\" ]" ; then
  71. eval "export \${SDECFG_JAILDIR_$pkg}=\"${SDECFG_BASEJAIL}/$pkg\""
  72. fi
  73. eval "export jail=\"\${SDECFG_JAILDIR_$pkg}\""
  74. case "$pkg" in
  75. # Setting destvar
  76. postfix) destvar='install_root' ;;
  77. php) destvar='INSTALL_ROOT' ;;
  78. *) destvar='DESTDIR' ;;
  79. esac
  80. [ -e $base/lib/jailing/$pkg.patch ] && var_append patchfiles ' ' $base/lib/jailing/$pkg.patch
  81. for i in `ls $base/lib/jailing/$pkg-*.patch 2>/dev/null` ; do
  82. var_append patchfiles ' ' "$i"
  83. done
  84. case "$pkg" in
  85. # Special package settings
  86. apache) postmake='jail_pkg_apache_postmake' ;;
  87. postfix) postmake='jail_pkg_postfix_postmake' ;;
  88. openldap) postmake='jail_ensure_users ldap' ;;
  89. mysql) var_append extraconfopt " " "--with-mysql-user=$pkg"
  90. inmake='jail_ensure_users mysql'
  91. postmake='jail_pkg_mysql_postmake' ;;
  92. php) has_internal='mysql' ;;
  93. esac
  94. createprefix='0'
  95. createdocs='0'
  96. hook_add prepare 7 jail_set_confopt
  97. hook_add preconf 1 jail_create
  98. hook_add inmake 9 '[ "$destvar" ] && var_append makeinstopt " " "$destvar=$root/$jail"'
  99. hook_add postmake 9 jail_copy_needed_libs
  100. var_append flistroot " " "$jail"
  101. echo_status "Jailing support activated to directory "'$root/'"$jail"
  102. fi
  103. hook_add preconf 6 'jail_confopt_paths_rewrite'
  104. fi