change URL at comments
[tools/sbs.git] / make-offline-mirror.sh
1 #!/bin/sh
2
3 die()
4 {
5         echo "$CE$N: fatal error: $*$CN" >&2
6         exit 1
7 }
8
9 # enable colors only on terminal devices
10 TPUT="`which tput`"
11 if test -t 0 -a -t 1 -a -n "$TPUT"
12 then
13     CI="`$TPUT setf 6 || true`"
14     CE="`$TPUT setf 4 || true`"
15     CX="`$TPUT setf 2 || true`"
16     CN="`$TPUT sgr0 || true`"
17 else
18     CI=''
19     CE=''
20     CX=''
21     CN=''
22 fi
23
24 # default name of the repository
25 if [[ $1 ]]
26 then
27         dir="$1"
28 else
29         dir="repo"
30 fi
31
32 # can't do any mirroring without reprepro
33 rpp=`which reprepro`
34 if [ ! "$rpp" ]
35 then
36         die "reprepro is not installed. (try: sudo aptitude install reprepro)"
37 fi
38
39 # get the user's Single ID
40 if ! email="`git config --global --get user.email`" ||
41    ! echo $email | grep -q '.com$'
42 then
43     die "Please setup up your email address first using:
44     git config --global user.email your_id@your_company.com"
45 fi
46 SINGLE_ID="`echo \"$email\" | cut -d@ -f1`"
47
48 # mirror URL base
49 base="https://download.tizen.org/releases/1.0"
50
51 # mirror the armel repository
52 #mkdir -p "$dir/apt.sbs/armel/conf"
53 #cat > "$dir/apt.sbs/armel/conf/distributions" <<EOF
54 #Codename: slp2-target
55 #Origin: slp
56 #Suite: unstable
57 #Components: main contrib non-free
58 #Architectures: armel
59 #Update: slp2-target-update
60 #EOF
61
62 #cat > "$dir/apt.sbs/armel/conf/updates" <<EOF
63 #Name: slp2-target-update
64 #Method: $base/apt.sbs/armel
65 #EOF
66
67 # mirror the i386 repository
68 mkdir -p "$dir/apt.sbs/i386/conf"
69 cat > "$dir/apt.sbs/i386/conf/distributions" <<EOF
70 Codename: slp2-target
71 Origin: slp
72 Suite: unstable
73 Components: main contrib non-free
74 Architectures: i386
75 Update: slp2-target-update
76 EOF
77
78 cat > "$dir/apt.sbs/i386/conf/updates" <<EOF
79 Name: slp2-target-update
80 Method: $base/apt.sbs/i386
81 EOF
82
83 # mirror the tools repository
84 mkdir -p "$dir/apt.sbs/tools/conf"
85 cat > "$dir/apt.sbs/tools/conf/distributions" <<EOF
86 Codename: slp2-tools
87 Origin: slp
88 Suite: unstable
89 Components: main contrib non-free
90 Architectures: i386
91 Update: slp2-tools-update
92 EOF
93
94 cat > "$dir/apt.sbs/tools/conf/updates" <<EOF
95 Name: slp2-tools-update
96 Method: $base/apt.sbs/tools
97 EOF
98
99 # mirror the debian/squeeze repository
100 mkdir -p "$dir/mirror/conf"
101 cat > "$dir/mirror/conf/distributions" <<EOF
102 Codename: squeeze
103 Architectures: i386
104 Description: Debian Squeeze
105 Components: main contrib non-free
106 Update: debian-squeeze-update
107 EOF
108
109 cat > "$dir/mirror/conf/updates" <<EOF
110 Name: debian-squeeze-update
111 Architectures: i386
112 Method: $base/mirror
113 EOF
114 # FIXME: filter the list of packages to reduce repository size
115 #FilterList: purge mirror.packages
116
117 # do the mirroring
118 #echo "$CI""Mirroring armel""$CN"
119 #(cd "$dir/apt.sbs/armel" && "$rpp" update)
120 echo "$CI""Mirroring tools""$CN"
121 (cd "$dir/apt.sbs/tools" && "$rpp" update)
122 echo "$CI""Mirroring i386""$CN"
123 (cd "$dir/apt.sbs/i386" && "$rpp" update)
124 echo "$CI""Mirroring Debian""$CN"
125 (cd "$dir/mirror" && "$rpp" update)