-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgen-packages
executable file
·43 lines (36 loc) · 1.09 KB
/
gen-packages
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
# Usage: gen-packages
# Scans the repository or a checkout of it and generates a file named
# "packages" in the current directory containing a table of source
# package names and their corresponding directories.
set -e
die() {
echo "$@" >&2
exit 1
}
usage() {
die "gen-packages"
}
rm -f packages.unsorted
GITHUB_PREFIX="https://raw.github.com/mit-athena"
# Change this once submodules are working
REPOS=$(ssh athenasnap@git.mit.edu "ls -d /git/athena/*.git")
for repo in $REPOS; do
echo "Looking at $repo"
repo_base=${repo%.git}
repo_base=${repo_base#/git/athena/}
URI="${GITHUB_PREFIX}/${repo_base}/master/debian/control"
name=$(curl -sf "$URI" | sed -ne 's/^Source: \(.*\)$/\1/p')
if [ -n "$name" ]; then
printf "%-35s %s\n" $name $repo >> packages.unsorted
continue
fi
name=$(curl -sf "${URI}.in" | sed -ne 's/^Source: \(.*\)$/\1/p')
if [ -n "$name" ]; then
printf "%-35s %s\n" $name $repo >> packages.unsorted
continue
fi
echo "** Couldn't find a control or control.in file! Skipping..."
done
sort -u packages.unsorted > packages
rm -f packages.unsorted