6
echo "ERROR: not called with \$(CURDIR) parameter" >&2
11
VERSION="$(dpkg-parsechangelog -l${CURDIR}/debian/changelog | sed -ne 's,^Version: *\([0-9]*:\)\?\(.*\)$,\2,p')"
12
DEB_VER="$(echo ${VERSION} | sed 's,\-[0-9a-z\~\.]*,,')"
13
UP_VER="$(echo ${DEB_VER} | sed 's,\~,\-,g')"
14
UP_VER_TAG="hostap_$(echo $UP_VER | sed -e 's,\.,_,g' -e 's,\-,_,g')"
16
# write to ../tarballs/, if it exists - ../ otherwise
17
if [ -d "${CURDIR}/../tarballs" ]; then
18
ORIG_TARBALL="${CURDIR}/../tarballs/wpa_${DEB_VER}.orig.tar.gz"
20
ORIG_TARBALL="${CURDIR}/../wpa_${DEB_VER}.orig.tar.gz"
23
# don't overwrite existing tarballs
24
if [ -e "${ORIG_TARBALL}" ]; then
25
echo "ERROR: don't overwrite existing ${ORIG_TARBALL}" >&2
29
TEMP_SOURCE="$(mktemp -d --tmpdir wpa-orig-source.XXXXXXXXXX)"
30
if [ "$?" -ne 0 ] || [ -z "${TEMP_SOURCE}" ] || [ ! -d "${TEMP_SOURCE}" ]; then
31
echo "ERROR: failed to create temporary working directory" >&2
35
# clone upstream git repository
36
git clone git://w1.fi/srv/git/hostap-1.git "${TEMP_SOURCE}"
37
if [ "$?" -ne 0 ] || [ ! -d "${TEMP_SOURCE}" ]; then
38
echo "ERROR: cloning git://w1.fi/srv/git/hostap-1.git failed" >&2
39
rm -rf "${TEMP_SOURCE}"
43
# create new usptream tarball
44
cd "${TEMP_SOURCE}" && \
47
--prefix="wpa-${UP_VER}/" \
49
README COPYING patches src wpa_supplicant hostapd | \
50
gzip -c9 > "${ORIG_TARBALL}"
51
if [ "$?" -ne 0 ] || [ ! -e "${ORIG_TARBALL}" ]; then
52
echo "ERROR: failure to create ${ORIG_TARBALL}" >&2
53
rm -rf "${TEMP_SOURCE}"
56
echo "SUCCESS: New upstream tarball has been saved at ${ORIG_TARBALL}"
57
rm -rf "${TEMP_SOURCE}"