mirror of the now-defunct rocklinux.org
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.

129 lines
4.1 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/misc/jailing/parse-config
  9. # ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
  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; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. # Revwrite --with-<option>=<pkg_path> in confopt
  23. # to correct <path> when <option> is relative to
  24. # a jailed package.
  25. #
  26. jail_confopt_paths_rewrite() {
  27. # This list will grow
  28. for y in mysql postgresql openldap apache; do
  29. if eval "[ \"\${ROCKCFG_JAILING_$y}\" = 1 ]" ; then
  30. # Correct eventual misconfigured jail
  31. # To be removed!
  32. if eval "[ ! \"\${ROCKCFG_JAILDIR_$y}\" ]" ; then
  33. eval "export \${ROCKCFG_JAILDIR_$y}=\
  34. \"${ROCKCFG_BASEJAIL}/$y\""
  35. fi
  36. eval "y_path=$root/\"\${ROCKCFG_JAILDIR_$y}/usr\""
  37. var_append LDFLAGS ' ' "-L/${y_path}/lib"
  38. # Set correct optname and y_path
  39. # This will grow too
  40. case "$y" in
  41. postgresql) optname=pgsql ;;
  42. openldap) optname=ldap ;;
  43. apache) optname=apxs2
  44. y_path=${y_path}/sbin/apxs ;;
  45. *) optname=$y ;;
  46. esac
  47. # Rewrite
  48. confopt=$(eval "echo $confopt" | xargs -n1 | sed " \
  49. s|^--with-${optname}=shared.*$|--with-${optname}=shared,${y_path}|g; \
  50. s|^--with-${optname}=[^,]*$|--with-${optname}=${y_path}|g; \
  51. " | xargs)
  52. # Sometime pkg has internal support for <optname> so
  53. # if there's no =... or =shared it means internal
  54. # support want to be used.
  55. # Only mysql in php is using this ... for now
  56. if [ ! "`echo ${has_internal} | grep $optname`" ] ; then
  57. confopt=$(echo $confopt | xargs -n1 | sed " \
  58. s|^--with-${optname}$|--with-${optname}=${y_path}|g \
  59. " | xargs)
  60. fi
  61. fi
  62. done
  63. export LDFLAGS
  64. unset y optname y_path
  65. }
  66. jail_samejail() {
  67. eval "export ROCKCFG_JAILING_$1=\"\$ROCKCFG_JAILING_$2\""
  68. eval "export ROCKCFG_JAILDIR_$1=\"\$ROCKCFG_JAILDIR_$2\""
  69. }
  70. if [ "${ROCKCFG_JAILING}" = 1 ] ; then
  71. [ "$pkg" = php ] && jail_samejail php apache
  72. [ "$pkg" = subversion ] && jail_samejail subversion apache
  73. if eval "[ \"\${ROCKCFG_JAILING_$pkg}\" = 1 ]" ; then
  74. . $base/misc/jailing/jail-functions
  75. . $base/misc/jailing/package-functions
  76. if eval "[ ! \"\${ROCKCFG_JAILDIR_$pkg}\" ]" ; then
  77. eval "export \${ROCKCFG_JAILDIR_$pkg}=\"${ROCKCFG_BASEJAIL}/$pkg\""
  78. fi
  79. eval "export jail=\"\${ROCKCFG_JAILDIR_$pkg}\""
  80. case "$pkg" in
  81. # Setting destvar
  82. postfix) destvar='install_root' ;;
  83. php) destvar='INSTALL_ROOT' ;;
  84. *) destvar='DESTDIR' ;;
  85. esac
  86. [ -e $base/misc/jailing/$pkg.patch ] && var_append patchfiles ' ' $base/misc/jailing/$pkg.patch
  87. for i in `ls $base/misc/jailing/$pkg-*.patch 2>/dev/null` ; do
  88. var_append patchfiles ' ' "$i"
  89. done
  90. case "$pkg" in
  91. # Special package settings
  92. apache) postmake='jail_pkg_apache_postmake' ;;
  93. postfix) postmake='jail_pkg_postfix_postmake' ;;
  94. openldap) postmake='jail_ensure_users ldap' ;;
  95. mysql) var_append extraconfopt " " "--with-mysql-user=$pkg"
  96. inmake='jail_ensure_users mysql'
  97. postmake='jail_pkg_mysql_postmake' ;;
  98. php) has_internal='mysql' ;;
  99. esac
  100. createprefix='0'
  101. createdocs='0'
  102. hook_add prepare 7 jail_set_confopt
  103. hook_add preconf 1 jail_create
  104. hook_add inmake 9 '[ "$destvar" ] && var_append makeinstopt " " "$destvar=$root/$jail"'
  105. hook_add postmake 9 jail_copy_needed_libs
  106. var_append flistroot " " "$jail"
  107. echo_status "Jailing support activated to directory "'$root/'"$jail"
  108. fi
  109. hook_add preconf 6 'jail_confopt_paths_rewrite'
  110. fi