contrib/wesnoth/pre-install

50 lines
1.5 KiB
Plaintext
Raw Normal View History

2008-09-11 11:48:48 +02:00
#!/bin/bash
2008-04-06 08:44:42 +02:00
. /etc/pkgmk.conf
. Pkgfile
2008-09-11 11:48:48 +02:00
OLD_VERSION='1.4.4'
2008-04-06 08:44:42 +02:00
[ -z "$PKGMK_WORK_DIR" ] && PKGMK_WORK_DIR="$PWD/work"
[ -z "$PKGMK_SOURCE_DIR" ] && PKGMK_SOURCE_DIR="$PWD"
2008-05-08 10:56:51 +02:00
if [ -e "$PKGMK_SOURCE_DIR/wesnoth-$version.tar.bz2" ]; then
2008-09-11 11:48:48 +02:00
echo 'You have the latest source file.'
exit
2008-04-06 08:44:42 +02:00
fi
2008-05-08 10:56:51 +02:00
if [ -n "`pkginfo -i | egrep '^xdelta '`" ]; then
if [ -e "$PKGMK_SOURCE_DIR/wesnoth-$OLD_VERSION.tar.bz2" ]; then
2008-04-06 08:44:42 +02:00
2008-05-08 10:56:51 +02:00
if [ ! -e "$PKGMK_WORK_DIR" ]; then
mkdir -p "$PKGMK_WORK_DIR"
fi
cd "$PKGMK_WORK_DIR"
2008-04-06 08:44:42 +02:00
2008-05-08 10:56:51 +02:00
if [ ! -e "$PKGMK_SOURCE_DIR/wesnoth-$OLD_VERSION.tar-wesnoth-$version.tar.xdelta" ]; then
wget http://optusnet.dl.sourceforge.net/sourceforge/wesnoth/wesnoth-$OLD_VERSION.tar-wesnoth-$version.tar.xdelta --directory-prefix=$PKGMK_SOURCE_DIR
fi
2008-04-06 08:44:42 +02:00
2008-05-08 10:56:51 +02:00
cp $PKGMK_SOURCE_DIR/wesnoth-$OLD_VERSION.tar.bz2 .
cp $PKGMK_SOURCE_DIR/wesnoth-$OLD_VERSION.tar-wesnoth-$version.tar.xdelta .
2008-06-09 19:52:15 +02:00
echo -n '[ 33%] Decompressing source, '
2008-05-08 10:56:51 +02:00
bzip2 -d wesnoth-$OLD_VERSION.tar.bz2
2008-06-09 19:52:15 +02:00
echo 'done.'
echo -n '[ 66%] Patching source, '
2008-05-08 10:56:51 +02:00
xdelta patch wesnoth-$OLD_VERSION.tar-wesnoth-$version.tar.xdelta
rm wesnoth-$OLD_VERSION.tar
mv wesnoth-$OLD_VERSION.tar-wesnoth-$version.tar.xdelta $PKGMK_SOURCE_DIR/
2008-06-09 19:52:15 +02:00
echo 'done.'
echo -n '[100%] Compressing patched source, '
2008-05-08 10:56:51 +02:00
bzip2 -9 wesnoth-$version.tar
2008-06-09 19:52:15 +02:00
echo 'done.'
2008-05-08 10:56:51 +02:00
mv wesnoth-$version.tar.bz2 $PKGMK_SOURCE_DIR/
2008-04-06 08:44:42 +02:00
else
2008-06-09 19:52:15 +02:00
echo "'wesnoth-$OLD_VERSION.tar.bz2' not found proceed to run Pkgfile."
exit
2008-04-06 08:44:42 +02:00
fi
else
2008-06-09 19:52:15 +02:00
echo "Warning: 'xdelta' is not installed can not do a incremental update."
2008-04-06 08:44:42 +02:00
fi
# End of file