aboutsummaryrefslogtreecommitdiff
path: root/debianify-srcdir
blob: 3688d3f09f55a5ca7ffee0682fc7c064f101e978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

set -e
set -x

DESTDIR="$1"
TMPDIR="$(mktemp -d)"
TMPDIRDEB="${TMPDIR}/$(basename ${DESTDIR})"

if [ "x${DESTDIR}" = "x" ]; then
	echo "usage: $0 [DESTDIR]" >&2
	exit 1
fi

if [ -d "${DESTDIR}/debian" ]; then
	cp -rfv "${DESTDIR}" "${TMPDIRDEB}"
	rm -rf "${TMPDIRDEB}/.git*"
	tar -czvf "${DESTDIR}.orig.tar.gz" -C "${TMPDIR}" "$(basename ${DESTDIR})"
else
	echo "$0: ${DESTDIR}/debian does not exist!" >&2
	exit 2
fi