Update Debian page to include js sources.list selector
Sebastian Hahn

Sebastian Hahn commited on 2015-02-11 12:04:15
Zeige 1 geänderte Dateien mit 231 Einfügungen und 7 Löschungen.


Implements ticket 3985
... ...
@@ -3,6 +3,165 @@
3 3
 # Translation-Priority: 3-low
4 4
 
5 5
 #include "head.wmi" TITLE="Tor Project: Debian/Ubuntu Instructions" CHARSET="UTF-8"
6
+
7
+<script>
8
+<!--
9
+// This code is based on the http://mozilla.debian.net sources.list
10
+// generator as originally written by Mike Hommey. It is licensed under
11
+// the terms of the GNU GPLv2, http://www.gnu.org/licenses/gpl-2.0.html.
12
+var sources = {};
13
+var software = {
14
+'tor': { 'experimental-0.2.6.x': { 'squeeze': [ 'squeeze' ],
15
+                     'wheezy':  [ 'wheezy' ],
16
+                     'jessie':  [ 'jessie' ],
17
+                     'sid':     [ 'sid' ],
18
+                     'lucid':   [ 'lucid'],
19
+                     'precise': [ 'precise'],
20
+                     'saucy':   [ 'saucy'],
21
+                     'trusty':  [ 'trusty'],
22
+                     'utopic':  [ 'utopic'] },
23
+         'stable':    { 'squeeze': [ 'squeeze' ],
24
+                     'wheezy':  [ 'wheezy' ],
25
+                     'jessie':  [ 'jessie' ],
26
+                     'sid':     [ 'sid' ],
27
+                     'lucid':   [ 'lucid'],
28
+                     'precise': [ 'precise'],
29
+                     'saucy':   [ 'saucy'],
30
+                     'trusty':  [ 'trusty'],
31
+                     'utopic':  [ 'utopic'] },
32
+       },
33
+'tor (from source)': { 'experimental-0.2.6.x': { 'squeeze': [ 'squeeze' ],
34
+                     'wheezy':  [ 'wheezy' ],
35
+                     'jessie':  [ 'jessie' ],
36
+                     'sid':     [ 'sid' ],
37
+                     'lucid':   [ 'lucid'],
38
+                     'precise': [ 'precise'],
39
+                     'saucy':   [ 'saucy'],
40
+                     'trusty':  [ 'trusty'],
41
+                     'utopic':  [ 'utopic'] },
42
+         'stable':    { 'squeeze': [ 'squeeze' ],
43
+                     'wheezy':  [ 'wheezy' ],
44
+                     'jessie':  [ 'jessie' ],
45
+                     'sid':     [ 'sid' ],
46
+                     'lucid':   [ 'lucid'],
47
+                     'precise': [ 'precise'],
48
+                     'saucy':   [ 'saucy'],
49
+                     'trusty':  [ 'trusty'],
50
+                     'utopic':  [ 'utopic'] },
51
+       },
52
+};
53
+
54
+function init() {
55
+    pkg = document.getElementById('package');
56
+    for (soft in software) {
57
+        if (soft != pkg.value) {
58
+            option = document.createElement('option');
59
+            option.value = soft;
60
+            option.appendChild(document.createTextNode(soft.charAt(0).toUpperCase() + soft.slice(1)));
61
+            pkg.appendChild(option);
62
+        }
63
+    }
64
+
65
+    apt_get = document.getElementById('apt-get');
66
+    para = document.createElement('p');
67
+    para.id = 'sorry';
68
+    para.style.display = 'none';
69
+    apt_get.parentNode.insertBefore(para, apt_get);
70
+    para.appendChild(document.createTextNode("Sorry, this version is not available.\n"));
71
+
72
+    document.getElementById('selector').style.display = 'block';
73
+
74
+    update();
75
+}
76
+
77
+function replaceText(src, txt) {
78
+    while (src.firstChild)
79
+        src.removeChild(src.firstChild);
80
+    src.appendChild(document.createTextNode(txt));
81
+}
82
+
83
+function update() {
84
+    pkg = document.getElementById('package');
85
+    ver = document.getElementById('version');
86
+    package = pkg.value;
87
+    version = ver.value;
88
+    distrib = document.getElementById('distrib').value;
89
+    if (package != pkg.prev) {
90
+        while (ver.firstChild)
91
+            ver.removeChild(ver.firstChild);
92
+        var selected;
93
+        for (version in software[package]) {
94
+            option = document.createElement('option');
95
+            if (version[0] == '_') {
96
+                version = version.slice(1);
97
+                selected = version;
98
+            }
99
+            option.appendChild(document.createTextNode(version));
100
+            option.value = version = version.replace(/ \(.*\)/,'');
101
+//alert(version);
102
+            ver.appendChild(option);
103
+        }
104
+        ver.value = version = selected || version;
105
+        pkg.prev = package
106
+    }
107
+    try {
108
+        keys = software[package][version][distrib];
109
+    } catch (e) {
110
+        try {
111
+            keys = software[package]['_' + version][distrib];
112
+        } catch (e) { };
113
+    }
114
+    src = document.getElementById('sources');
115
+    txt = '';
116
+    need_signed = false;
117
+    source_install = false;
118
+    target = '';
119
+    for (i = 0; keys && (i < keys.length); i++) {
120
+//alert(keys[i]);
121
+        if (keys[i] in sources) {
122
+            txt += sources[keys[i]];
123
+            target = keys[i];
124
+        } else {
125
+            txt += "deb";
126
+            if (package.slice(-7, -1) == 'source') {
127
+                txt += '-src';
128
+                package = package.split(' ')[0];
129
+                source_install = true
130
+            }
131
+            txt += " http://deb.torproject.org/torproject.org";
132
+            txt += " ";
133
+            if (version != 'stable') {
134
+                txt += package;
135
+                txt += "-";
136
+                txt += version;
137
+                txt += "-";
138
+            }
139
+            txt += keys[i];
140
+            txt += " main";
141
+            need_signed = true;
142
+            target = keys[i];
143
+        }
144
+        txt += "\n";
145
+    }
146
+    replaceText(src, txt);
147
+    //document.getElementById('signed').style.display = need_signed ? 'block' : 'none';
148
+    document.getElementById('regular-install').style.display = source_install ? 'none' : 'block';
149
+    document.getElementById('source-install').style.display = source_install ? 'block' : 'none';
150
+    document.getElementById('source-install2').style.display = source_install ? 'block' : 'none';
151
+    //replaceText(document.getElementById('apt-target'), (keys && keys.length && target != distrib && target != distrib + '-security') ? ' -t ' + target : '');
152
+    replaceText(document.getElementById('apt-package'), package);
153
+    document.getElementById('apt-source').style.display = (keys && keys.length) ? 'block' : 'none';
154
+    document.getElementById('apt-get').style.display = keys ? 'block' : 'none';
155
+    document.getElementById('sorry').style.display = keys ? 'none' : 'block';
156
+}
157
+
158
+window.onload = init;
159
+
160
+-->
161
+</script>
162
+
163
+
164
+
6 165
 <div id="content" class="clearfix">
7 166
   <div id="breadcrumbs">
8 167
     <a href="<page index>">Home &raquo; </a>
... ...
@@ -16,8 +175,8 @@ Debian sid, or Debian testing</a></h2>
16 175
 <br />
17 176
 
18 177
 <p>
19
-If you're using Debian, just run<br />
20
-<tt>apt-get install tor</tt>
178
+If you're using Debian, just run
179
+</blockquote><pre>  apt-get install tor </pre></blockquote>
21 180
 as root.
22 181
 </p>
23 182
 
... ...
@@ -61,7 +220,73 @@ Tor. First, you need to figure out the name of your distribution. A
61 220
 quick command to run is <tt>lsb_release -c</tt> or <tt>cat /etc/debian_version</tt>.
62 221
 If in doubt about your Debian version, check <a href="http://www.debian.org/releases/">the Debian website</a>.
63 222
 For Ubuntu, ask <a href="https://en.wikipedia.org/wiki/List_of_Ubuntu_releases#Table_of_versions">Wikipedia</a>.
223
+</p>
224
+
225
+<div id="selector" style="display: none;">
226
+<blockquote>
227
+I'm running
228
+<select id="distrib" onchange="update()">
229
+<option value="squeeze">Debian oldstable (Squeeze)</option>
230
+<option value="wheezy" selected="selected">Debian stable (Wheezy)</option>
231
+<option value="jessie">Debian testing (Jessie)</option>
232
+<option value="sid">Debian sid</option>
233
+<option value="lucid">Ubuntu Lucid Lynx</option>
234
+<option value="precise">Ubuntu Precise Pangolin</option>
235
+<option value="saucy">Ubuntu Saucy Salamander</option>
236
+<option value="trusty">Ubuntu Trusty Tahr</option>
237
+<option value="utopic">Ubuntu Utopic Unicorn</option>
238
+</select>
239
+and installing
240
+<select id="package" onchange="update()"></select>
241
+version
242
+<select id="version" onchange="update()"></select>
243
+</blockquote>
244
+
245
+
246
+<div id="apt-source">
247
+<p>You need to add the following entry in <code>/etc/apt/sources.list</code> or a new file in <code>/etc/apt/sources.list.d/</code>:</p>
248
+
249
+<blockquote><pre id="sources">deb http://deb.torproject.org/torproject.org wheezy main
250
+</pre></blockquote>
251
+</div>
64 252
 
253
+<div id="sig">
254
+<p>Then add the gpg key used to sign the packages by running the following commands at your command prompt:</p>
255
+<blockquote><pre>
256
+gpg --keyserver keys.gnupg.net --recv 886DDD89
257
+gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
258
+</pre></blockquote>
259
+</div>
260
+
261
+
262
+<div id="apt-get">
263
+<p>You can install it with the following commands:</p>
264
+<blockquote><pre>$ apt-get update
265
+<span id="regular-install">$ apt-get install <span id="apt-package">tor</span> deb.torproject.org-keyring</span>
266
+<span id="source-install">$ apt-get install build-essential fakeroot devscripts
267
+$ apt-get build-dep tor deb.torproject.org-keyring</span></pre></blockquote>
268
+
269
+<div id="source-install2">
270
+<p>
271
+Then you can build Tor in ~/debian-packages:
272
+</p>
273
+<blockquote><pre>
274
+$ mkdir ~/debian-packages; cd ~/debian-packages
275
+$ apt-get source tor
276
+$ cd tor-*
277
+$ debuild -rfakeroot -uc -us
278
+$ cd ..
279
+</pre></blockquote>
280
+<p>Now you can install the new package:</p>
281
+<blockquote><pre>
282
+$ sudo dpkg -i tor_*.deb
283
+</pre></blockquote>
284
+</div>
285
+</div>
286
+</div>
287
+
288
+<noscript>
289
+<p>
65 290
 Then add this line to your
66 291
 <tt>/etc/apt/sources.list</tt>
67 292
 file:<br />
... ...
@@ -103,12 +328,15 @@ apt-get install tor
103 328
 </pre>
104 329
 </p>
105 330
 
331
+</noscript>
332
+
106 333
 <p>
107 334
 Now Tor is installed and running. Move on to <a href="<page
108 335
 docs/tor-doc-unix>#using">step two</a> of the "Tor on Linux/Unix"
109 336
 instructions.
110 337
 </p>
111 338
 
339
+<noscript>
112 340
 <p style="font-size: small">
113 341
 The DNS name <code>deb.torproject.org</code> is actually a set of independent
114 342
 servers in a DNS round robin configuration.  If you for some reason cannot
... ...
@@ -200,11 +428,7 @@ Now Tor is installed and running. Move on to <a href="<page
200 428
 docs/tor-doc-unix>#using">step two</a> of the "Tor on Linux/Unix"
201 429
 instructions.
202 430
 </p>
203
-
204
-<hr />
205
-
206
-<p>If you have suggestions for improving this document, please <a
207
-href="<page about/contact>">send them to us</a>. Thanks!</p>
431
+</noscript>
208 432
 
209 433
 <!-- END MAIN COL -->
210 434
   </div>
211 435