/usr/src/kernel-patches/lustre/scripts/unpatch 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 | #! /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"
if ! [ -f debian/APPLIED_all_lustre ]; then
echo >&2 "Lustre patch not applied."
exit 0
fi
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}
# Check for depends on lustre
if grep -l "^DEPENDS=.*[' ]all/unpatch/lustre[' ]" debian/APPLIED_* >/dev/null 2>/dev/null; then
# There are patches depending on this one, to be removed before.
# the dep will be removed by the last of those other patches.
echo >&2 "NOT unpatching \"Lustre Filesystem patch for the Linux kernel\" since other patches still rely on it"
exit 0
fi
if ! [ -d debian/APPLIED_all_lustre_tmp/.pc.lustre ]; then
cat >&2 <<EOF
ERROR: .pc directory missing for unpatching. I strongly suggest
you remove this kernel tree and unpack a clean one.
EOF
exit 1
fi
if ! [ -e debian/APPLIED_all_lustre_tmp/series.lustre ]; then
cat >&2 <<EOF
ERROR: series file missing for unpatching. I strongly suggest
you remove this kernel tree and unpack a clean one.
EOF
exit 1
fi
cleanup() {
echo >&2 Cleaning up
if [ -e series ]; then
echo >&2 Removing series file
rm series
fi
if [ -e debian/APPLIED_all_lustre_tmp/series.orig ]; then
echo >&1 Restoring orig series file
mv debian/APPLIED_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
}
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 Restoring lustre quilt
mv debian/APPLIED_all_lustre_tmp/series.lustre series
mv debian/APPLIED_all_lustre_tmp/.pc.lustre .pc
echo >&2 Unpatching lustre patches
$QUILT pop -a
ERR=$?
if ! [ $ERR = 0 ]; then
cat >&2 <<EOF
ERROR: Lustre patches failed to unpatch. I strongly suggest
you remove this kernel tree and unpack a clean one.
EOF
cleanup
exit $ERR
fi
echo >&2 Removing lustre quilt
rm -rf .pc series
cleanup
rm debian/APPLIED_all_lustre debian/image.d/register-lustre
echo >&2 "\"Lustre Filesystem patch for the Linux kernel\" patch for $KVERSION removed successfully"
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."
rmdir debian/image.d debian/APPLIED_all_lustre_tmp || true
echo >&2 "END unpatching lustre patch"
|