1998-01-27 20:48:42 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
1998-02-24 18:50:46 +00:00
|
|
|
curr_ver=$(ls gnupg-*.tar.gz | sort -r -t '.' -n +0.4 -1 +1 -2 +2 \
|
|
|
|
| head -1 | sed -e 's/gnupg-\(.*\).tar.gz/\1/' )
|
|
|
|
prev_ver=$(ls gnupg-*.tar.gz | sort -r -t '.' -n +0.4 -1 +1 -2 +2 \
|
|
|
|
| head -2 | tail -1 | sed -e 's/gnupg-\(.*\).tar.gz/\1/' )
|
1998-01-27 20:48:42 +00:00
|
|
|
|
|
|
|
echo "Current is: $curr_ver"
|
|
|
|
echo "Previous is: $prev_ver"
|
|
|
|
|
|
|
|
echo "Removing old directories"
|
1998-02-24 18:50:46 +00:00
|
|
|
[ -d "gnupg-$curr_ver" ] && rm -rf "gnupg-$curr_ver"
|
|
|
|
[ -d "gnupg-$prev_ver" ] && rm -rf "gnupg-$prev_ver"
|
1998-02-13 20:58:50 +00:00
|
|
|
|
|
|
|
echo "Unpacking previous and current tar"
|
1998-02-24 18:50:46 +00:00
|
|
|
tar xzf "gnupg-$curr_ver.tar.gz"
|
|
|
|
tar xzf "gnupg-$prev_ver.tar.gz"
|
1998-01-27 20:48:42 +00:00
|
|
|
|
1998-02-13 20:58:50 +00:00
|
|
|
|
1998-01-27 20:48:42 +00:00
|
|
|
echo "Diffing"
|
1998-02-24 18:50:46 +00:00
|
|
|
tmp_name="gnupg-$curr_ver.diff.tmp"
|
|
|
|
diff_name="gnupg-$curr_ver.diff"
|
1998-01-27 20:48:42 +00:00
|
|
|
|
1998-02-24 18:50:46 +00:00
|
|
|
diff -urN "gnupg-$prev_ver/" "gnupg-$curr_ver/" > $tmp_name || true
|
1998-01-27 20:48:42 +00:00
|
|
|
|
|
|
|
echo "Making patch file"
|
|
|
|
|
|
|
|
cat <<EOF > $diff_name
|
|
|
|
|
|
|
|
This is a patch file against $prev_ver.
|
|
|
|
|
1998-02-24 18:50:46 +00:00
|
|
|
Change to directory gnupg-$prev_ver (or however you renamed it)
|
1998-01-27 20:48:42 +00:00
|
|
|
and give this command:
|
|
|
|
|
1998-02-24 18:50:46 +00:00
|
|
|
zcat somepath/gnupg-$curr_ver.diff.gz | patch -p1
|
1998-01-27 20:48:42 +00:00
|
|
|
|
1998-02-24 18:50:46 +00:00
|
|
|
It is a good idea to rename your current directory to gnupg-$curr_ver now.
|
1998-01-27 20:48:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Prereq: $prev_ver
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
sed -ne '/^diff.*VERSION/,/^+[0-9][0-9]*/ p' $tmp_name >> $diff_name
|
1998-02-13 20:58:50 +00:00
|
|
|
echo >> $diff_name
|
1998-01-27 20:48:42 +00:00
|
|
|
sed -e '/^diff.*VERSION/,/^+[0-9][0-9]*/ d' $tmp_name >> $diff_name
|
|
|
|
|
|
|
|
rm $tmp_name
|
|
|
|
|
|
|
|
echo "Compressing patch file"
|
|
|
|
gzip -9 $diff_name
|
|
|
|
|
|
|
|
echo "Checking patch file"
|
1998-02-24 18:50:46 +00:00
|
|
|
cd gnupg-$prev_ver
|
1998-02-13 20:58:50 +00:00
|
|
|
zcat ../$diff_name.gz | patch -s -p1
|
1998-01-27 20:48:42 +00:00
|
|
|
rm $(find . -name "*.orig")
|
|
|
|
cd ..
|
|
|
|
|
1998-02-24 18:50:46 +00:00
|
|
|
if ! diff -urN "gnupg-$prev_ver/" "gnupg-$curr_ver/" >/dev/null ; then
|
1998-01-27 20:48:42 +00:00
|
|
|
echo "compare failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "cleaning up"
|
|
|
|
|
1998-02-24 18:50:46 +00:00
|
|
|
rm -rf "gnupg-$curr_ver"
|
|
|
|
rm -rf "gnupg-$prev_ver"
|
1998-01-27 20:48:42 +00:00
|
|
|
|
|
|
|
echo "Patch file $diff_name.gz is good."
|
|
|
|
|
|
|
|
|
|
|
|
|