1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/vserver/pkg_linux_pre.conf
3 # Copyright (C) 2004 - 2021 The T2 SDE Project
4 # Copyright (C) 1998 - 2003 ROCK Linux Project
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; version 2 of the License. A copy of the
12 # GNU General Public License can be found in the file COPYING.
13 # --- T2-COPYRIGHT-NOTE-END ---
15 pkg_ctx_confdir=$base/package/*/vserver
18 pkg_ctx_tempdir=`mktemp -d`
19 #hook_add postpatch 6 "rm -rf $pkg_ctx_tempdir"
21 # detect /best fit/ linux 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`
29 [ -z "$pkg_ctx_patch" ] && abort "no vserver patch found for linux $ver"
31 # find supplementary fixes
32 pkg_ctx_fixes_pattern="`basename ${pkg_ctx_patch%.diff} .diff`[.].*[.]diff"
33 pkg_ctx_fixes="`match_source_file -p " ${pkg_ctx_fixes_pattern}" vserver`"
35 # prepare vserver patch
36 pkg_ctx_ver=$( echo $pkg_ctx_patch | sed -n -e 's,.*-vs\(.*\).diff.*,\1,p' )
38 # remove extraversion from patch and inject in lx_extraversion by hand
39 [[ ${pkg_ctx_patch} == *.bz2 ]] && x=bzcat || x=cat
40 $x ${pkg_ctx_patch} | gawk "
45 if ( \$3 == \"Makefile\" )
51 if ( removethis != 1 )
54 " > $pkg_ctx_tempdir/vserver-${pkg_ctx_ver}.patch
55 lx_extraversion="$lx_extraversion-vs${pkg_ctx_ver}"
57 echo_status "Including Security Contexts (vserver-$pkg_ctx_ver) patch"
58 var_append patchfiles ' ' $pkg_ctx_tempdir/vserver-$pkg_ctx_ver.patch
59 [ -n "${pkg_ctx_fixes}" ] && var_append patchfiles ' ' ${pkg_ctx_fixes}
61 if [ "$SDECFG_PKG_VSERVER_QUOTA" = "1" ]; then
64 if [[ $ver == 2.4.* ]]; then
65 # prepare vquota patch
66 while [ "$pkg_ctx_lxver" != "${pkg_ctx_lxver%.*}" -a -z "$pkg_quota_patch" ]; do
67 pkg_ctx_lxver=${pkg_ctx_lxver%.*}
68 pkg_vquota_patch=`match_source_file -p " patch-${pkg_ctx_lxver}[^ ]*-q.*.diff" vserver | head -n 1`
72 if [ -n "$pkg_vquota_patch" ]; then
73 pkg_vquota_ver=$( echo $pkg_vquota_patch | sed -n -e 's,.*-q\(.*\).diff.bz2,\1,p' )
75 [[ ${pkg_vquota_patch} == *.bz2 ]] && x=bzcat || x=cat
76 $x $pkg_vquota_patch \
77 > $pkg_ctx_tempdir/vquota-$pkg_vquota_ver.patch
79 echo_status "Including Per Context Quota/Disk Limits support (vquota-$pkg_vquota_ver) patch..."
80 var_append patchfiles ' ' $pkg_ctx_tempdir/vquota-$pkg_vquota_ver.patch
81 var_append confscripts ' ' $pkg_ctx_confdir/kernel-vquota.conf.sh
83 echo_status "No Per Context Quota/Disk Limits support available for Linux ${pkg_ctx_lxver}"