[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debian-devel:10815] Problems with apply-vfatjp and unpatch-vfatjp script



野中です、こんにちは。

kernel-patch-vfatjp の wishlist バグ報告 (Bug#JP/1051) を close するために、
/usr/src/kernel-patches/all/apply/apply-vfatjp と、
/usr/src/kernel-patches/all/unpatch/unpatch-vfatjp を作ってみました。

これでうまくいくはずなのですが、なぜかうまいこといきません。
アドバイス・ヒント等、ご教示いただける方、ぜひお願い致します。

#! /bin/sh
#
# $Id: apply-vfatjp,v 1.3 1999/11/01 13:05:45 nonaka Exp $
#
# Based on /usr/doc/kernel-package/Multi-Arch.gz
# by Manoj Srivastava <srivasta@debian.org>.
#
# Copyright (c) 1999 Ken Nonaka <nonaka@xxxxxxxxx>
# Under the GNU GPL license.

set -e

# Check current directory.

if ! test -d kernel -a -d Documentation ; then
	echo "Not in kernel top level directory."
	echo "Exiting" >&2
exit 1
fi

# Check available version.

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-9B]*\)/\1/')

case "$VERSION.$PATCHLEVEL.$SUBLEVEL" in
(2.0.37|2.0.38\
|2.2.11|2.2.12|2.2.13\
|2.3.17|2.3.18|2.3.19|2.3.20|2.3.21\
|2.3.22\
|2.0.29)

# Check applied patch.

if test -f "debian/APPLIED_all_vfatjp-$VERSION.$PATCHLEVEL.$SUBLEVEL" ; then
	echo "No need."
	echo "Already applied."
	echo "Exiting" >&2
exit 0
fi

if test -f debian/APPLIED_all_vfatjp-* ; then
	echo "Unpatch your applied version's."
	echo "Already applied, but.."
	echo "NOT for kernel ver.$VERSION.$PATCHLEVEL.$SUBLEVEL."
	echo "Exiting" >&2
exit 0
fi

# Select /usr/bin/patch options.

PATCH_VERSION=$(patch -v | head -1 | sed -e 's/[^0-9\.]//g')

if dpkg --compare-versions $PATCH_VERSION \>= 2.2 
then
    PATCH_OPTIONS="-l -s -z -p1"
else
    PATCH_OPTIONS="-l -s -b -p1"
fi

# Apply patch.

PATCHDIR=/usr/src/kernel-patches/all
#PATCHDIR=VFAT-jp
#ln -s ../kernel-patches/all VFAT-jp

case "$VERSION.$PATCHLEVEL.$SUBLEVEL" in
(2.0.37|2.0.38)
zcat $PATCHDIR/2.0.37.vfatjp.patch.gz | patch `echo $PATCH_OPTIONS` 
esac

case "$VERSION.$PATCHLEVEL.$SUBLEVEL" in
(2.2.11|2.2.12|2.2.13)
zcat $PATCHDIR/2.2.11.vfatjp.patch.gz | patch `echo $PATCH_OPTIONS` 
esac

case "$VERSION.$PATCHLEVEL.$SUBLEVEL" in
(2.3.17|2.3.18|2.3.19|2.3.20|2.3.21)
zcat $PATCHDIR/2.3.17.vfatjp.patch.gz | patch `echo $PATCH_OPTIONS` 
esac

case "$VERSION.$PATCHLEVEL.$SUBLEVEL" in
(2.3.22)
zcat $PATCHDIR/2.3.22-vfatjp.patch.gz | patch `echo $PATCH_OPTIONS` 
esac

zcat $PATCHDIR/common.vfatjp.patch.gz | patch `echo $PATCH_OPTIONS` 

# Stamp record.

echo "Removing empty files after patching" >&2
find . -type f -size 0 -exec rm {} \; -print
touch debian/APPLIED_all_vfatjp-$VERSION.$PATCHLEVEL.$SUBLEVEL
exit 0

esac

# Sorry.

echo "Hack it yourself."
echo "Not available for kernel ver.$VERSION.$PATCHLEVEL.$SUBLEVEL."
echo "Exiting" >&2
exit 0

# End.

#! /bin/sh
#
# $Id: unpatch-vfatjp,v 1.3 1999/11/01 13:05:55 nonaka Exp $
#
# Based on /usr/doc/kernel-package/Multi-Arch.gz
# by Manoj Srivastava <srivasta@debian.org>.
#
# Copyright (c) 1999 Ken Nonaka <nonaka@xxxxxxxxx>
# Under the GNU GPL license.

set -e

# Check current directory.

if ! test -d kernel -a -d Documentation ; then
	echo "Not in kernel top level directory."
	echo "Exiting" >&2
exit 1
fi

# Check available version.

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-9B]*\)/\1/')

case "$VERSION.$PATCHLEVEL.$SUBLEVEL" in
(2.0.37|2.0.38\
|2.2.11|2.2.12|2.2.13\
|2.3.17|2.3.18|2.3.19|2.3.20|2.3.21\
|2.3.22\
|2.0.29)

# Check applied patch.

if ! test -f debian/APPLIED_all_vfatjp-* ; then
	echo "No need."
	echo "Not applied yet."
	echo "Exiting" >&2
exit 0
fi

# Select /usr/bin/patch options.

PATCH_VERSION=$(patch -v | head -1 | sed -e 's/[^0-9\.]//g')

if dpkg --compare-versions $PATCH_VERSION \>= 2.2 
then
    PATCH_OPTIONS="-l -s -z -p1"
else
    PATCH_OPTIONS="-l -s -b -p1"
fi

# Unpatch applied patch.

PATCHDIR=/usr/src/kernel-patches/all
#PATCHDIR=VFAT-jp

if test -f debian/APPLIED_all_vfatjp-2.0.[37-38] ; then
	zcat $PATCHDIR/2.0.37.vfatjp.patch.gz | patch -R `echo $PATCH_OPTIONS` 
fi

if test -f debian/APPLIED_all_vfatjp-2.2.[11-13] ; then
	zcat $PATCHDIR/2.2.11.vfatjp.patch.gz | patch -R `echo $PATCH_OPTIONS` 
fi

if test -f debian/APPLIED_all_vfatjp-2.3.[17-21] ; then
	zcat $PATCHDIR/2.3.17.vfatjp.patch.gz | patch -R `echo $PATCH_OPTIONS` 
fi

if test -f debian/APPLIED_all_vfatjp-2.3.22 ; then
	zcat $PATCHDIR/2.3.22-vfatjp.patch.gz | patch -R `echo $PATCH_OPTIONS` 
fi

zcat $PATCHDIR/common.vfatjp.patch.gz | patch -R `echo $PATCH_OPTIONS` 

# Remove stamp.

echo "Removing empty files after unpatching" >&2
find . -type f -size 0 -exec rm {} \; -print
rm -f debian/APPLIED_all_vfatjp-$VERSION.$PATCHLEVEL.$SUBLEVEL
exit 0

esac

# Sorry.

echo "Hack it yourself."
echo "Not available for kernel ver.$VERSION.$PATCHLEVEL.$SUBLEVEL."
echo "Exiting" >&2
exit 0

# End.

nonaka@ulysses /usr/src/linux $ sudo ../kernel-patches/all/unpatch/unpatch-vfatjp 
Unreversed patch detected!  Ignore -R? [n] y
Patch attempted to create file `Makefile', which already exists.
1 out of 1 hunk FAILED -- saving rejects to Makefile.rej
The next patch, when reversed, would delete the file `a2uni.c',
which does not exist!  Ignore -R? [n] y
The next patch, when reversed, would delete the file `japanese.h',
which does not exist!  Ignore -R? [n] y
The next patch, when reversed, would delete the file `jptool.c',
which does not exist!  Ignore -R? [n] y
The next patch, when reversed, would delete the file `uni2euc.c',
which does not exist!  Ignore -R? [n] y

==================================================================
Ken Nonaka <nonaka@xxxxxxxxx>                      Yokohama, Japan
Key fingerprint = 94 2A D5 3B BF E1 EC B6  2E B7 9D DB 96 95 D9 FF