|
1
by Kees Cook
initial re-check-in |
1 |
#!/bin/bash -e
|
2 |
#
|
|
3 |
# Copyright 2007 (C) Jamie Strandboge <jamie@strandboge.com>
|
|
4 |
# License: GPLv2
|
|
5 |
#
|
|
6 |
# apt-get install apt-utils moreutils
|
|
7 |
||
8 |
ustconf="$HOME/.ubuntu-security-tools.conf" |
|
9 |
if [ -s "$ustconf" ]; then |
|
10 |
. "$ustconf"
|
|
11 |
else
|
|
12 |
echo "Could not find '$ustconf'" |
|
13 |
exit 1
|
|
14 |
fi
|
|
15 |
||
16 |
#
|
|
17 |
# CONFIGURATION
|
|
18 |
#
|
|
19 |
||
20 |
# where this repository is on the internet
|
|
21 |
url="$package_tools_repo_url" |
|
22 |
||
23 |
# where this repository is on the system
|
|
24 |
base="$package_tools_repo_base" |
|
25 |
||
26 |
# these can be whatever you want, and help users know about your repository
|
|
27 |
origin="$package_tools_name" |
|
28 |
label="$origin Packages" |
|
29 |
||
30 |
#
|
|
31 |
# END CONFIGURATION
|
|
32 |
#
|
|
33 |
||
34 |
||
35 |
function update_repo { |
|
36 |
apt-ftparchive sources "$1" | tee "$1"/Sources | gzip -9 > "$1"/Sources.gz |
|
37 |
apt-ftparchive packages "$1" | tee "$1"/Packages | gzip -9 > "$1"/Packages.gz |
|
38 |
apt-ftparchive -o"APT::FTPArchive::Release::Origin=$origin" -o"APT::FTPArchive::Release::Label=$label" -o"APT::FTPArchive::Release::Codename=$1" release "$1" | sponge "$1"/Release |
|
39 |
rm -f "$1"/Release.gpg ; gpg -abs -o "$1"/Release.gpg "$1"/Release |
|
40 |
||
41 |
echo "--" |
|
42 |
echo "${base}/$1 updated" |
|
43 |
echo "" |
|
44 |
echo "Use:" |
|
45 |
echo " deb $url/ $1/" |
|
46 |
echo " deb-src $url/ $1/" |
|
47 |
echo "--" |
|
48 |
}
|
|
49 |
||
50 |
#
|
|
51 |
# MAIN
|
|
52 |
#
|
|
53 |
test -z "$1" && { |
|
54 |
echo "Need to specify a directory" 2>&1 |
|
55 |
exit 1
|
|
56 |
}
|
|
57 |
||
58 |
repo="$1" |
|
59 |
cd "$base" |
|
60 |
mkdir -p "$repo"
|
|
61 |
||
62 |
update_repo "$repo"
|
|
63 |
||
64 |
exit 0
|