Init the repo as shared.
[dcp.git] / dcp-update-apt
... / ...
CommitLineData
1#!/bin/sh
2
3set -e
4
5usage() {
6 echo "usage: dcp-update-apt PACKAGE"
7}
8
9getaptsrc() {
10 mkdir "apt-tmp"
11 (cd "apt-tmp"; apt-get source "$1") || false
12
13 sdir=
14 for f in "apt-tmp"/*; do
15 if [ -d "$f" ]; then
16 if [ -z "$sdir" ]; then
17 sdir="$f"
18 else
19 echo "dcp-update-apt: got more than one directory from apt-get; cannot continue" >&2
20 exit 1
21 fi
22 fi
23 done
24 if [ -z "$sdir" ]; then
25 echo "dcp-update-apt: could not find any source directory" >&2
26 exit 1
27 fi
28 mv "$sdir" "src"
29 rm -rf "apt-tmp"
30
31 git add src
32}
33
34if [ $# -lt 1 ]; then
35 usage >&2
36 exit 1
37fi
38
39git rm --quiet -r src
40getaptsrc "$1"
41git commit -q -m "Updated from upstream" || true