forked from SteveAyre/mysql-cluster
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen_patch
executable file
·31 lines (25 loc) · 875 Bytes
/
gen_patch
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
#!/bin/sh -e
PACKAGE_VERSION=`dpkg-parsechangelog | grep ^Version: | cut -d\ -f2`
VERSION=`echo $PACKAGE_VERSION | cut -d- -f1`
VERSION_MAJOR=`echo $VERSION | cut -d. -f1-2`
TARBALL=.mysql-cluster-${VERSION}.tar.gz
URL=http://dev.mysql.com/get/Downloads/MySQL-Cluster-${VERSION_MAJOR}/mysql-cluster-gpl-${VERSION}.tar.gz/from/http://www.mirrorservice.org/sites/ftp.mysql.com/
DIR=mysql-cluster-${VERSION}
ORIG_DIR=${DIR}.orig
# Download original source code
if [ ! -f ${TARBALL} ]
then
wget -O ${TARBALL} ${URL}
fi
# Extract archive, add debian files
rm -rf ${ORIG_DIR} ${DIR}
mkdir ${ORIG_DIR}
tar -C ${ORIG_DIR} --strip-components=1 -zxf ${TARBALL}
cp -arv ${ORIG_DIR} ${DIR}
cp -arv debian ${DIR}
# Generate diff
set -e
diff -urNad ${ORIG_DIR} ${DIR} | gzip -9 > mysql-cluster-${VERSION_MAJOR}_${PACKAGE_VERSION}.diff.gz
set +e
# Cleanup
rm -rf ${ORIG_DIR} ${DIR}