Add zip support.

This commit is contained in:
Jan Vidar Krey 2009-03-16 19:02:47 +01:00
parent 81eddd4bcf
commit 7dc88bd23f

View File

@ -8,8 +8,14 @@ fi
if [ "${HOST_SYSTEM}" = "mingw32_nt-5.1" ]; then if [ "${HOST_SYSTEM}" = "mingw32_nt-5.1" ]; then
HOST_SYSTEM=win32 HOST_SYSTEM=win32
BINARY=uhub.exe
WANTZIP=1
else
WANTZIP=0
BINARY=uhub
fi fi
VERSION=`grep define\ VERSION version.h | cut -f 3 -d " " | tr -d [=\"=]` VERSION=`grep define\ VERSION version.h | cut -f 3 -d " " | tr -d [=\"=]`
SNAPSHOT=`date '+%Y%m%d'` SNAPSHOT=`date '+%Y%m%d'`
PACKAGE=uhub-${VERSION} PACKAGE=uhub-${VERSION}
@ -24,7 +30,27 @@ function export_source_directory() {
if [ -d ${PACKAGE} ]; then if [ -d ${PACKAGE} ]; then
rm -Rf ${PACKAGE}; rm -Rf ${PACKAGE};
fi fi
if [ ! -d .git ]; then
echo "No git repo found in `dirname $0`"
exit 1
fi
git archive --format=tar --prefix=${PACKAGE}/ HEAD | tar x git archive --format=tar --prefix=${PACKAGE}/ HEAD | tar x
if [ ! -d ${PACKAGE} ]; then
echo "Something went wrong while exporting the repo."
exit 1
fi
}
function package_zips()
{
tar cf $1.tar $2
gzip -c -9 $1.tar > $1.tar.gz
bzip2 -c -9 $1.tar > $1.tar.bz2
rm -f $1.tar
zip -q -9 -r $1.zip $2
} }
function export_sources() function export_sources()
@ -33,13 +59,9 @@ function export_sources()
make autotest.c && cp autotest.c ${PACKAGE}/autotest.c make autotest.c && cp autotest.c ${PACKAGE}/autotest.c
rm -Rf ${PACKAGE}/admin rm -Rf ${PACKAGE}/admin
tar cf ${PACKAGE_SRC}.tar ${PACKAGE} package_zips ${PACKAGE_SRC} ${PACKAGE}
gzip -c -9 ${PACKAGE_SRC}.tar > ${PACKAGE_SRC}.tar.gz
bzip2 -c -9 ${PACKAGE_SRC}.tar > ${PACKAGE_SRC}.tar.bz2
rm -f ${PACKAGE_SRC}.tar
rm -Rf ${PACKAGE}; rm -Rf ${PACKAGE};
cp ChangeLog ChangeLog-${VERSION} cp ChangeLog ChangeLog-${VERSION}
} }
@ -57,19 +79,15 @@ function export_binaries()
make make
if [ -x uhub ]; then if [ -x ${BINARY} ]; then
cp uhub ${PACKAGE} cp ${BINARY} ${PACKAGE}
elif [ -x uhub.exe ]; then
cp uhub.exe ${PACKAGE}
else else
echo "No binary found!" echo "No binary found!"
exit 1 exit 1
fi fi
tar cf ${PACKAGE_BIN}.tar ${PACKAGE} package_zips ${PACKAGE_BIN} ${PACKAGE}
gzip -c -9 ${PACKAGE_BIN}.tar > ${PACKAGE_BIN}.tar.gz
bzip2 -c -9 ${PACKAGE_BIN}.tar > ${PACKAGE_BIN}.tar.bz2
rm -f ${PACKAGE_BIN}.tar
rm -Rf ${PACKAGE}; rm -Rf ${PACKAGE};
} }