chiark / gitweb /
Create import script.
[mup] / import
CommitLineData
cdb3c088
MW
1#! /bin/sh
2
3set -e
4tarball=${1?tarball}
5case $tarball in /*);; *) tarball=`pwd`/$tarball;; esac
6tmp=${TMPDIR-/tmp}/mup-$$
7mkdir $tmp
8: ${GIT_DIR=`git rev-parse --git-dir`}
9case $GIT_DIR in /*);; *) GIT_DIR=`pwd`/$GIT_DIR;; esac
10export GIT_DIR
11trap 'cd /; rm -rf $tmp' 0
12cd $tmp
13GIT_INDEX_FILE=$tmp/index
14export GIT_INDEX_FILE
15
16mkdir unpack; cd unpack
17tar xfz $tarball
18mupdir=`ls -d mup-*`
19version=${mupdir#mup-}
20cp $tarball mup_$version.orig.tar.gz
21mv $mupdir mup
22echo $version
23
24find . -type f -print0 | git update-index --add -z --stdin
25tree=$(git write-tree)
26if [ -f $GIT_DIR/refs/heads/arkkra ]; then
27 pp="-p $(cat $GIT_DIR/refs/heads/arkkra)"
28else
29 pp=""
30fi
31commit=$(
32 echo "Import upstream version $version." |
33 git commit-tree $tree $pp
34)
35git update-ref refs/heads/arkkra $commit
36git update-ref refs/tags/$version $commit
37echo "Imported Mup $version: $commit"