OpenSDE Packages Database (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.

89 lines
3.0 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: package/.../vserver/pkg_linux_pre.conf
  6. # Copyright (C) 2006 The OpenSDE Project
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2003 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. pkg_ctx_confdir=$base/package/*/vserver
  18. # tempdir
  19. pkg_ctx_tempdir=`mktemp -d`
  20. #hook_add postpatch 6 "rm -rf $pkg_ctx_tempdir"
  21. # detect /best fit/ linux patch
  22. pkg_ctx_lxver=${ver//-/.}.
  23. pkg_ctx_patch=
  24. while [ "$pkg_ctx_lxver" != "${pkg_ctx_lxver%.*}" -a -z "$pkg_ctx_patch" ]; do
  25. pkg_ctx_lxver=${pkg_ctx_lxver%.*}
  26. pkg_ctx_patch=`match_source_file -p " patch-${pkg_ctx_lxver}[^ ]*-vs[^ q].*.diff" vserver | head -n1`
  27. done
  28. [ -z "$pkg_ctx_patch" ] && abort "no vserver patch found for linux $ver"
  29. # find supplementary fixes
  30. pkg_ctx_fixes_pattern="`basename ${pkg_ctx_patch%.diff} .diff`[.].*[.]diff"
  31. pkg_ctx_fixes="`match_source_file -p " ${pkg_ctx_fixes_pattern}" vserver`"
  32. # prepare vserver patch
  33. pkg_ctx_ver=$( echo $pkg_ctx_patch | sed -n -e 's,.*-vs\(.*\).diff.*,\1,p' )
  34. # remove extraversion from patch and inject in lx_extraversion by hand
  35. [[ ${pkg_ctx_patch} == *.bz2 ]] && x=bzcat || x=cat
  36. $x ${pkg_ctx_patch} | gawk "
  37. BEGIN { FS=\"[ /\t]\"
  38. removethis=0
  39. }
  40. /^--- / {
  41. if ( \$3 == \"Makefile\" )
  42. removethis=1
  43. else
  44. removethis=0
  45. }
  46. /.*/ {
  47. if ( removethis != 1 )
  48. print
  49. }
  50. " > $pkg_ctx_tempdir/vserver-${pkg_ctx_ver}.patch
  51. echo_status "Including VServer ($pkg_ctx_ver) support."
  52. hook_add postpatch 5 "lx_extraversion=\$lx_extraversion-vs${pkg_ctx_ver}"
  53. var_append patchfiles ' ' $pkg_ctx_tempdir/vserver-$pkg_ctx_ver.patch
  54. [ -n "${pkg_ctx_fixes}" ] && var_append patchfiles ' ' ${pkg_ctx_fixes}
  55. if [ "$SDECFG_PKG_VSERVER_QUOTA" = "1" ]; then
  56. pkg_ctx_lxver=$ver.
  57. pkg_vquota_patch=
  58. if [[ $ver == 2.4.* ]]; then
  59. # prepare vquota patch
  60. while [ "$pkg_ctx_lxver" != "${pkg_ctx_lxver%.*}" -a -z "$pkg_quota_patch" ]; do
  61. pkg_ctx_lxver=${pkg_ctx_lxver%.*}
  62. pkg_vquota_patch=`match_source_file -p " patch-${pkg_ctx_lxver}[^ ]*-q.*.diff" vserver | head -n 1`
  63. done
  64. fi
  65. if [ -n "$pkg_vquota_patch" ]; then
  66. pkg_vquota_ver=$( echo $pkg_vquota_patch | sed -n -e 's,.*-q\(.*\).diff.bz2,\1,p' )
  67. [[ ${pkg_vquota_patch} == *.bz2 ]] && x=bzcat || x=cat
  68. $x $pkg_vquota_patch \
  69. > $pkg_ctx_tempdir/vquota-$pkg_vquota_ver.patch
  70. echo_status "Including Per Context Quota/Disk Limits ($pkg_vquota_ver) support."
  71. var_append patchfiles ' ' $pkg_ctx_tempdir/vquota-$pkg_vquota_ver.patch
  72. var_append confscripts ' ' $pkg_ctx_confdir/kernel-vquota.conf.sh
  73. else
  74. echo_status "No Per Context Quota/Disk Limits support available for Linux ${pkg_ctx_lxver}"
  75. fi
  76. fi