Bob Mottram vor 8 Jahren
Ursprung
Commit
12d5778ab7
2 geänderte Dateien mit 60 neuen und 38 gelöschten Zeilen
  1. 28
    17
      doc/EN/devguide.org
  2. 32
    21
      website/EN/devguide.html

+ 28
- 17
doc/EN/devguide.org Datei anzeigen

@@ -35,22 +35,25 @@ An example template for an app script is shown below. Copy this and add whatever
35 35
 #!/bin/bash
36 36
 # Copyright (C) Year YourName <YourEmail>
37 37
 #
38
-# This program is free software: you can redistribute it and/or modify
39
-# it under the terms of the GNU Affero General Public License as published by
40
-# the Free Software Foundation, either version 3 of the License, or
41
-# (at your option) any later version.
38
+# This program is free software: you can redistribute it
39
+# and/or modify it under the terms of the GNU Affero General
40
+# Public License as published by the Free Software Foundation,
41
+# either version 3 of the License, or (at your option) any
42
+# later version.
42 43
 #
43 44
 # This program is distributed in the hope that it will be useful,
44 45
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
45 46
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
46 47
 # GNU Affero General Public License for more details.
47 48
 #
48
-# You should have received a copy of the GNU Affero General Public License
49
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
50
-
51
-# 'full' includes your app in the full installation and you can also
52
-# add other variants, separated by spaces. The available variants will
53
-# be detected automatically from the app scripts.
49
+# You should have received a copy of the GNU Affero General
50
+# Public License along with this program.  If not, see
51
+# <http://www.gnu.org/licenses/>.
52
+
53
+# 'full' includes your app in the full installation and you
54
+# can also add other variants, separated by spaces. The
55
+# available variants will be detected automatically from the
56
+# app scripts.
54 57
 VARIANTS='full'
55 58
 
56 59
 SOME_IMPORTANT_CONFIG_VARIABLE='some important value'
@@ -78,7 +81,8 @@ function change_password_myappname {
78 81
 
79 82
 function reconfigure_myappname {
80 83
     echo -n ''
81
-    # Do something to delete existing keys/identity and generate new ones
84
+    # Do something to delete existing keys/identity and
85
+    # generate new ones
82 86
 }
83 87
 
84 88
 function upgrade_myappname {
@@ -95,13 +99,16 @@ function backup_local_myappname {
95 99
     # To backup a directory
96 100
     backup_directory_to_usb $MYAPP_DATA_DIR myappname
97 101
 
98
-    # if you need to backup data within individual user home directories
102
+    # if you need to backup data within individual user
103
+    # home directories
99 104
     for d in /home/*/ ; do
100 105
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
101 106
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
102 107
             echo $"Backing up myappname config for $USERNAME"
103 108
             if [ -d /home/$USERNAME/.config/myappname ]; then
104
-                backup_directory_to_usb /home/$USERNAME/.config/myappname myappname_users/$USERNAME
109
+                backup_directory_to_usb \
110
+                    /home/$USERNAME/.config/myappname \
111
+                    myappname_users/$USERNAME
105 112
             fi
106 113
         fi
107 114
     done
@@ -131,8 +138,10 @@ function restore_local_myappname {
131 138
                 fi
132 139
                 echo $"Restoring Vim config for $USERNAME"
133 140
                 function_check restore_directory_from_usb
134
-                restore_directory_from_usb $temp_restore_dir myappname_users/$USERNAME
135
-                cp -r $temp_restore_dir/home/$USERNAME/.config /home/$USERNAME/
141
+                restore_directory_from_usb $temp_restore_dir \
142
+                                           myappname_users/$USERNAME
143
+                cp -r $temp_restore_dir/home/$USERNAME/.config \
144
+                      /home/$USERNAME/
136 145
                 if [ ! "$?" = "0" ]; then
137 146
                     rm -rf $temp_restore_dir
138 147
                     set_user_permissions
@@ -177,7 +186,8 @@ function install_myappname {
177 186
     create_database myappname "$MYAPPNAME_DB_PASSWORD" $MY_USERNAME
178 187
 
179 188
     # If you need to create an onion address for the app
180
-    MYAPPNAME_ONION_HOSTNAME=$(add_onion_service myappname 80 ${MYAPPNAME_ONION_PORT})
189
+    MYAPPNAME_ONION_HOSTNAME=$(add_onion_service myappname \
190
+                               80 ${MYAPPNAME_ONION_PORT})
181 191
 
182 192
     # Do any other configuration
183 193
     # Here you might use $ONION_ONLY or $SOME_IMPORTANT_CONFIG_VARIABLE
@@ -195,7 +205,8 @@ function install_interactive_myappname {
195 205
     trap "rm -f $data" 0 1 2 5 15
196 206
     dialog --title $"Change your avatar" \
197 207
            --backtitle $"Freedombone Control Panel" \
198
-           --inputbox $"Enter a URL for an image. It should be approximately a square image." 8 75 2>$data
208
+           --inputbox $"Enter a URL for an image. It should be " \
209
+                      $"approximately a square image." 8 75 2>$data
199 210
     sel=$?
200 211
     case $sel in
201 212
         0)

+ 32
- 21
website/EN/devguide.html Datei anzeigen

@@ -3,7 +3,7 @@
3 3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5 5
 <head>
6
-<!-- 2016-10-12 Wed 16:06 -->
6
+<!-- 2016-10-12 Wed 16:59 -->
7 7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8 8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
9 9
 <title></title>
@@ -245,9 +245,9 @@ for the JavaScript code in this tag.
245 245
 
246 246
 <center><h1>Developers Guide</h1></center>
247 247
 
248
-<div id="outline-container-org27d5926" class="outline-2">
249
-<h2 id="org27d5926">Adding extra apps</h2>
250
-<div class="outline-text-2" id="text-org27d5926">
248
+<div id="outline-container-orgacfcf5c" class="outline-2">
249
+<h2 id="orgacfcf5c">Adding extra apps</h2>
250
+<div class="outline-text-2" id="text-orgacfcf5c">
251 251
 <p>
252 252
 Suppose you have some internet application which you want to add to the system. To do this you need to create an app script which tells the system how to install/remove and also backup/restore. On an installed system the app scripts go into the directory:
253 253
 </p>
@@ -278,22 +278,25 @@ An example template for an app script is shown below. Copy this and add whatever
278 278
 <pre class="src src-bash"><span class="org-comment-delimiter">#</span><span class="org-comment">!/bin/</span><span class="org-keyword">bash</span>
279 279
 <span class="org-comment-delimiter"># </span><span class="org-comment">Copyright (C) Year YourName &lt;YourEmail&gt;</span>
280 280
 <span class="org-comment-delimiter">#</span>
281
-<span class="org-comment-delimiter"># </span><span class="org-comment">This program is free software: you can redistribute it and/or modify</span>
282
-<span class="org-comment-delimiter"># </span><span class="org-comment">it under the terms of the GNU Affero General Public License as published by</span>
283
-<span class="org-comment-delimiter"># </span><span class="org-comment">the Free Software Foundation, either version 3 of the License, or</span>
284
-<span class="org-comment-delimiter"># </span><span class="org-comment">(at your option) any later version.</span>
281
+<span class="org-comment-delimiter"># </span><span class="org-comment">This program is free software: you can redistribute it</span>
282
+<span class="org-comment-delimiter"># </span><span class="org-comment">and/or modify it under the terms of the GNU Affero General</span>
283
+<span class="org-comment-delimiter"># </span><span class="org-comment">Public License as published by the Free Software Foundation,</span>
284
+<span class="org-comment-delimiter"># </span><span class="org-comment">either version 3 of the License, or (at your option) any</span>
285
+<span class="org-comment-delimiter"># </span><span class="org-comment">later version.</span>
285 286
 <span class="org-comment-delimiter">#</span>
286 287
 <span class="org-comment-delimiter"># </span><span class="org-comment">This program is distributed in the hope that it will be useful,</span>
287 288
 <span class="org-comment-delimiter"># </span><span class="org-comment">but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
288 289
 <span class="org-comment-delimiter"># </span><span class="org-comment">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
289 290
 <span class="org-comment-delimiter"># </span><span class="org-comment">GNU Affero General Public License for more details.</span>
290 291
 <span class="org-comment-delimiter">#</span>
291
-<span class="org-comment-delimiter"># </span><span class="org-comment">You should have received a copy of the GNU Affero General Public License</span>
292
-<span class="org-comment-delimiter"># </span><span class="org-comment">along with this program.  If not, see <a href="http://www.gnu.org/licenses/">&lt;http://www.gnu.org/licenses/&gt;</a>.</span>
293
-
294
-<span class="org-comment-delimiter"># </span><span class="org-comment">'full' includes your app in the full installation and you can also</span>
295
-<span class="org-comment-delimiter"># </span><span class="org-comment">add other variants, separated by spaces. The available variants will</span>
296
-<span class="org-comment-delimiter"># </span><span class="org-comment">be detected automatically from the app scripts.</span>
292
+<span class="org-comment-delimiter"># </span><span class="org-comment">You should have received a copy of the GNU Affero General</span>
293
+<span class="org-comment-delimiter"># </span><span class="org-comment">Public License along with this program.  If not, see</span>
294
+<span class="org-comment-delimiter"># </span><span class="org-comment"><a href="http://www.gnu.org/licenses/">&lt;http://www.gnu.org/licenses/&gt;</a>.</span>
295
+
296
+<span class="org-comment-delimiter"># </span><span class="org-comment">'full' includes your app in the full installation and you</span>
297
+<span class="org-comment-delimiter"># </span><span class="org-comment">can also add other variants, separated by spaces. The</span>
298
+<span class="org-comment-delimiter"># </span><span class="org-comment">available variants will be detected automatically from the</span>
299
+<span class="org-comment-delimiter"># </span><span class="org-comment">app scripts.</span>
297 300
 <span class="org-variable-name">VARIANTS</span>=<span class="org-string">'full'</span>
298 301
 
299 302
 <span class="org-variable-name">SOME_IMPORTANT_CONFIG_VARIABLE</span>=<span class="org-string">'some important value'</span>
@@ -321,7 +324,8 @@ An example template for an app script is shown below. Copy this and add whatever
321 324
 
322 325
 <span class="org-keyword">function</span> <span class="org-function-name">reconfigure_myappname</span> {
323 326
     <span class="org-builtin">echo</span> -n <span class="org-string">''</span>
324
-    <span class="org-comment-delimiter"># </span><span class="org-comment">Do something to delete existing keys/identity and generate new ones</span>
327
+    <span class="org-comment-delimiter"># </span><span class="org-comment">Do something to delete existing keys/identity and</span>
328
+    <span class="org-comment-delimiter"># </span><span class="org-comment">generate new ones</span>
325 329
 }
326 330
 
327 331
 <span class="org-keyword">function</span> <span class="org-function-name">upgrade_myappname</span> {
@@ -338,13 +342,16 @@ An example template for an app script is shown below. Copy this and add whatever
338 342
     <span class="org-comment-delimiter"># </span><span class="org-comment">To backup a directory</span>
339 343
     backup_directory_to_usb $<span class="org-variable-name">MYAPP_DATA_DIR</span> myappname
340 344
 
341
-    <span class="org-comment-delimiter"># </span><span class="org-comment">if you need to backup data within individual user home directories</span>
345
+    <span class="org-comment-delimiter"># </span><span class="org-comment">if you need to backup data within individual user</span>
346
+    <span class="org-comment-delimiter"># </span><span class="org-comment">home directories</span>
342 347
     <span class="org-keyword">for</span> d<span class="org-keyword"> in</span> /home/*/ ; <span class="org-keyword">do</span>
343 348
         <span class="org-variable-name">USERNAME</span>=$(<span class="org-sh-quoted-exec">echo</span> <span class="org-string">"$d"</span> | awk -F <span class="org-string">'/'</span> <span class="org-string">'{print $3}'</span>)
344 349
         <span class="org-keyword">if</span> [[ $(<span class="org-sh-quoted-exec">is_valid_user</span> <span class="org-string">"$USERNAME"</span>) == <span class="org-string">"1"</span> ]]; <span class="org-keyword">then</span>
345 350
             <span class="org-builtin">echo</span> $<span class="org-string">"Backing up myappname config for $USERNAME"</span>
346 351
             <span class="org-keyword">if</span> [ -d /home/$<span class="org-variable-name">USERNAME</span>/.config/myappname ]; <span class="org-keyword">then</span>
347
-                backup_directory_to_usb /home/$<span class="org-variable-name">USERNAME</span>/.config/myappname myappname_users/$<span class="org-variable-name">USERNAME</span>
352
+                backup_directory_to_usb <span class="org-sh-escaped-newline">\</span>
353
+                    /home/$<span class="org-variable-name">USERNAME</span>/.config/myappname <span class="org-sh-escaped-newline">\</span>
354
+                    myappname_users/$<span class="org-variable-name">USERNAME</span>
348 355
             <span class="org-keyword">fi</span>
349 356
         <span class="org-keyword">fi</span>
350 357
     <span class="org-keyword">done</span>
@@ -374,8 +381,10 @@ An example template for an app script is shown below. Copy this and add whatever
374 381
                 <span class="org-keyword">fi</span>
375 382
                 <span class="org-builtin">echo</span> $<span class="org-string">"Restoring Vim config for $USERNAME"</span>
376 383
                 function_check restore_directory_from_usb
377
-                restore_directory_from_usb $<span class="org-variable-name">temp_restore_dir</span> myappname_users/$<span class="org-variable-name">USERNAME</span>
378
-                cp -r $<span class="org-variable-name">temp_restore_dir</span>/home/$<span class="org-variable-name">USERNAME</span>/.config /home/$<span class="org-variable-name">USERNAME</span>/
384
+                restore_directory_from_usb $<span class="org-variable-name">temp_restore_dir</span> <span class="org-sh-escaped-newline">\</span>
385
+                                           myappname_users/$<span class="org-variable-name">USERNAME</span>
386
+                cp -r $<span class="org-variable-name">temp_restore_dir</span>/home/$<span class="org-variable-name">USERNAME</span>/.config <span class="org-sh-escaped-newline">\</span>
387
+                      /home/$<span class="org-variable-name">USERNAME</span>/
379 388
                 <span class="org-keyword">if</span> [ <span class="org-negation-char">!</span> <span class="org-string">"$?"</span> = <span class="org-string">"0"</span> ]; <span class="org-keyword">then</span>
380 389
                     rm -rf $<span class="org-variable-name">temp_restore_dir</span>
381 390
                     set_user_permissions
@@ -420,7 +429,8 @@ An example template for an app script is shown below. Copy this and add whatever
420 429
     create_database myappname <span class="org-string">"$MYAPPNAME_DB_PASSWORD"</span> $<span class="org-variable-name">MY_USERNAME</span>
421 430
 
422 431
     <span class="org-comment-delimiter"># </span><span class="org-comment">If you need to create an onion address for the app</span>
423
-    <span class="org-variable-name">MYAPPNAME_ONION_HOSTNAME</span>=$(<span class="org-sh-quoted-exec">add_onion_service</span> myappname 80 ${<span class="org-variable-name">MYAPPNAME_ONION_PORT</span>})
432
+    <span class="org-variable-name">MYAPPNAME_ONION_HOSTNAME</span>=$(<span class="org-sh-quoted-exec">add_onion_service</span> myappname <span class="org-sh-escaped-newline">\</span>
433
+                               80 ${<span class="org-variable-name">MYAPPNAME_ONION_PORT</span>})
424 434
 
425 435
     <span class="org-comment-delimiter"># </span><span class="org-comment">Do any other configuration</span>
426 436
     <span class="org-comment-delimiter"># </span><span class="org-comment">Here you might use $ONION_ONLY or $SOME_IMPORTANT_CONFIG_VARIABLE</span>
@@ -438,7 +448,8 @@ An example template for an app script is shown below. Copy this and add whatever
438 448
     <span class="org-keyword">trap</span> <span class="org-string">"rm -f $data"</span> 0 1 2 5 15
439 449
     dialog --title $<span class="org-string">"Change your avatar"</span> <span class="org-sh-escaped-newline">\</span>
440 450
            --backtitle $<span class="org-string">"Freedombone Control Panel"</span> <span class="org-sh-escaped-newline">\</span>
441
-           --inputbox $<span class="org-string">"Enter a URL for an image. It should be approximately a square image."</span> 8 75 2&gt;$<span class="org-variable-name">data</span>
451
+           --inputbox $<span class="org-string">"Enter a URL for an image. It should be "</span> <span class="org-sh-escaped-newline">\</span>
452
+                      $<span class="org-string">"approximately a square image."</span> 8 75 2&gt;$<span class="org-variable-name">data</span>
442 453
     <span class="org-variable-name">sel</span>=$<span class="org-variable-name">?</span>
443 454
     <span class="org-keyword">case</span> $<span class="org-variable-name">sel</span><span class="org-keyword"> in</span>
444 455
         0)