summaryrefslogtreecommitdiffstats
path: root/debian/dfsg-repack
blob: be1873973b9088aa0a23d0b711a4382bb7b6715c (plain)
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
31
32
33
#!/bin/sh

set -e

# This script removes non-dfsg files from upstream tarball.
# Requires package 'zip' to be installed

ORIG_TARBALL=$1
if [ -z $ORIG_TARBALL ]; then
	echo "Usage: $0 <path to tarball>"
	exit 1
fi

ZIP_FILE=zlibrary/text/data/hyphenationPatterns.zip
FORMAT_DATA_DIR=fbreader/data/formats

REPACK_DIR=./tmp-fbreader-repack
mkdir -p $REPACK_DIR

tar -C $REPACK_DIR -xzf $ORIG_TARBALL
UPSTREAM_DIR=`ls -1 $REPACK_DIR/`; \
(cd $REPACK_DIR && \
	zip -d $UPSTREAM_DIR/$ZIP_FILE "el.pattern" "fi.pattern" "tr.pattern"; \
	rm $UPSTREAM_DIR/$FORMAT_DATA_DIR/xhtml/*
	rm $UPSTREAM_DIR/$FORMAT_DATA_DIR/docbook/*

	mv $UPSTREAM_DIR ${UPSTREAM_DIR}.orig;
)

tar -C $REPACK_DIR -cf - ${UPSTREAM_DIR}.orig |
	gzip --best -c > $ORIG_TARBALL+dfsg

rm -r $REPACK_DIR