/usr/src/kernel-patches/lustre/scripts/apply is in linux-patch-lustre 1.8.5+dfsg-3ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | #! /bin/bash
set -x
if ! [ -d kernel -a -d Documentation ]
then
echo >&2 "Not in kernel top level directory. Exiting"
exit 1
fi
TOPPATCHDIR=/usr/src/kernel-patches/lustre
ARCHITECTURE=`dpkg --print-installation-architecture`
QUILT="quilt --quiltrc /dev/null"
export QUILT_PATCHES="$TOPPATCHDIR/patches"
[ -f debian/APPLIED_all_lustre ] && exit 0
VERSION=$(grep ^VERSION Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
PATCHLEVEL=$( grep ^PATCHLEVEL Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
SUBLEVEL=$(grep ^SUBLEVEL Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
#EXTRAVERSION=$(grep ^EXTRAVERSION Makefile | head -1 2>/dev/null | \
# sed -e 's/EXTRAVERSION =[ ]*\([^ ]*\)$/\1/')
#KERNELBRANCHLET=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}
#KERNELRELEASE=${KERNELBRANCHLET}${EXTRAVERSION}
KERNELRELEASE=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}
cleanup() {
echo >&2 Cleaning up
if [ -e series ]; then
echo >&2 Removing series file
rm series
fi
if [ -e debian/APLLIED_all_lustre_tmp/series.orig ]; then
echo >&1 Restoring orig series file
mv debian/APLLIED_all_lustre_tmp/series.orig series
fi
if [ -e .pc ]; then
echo >&2 Removing .pc dir
rm -r .pc
fi
if [ -e debian/APPLIED_all_lustre_tmp/.pc.orig ]; then
echo >&2 Restoring orig .pc dir
mv debian/APPLIED_all_lustre_tmp/.pc.orig .pc
fi
}
mkdir -p debian/APPLIED_all_lustre_tmp
if [ -e series ]; then
echo >&2 Preserving existing series file
mv series debian/APPLIED_all_lustre_tmp/series.orig
fi
if [ -e .pc ]; then
echo >&2 Preserving existing .pc dir
mv .pc debian/APPLIED_all_lustre_tmp/.pc.orig
fi
trap cleanup EXIT
echo >&2 Setting up quilt
$QUILT setup $TOPPATCHDIR/series/$KERNELRELEASE-vanilla.series 2>/dev/null
ERR=$?
if ! [ $ERR = 0 ]; then
echo >&2 Quilt failed to initialize
cleanup
exit $ERR
fi
echo >&2 Applying lustre patches
$QUILT push -a
ERR=$?
if ! [ $ERR = 0 ]; then
echo >&2 Lustre patched failed to apply
echo >&2 Reverting partialy applied patch
$QUILT pop -a
cleanup
exit $ERR
fi
echo >&2 Finalizing lustre patch
mv series debian/APPLIED_all_lustre_tmp/series.lustre
mv .pc debian/APPLIED_all_lustre_tmp/.pc.lustre
cleanup
echo >&2 "\"Lustre Filesystem patch for the Linux kernel\" patch for $KVERSION succeeded"
echo >&2 "Removing empty files:"
# make an exception for ./debian, or else the stamp files will go too.
find . -path ./debian -prune -o \
-type f -size 0 ! -name 'APPLIED*' -exec rm {} \; -print
echo >&2 "Done."
mkdir -p debian
cat > 'debian/APPLIED_all_lustre' <<EOF
SERIES=$KERNELRELEASE-vanilla.series
EOF
mkdir -p debian/image.d
PKGNAME=`dpkg -S $TOPPATCHDIR/series/$KERNELRELEASE-vanilla.series | cut -d: -f1`
PKGVERS=`grep-dctrl -n -P $PKGNAME -s Version -X /var/lib/dpkg/status`
cat > 'debian/image.d/register-lustre' <<EOF
#!/bin/sh
# This scripts documents the "Lustre Filesystem patch for the Linux kernel" kernel patch into the
# kernel-image package, as being applied to the kernel.
docdir=\${IMAGE_TOP}/usr/share/doc/kernel-image-\${version}
mkdir -p \${docdir}
(
printf 'Lustre Filesystem patch for the Linux kernel (lustre)${KPATCH_lustre:+ for kernel ${KPATCH_lustre}},'
echo ' from package $PKGNAME, version $PKGVERS'
) >> \${docdir}/applied-patches
EOF
chmod +x 'debian/image.d/register-lustre'
echo >&2 "END applying lustre patch"
|