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.

90 lines
3.0 KiB

#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../vserver/pkg_linux_pre.conf
# Copyright (C) 2006 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
pkg_ctx_confdir=$base/package/*/vserver
# tempdir
pkg_ctx_tempdir=`mktemp -d`
#hook_add postpatch 6 "rm -rf $pkg_ctx_tempdir"
# detect /best fit/ linux patch
pkg_ctx_lxver=${ver//-/.}.
pkg_ctx_patch=
while [ "$pkg_ctx_lxver" != "${pkg_ctx_lxver%.*}" -a -z "$pkg_ctx_patch" ]; do
pkg_ctx_lxver=${pkg_ctx_lxver%.*}
pkg_ctx_patch=`match_source_file -p " patch-${pkg_ctx_lxver}[^ ]*-vs[^ q].*.diff" vserver | head -n1`
done
[ -z "$pkg_ctx_patch" ] && abort "no vserver patch found for linux $ver"
# find supplementary fixes
pkg_ctx_fixes_pattern="`basename ${pkg_ctx_patch%.diff} .diff`[.].*[.]diff"
pkg_ctx_fixes="`match_source_file -p " ${pkg_ctx_fixes_pattern}" vserver`"
# prepare vserver patch
pkg_ctx_ver=$( echo $pkg_ctx_patch | sed -n -e 's,.*-vs\(.*\).diff.*,\1,p' )
# remove extraversion from patch and inject in lx_extraversion by hand
[[ ${pkg_ctx_patch} == *.bz2 ]] && x=bzcat || x=cat
$x ${pkg_ctx_patch} | gawk "
BEGIN { FS=\"[ /\t]\"
removethis=0
}
/^--- / {
if ( \$3 == \"Makefile\" )
removethis=1
else
removethis=0
}
/.*/ {
if ( removethis != 1 )
print
}
" > $pkg_ctx_tempdir/vserver-${pkg_ctx_ver}.patch
echo_status "Including VServer ($pkg_ctx_ver) support."
hook_add postpatch 5 "lx_extraversion=\$lx_extraversion-vs${pkg_ctx_ver}"
var_append patchfiles ' ' $pkg_ctx_tempdir/vserver-$pkg_ctx_ver.patch
[ -n "${pkg_ctx_fixes}" ] && var_append patchfiles ' ' ${pkg_ctx_fixes}
if [ "$SDECFG_PKG_VSERVER_QUOTA" = "1" ]; then
pkg_ctx_lxver=$ver.
pkg_vquota_patch=
if [[ $ver == 2.4.* ]]; then
# prepare vquota patch
while [ "$pkg_ctx_lxver" != "${pkg_ctx_lxver%.*}" -a -z "$pkg_quota_patch" ]; do
pkg_ctx_lxver=${pkg_ctx_lxver%.*}
pkg_vquota_patch=`match_source_file -p " patch-${pkg_ctx_lxver}[^ ]*-q.*.diff" vserver | head -n 1`
done
fi
if [ -n "$pkg_vquota_patch" ]; then
pkg_vquota_ver=$( echo $pkg_vquota_patch | sed -n -e 's,.*-q\(.*\).diff.bz2,\1,p' )
[[ ${pkg_vquota_patch} == *.bz2 ]] && x=bzcat || x=cat
$x $pkg_vquota_patch \
> $pkg_ctx_tempdir/vquota-$pkg_vquota_ver.patch
echo_status "Including Per Context Quota/Disk Limits ($pkg_vquota_ver) support."
var_append patchfiles ' ' $pkg_ctx_tempdir/vquota-$pkg_vquota_ver.patch
var_append confscripts ' ' $pkg_ctx_confdir/kernel-vquota.conf.sh
else
echo_status "No Per Context Quota/Disk Limits support available for Linux ${pkg_ctx_lxver}"
fi
fi