]> piware.de Git - bin.git/blob - uup
initial checkin
[bin.git] / uup
1 #!/bin/bash -e
2
3 LOGIN=pitti
4 HOST=chinstrap.ubuntu.com
5
6 if [ -z "$1" ]; then
7     echo "Usage: $0 <changes file>"
8     exit 0
9 fi
10
11 # open changes file
12 exec 3<$1
13
14 # read until Files: section
15 while true; do
16     read -u 3 line
17     if [ "$line" = "Files:" ]; then
18         break
19     fi
20 done
21
22 # read files
23 count=0
24 while true; do
25     read -u 3 md5sum size section priority fname
26     if [ -z "$fname" ]; then break; fi
27     files[$count]="$fname"
28     ((count=count+1))
29 done
30
31 if [ $count = 0 ]; then
32     echo "No files found. Exiting."
33     exit -1
34 fi
35
36 echo "Uploading files to $HOST..."
37 echo ${files[*]} $1
38 scp ${files[*]} $1 $LOGIN@$HOST:
39
40 if grep -q '^Distribution:.*security' "$1"; then
41     QUEUE=security
42 else
43     QUEUE=ubuntu
44 fi
45
46 echo "dput'ing to queue $QUEUE..."
47 ssh $LOGIN@$HOST "dput -u $QUEUE $1 && rm ${files[*]} $1"