#!/bin/bash repository="git@github.com:lxde/obconf-qt" target_dir="snapshot" ls | grep -v "debian" | xargs rm -r rm -rf .pc if [ -f debian/commit ]; then source debian/commit [ ! -z "${branch}" ] && echo "branch: ${branch}" [ ! -z "${commit}" ] && echo "commit: ${commit}" [ ! -z "${target_dir}" ] && echo "target_dir: ${target_dir}" fi snapdir=$(mktemp -d) echo "$snapdir" pushd "$snapdir" echo "git clone ${branch} ${repository} ${target_dir}" git clone ${branch} ${repository} ${target_dir} pushd snapshot [ ! -z "${commit}" ] && git reset --hard "${commit}" description=$(git describe --tags) rm -rf .git* popd tar cfvJ snapshot.orig.tar.xz snapshot popd tar xf "$snapdir/snapshot.orig.tar.xz" --strip-components 1 dch "New snapshot: $description" rm -rfv "$snapdir"