Browse Source

Move tahoelafs to using debian package

Bob Mottram 7 years ago
parent
commit
7685366ca2
1 changed files with 7 additions and 49 deletions
  1. 7
    49
      src/freedombone-app-tahoelafs

+ 7
- 49
src/freedombone-app-tahoelafs View File

36
 SHOW_ON_ABOUT=1
36
 SHOW_ON_ABOUT=1
37
 SHOW_ICANN_ADDRESS_ON_ABOUT=0
37
 SHOW_ICANN_ADDRESS_ON_ABOUT=0
38
 
38
 
39
-TAHOELAFS_REPO="https://github.com/tahoe-lafs/tahoe-lafs"
40
-TAHOELAFS_COMMIT='bb782b0331a60de438136a593bba18338d8d866b'
41
-
42
 TAHOELAFS_PORT=50213
39
 TAHOELAFS_PORT=50213
43
 TAHOELAFS_STORAGE_PORT=50214
40
 TAHOELAFS_STORAGE_PORT=50214
44
 TAHOELAFS_ONION_PORT=8096
41
 TAHOELAFS_ONION_PORT=8096
45
 TAHOELAFS_STORAGE_ONION_PORT=8097
42
 TAHOELAFS_STORAGE_ONION_PORT=8097
46
 
43
 
47
 TAHOE_DIR=/home/tahoelafs
44
 TAHOE_DIR=/home/tahoelafs
48
-TAHOE_COMMAND="cd $TAHOE_DIR/tahoelafs && venv/bin/tahoe"
45
+TAHOE_COMMAND='/usr/bin/tahoe'
49
 tahoelafs_storage_file=$TAHOE_DIR/client/private/servers.yaml
46
 tahoelafs_storage_file=$TAHOE_DIR/client/private/servers.yaml
50
 
47
 
51
 TAHOELAFS_SHARES_NEEDED=3
48
 TAHOELAFS_SHARES_NEEDED=3
54
 
51
 
55
 tahoelafs_variables=(ONION_ONLY
52
 tahoelafs_variables=(ONION_ONLY
56
                      MY_USERNAME
53
                      MY_USERNAME
57
-                     TAHOELAFS_REPO
58
                      TAHOELAFS_PORT
54
                      TAHOELAFS_PORT
59
                      TAHOELAFS_SHARES_NEEDED
55
                      TAHOELAFS_SHARES_NEEDED
60
                      TAHOELAFS_SHARES_HAPPY
56
                      TAHOELAFS_SHARES_HAPPY
273
 }
269
 }
274
 
270
 
275
 function upgrade_tahoelafs {
271
 function upgrade_tahoelafs {
276
-    if [ ! -d $TAHOE_DIR/tahoelafs ]; then
277
-        return
278
-    fi
279
-    systemctl stop tahoelafs
280
-    function_check set_repo_commit
281
-    set_repo_commit $TAHOE_DIR/tahoelafs "tahoelafs commit" "$TAHOELAFS_COMMIT" $TAHOELAFS_REPO
282
-    cd $TAHOE_DIR/tahoelafs
283
-    git submodule update --init --recursive
284
-    virtualenv venv
285
-    venv/bin/pip install --editable .
286
-    chown -R tahoelafs:debian-tor $TAHOE_DIR
287
-    systemctl start tahoelafs
272
+    echo -n ''
288
 }
273
 }
289
 
274
 
290
 function backup_local_tahoelafs {
275
 function backup_local_tahoelafs {
376
     systemctl disable tahoelafs-client
361
     systemctl disable tahoelafs-client
377
     rm /etc/systemd/system/tahoelafs-client.service
362
     rm /etc/systemd/system/tahoelafs-client.service
378
 
363
 
364
+    apt-get -yq remove tahoe-lafs
365
+
379
     if [ -d /var/lib/tahoelafs ]; then
366
     if [ -d /var/lib/tahoelafs ]; then
380
         rm -rf /var/lib/tahoelafs
367
         rm -rf /var/lib/tahoelafs
381
     fi
368
     fi
392
     if [ -f /etc/nginx/.htpasswd-tahoelafs ]; then
379
     if [ -f /etc/nginx/.htpasswd-tahoelafs ]; then
393
         shred -zu /etc/nginx/.htpasswd-tahoelafs
380
         shred -zu /etc/nginx/.htpasswd-tahoelafs
394
     fi
381
     fi
395
-    remove_completion_param "tahoelafs commit"
396
     systemctl restart tor
382
     systemctl restart tor
397
 }
383
 }
398
 
384
 
399
-function install_tahoelafs_to_directory {
400
-    tahoe_dir=$1
401
-
402
-    apt-get -yq install build-essential autoconf python-dev
403
-    git_clone $TAHOELAFS_REPO $tahoe_dir
404
-    cd $tahoe_dir
405
-    git checkout $TAHOELAFS_COMMIT -b $TAHOELAFS_COMMIT
406
-    git submodule update --init --recursive
407
-    virtualenv venv --distribute
408
-    venv/bin/pip uninstall --yes setuptools
409
-    venv/bin/pip install setuptools==36.0.1
410
-    venv/bin/pip install six==1.10.0
411
-    venv/bin/pip install packaging==16.8
412
-    venv/bin/pip install attrs==17.2.0
413
-    venv/bin/pip install appdirs==1.4.3
414
-    venv/bin/pip install pycrypto==2.6.1
415
-
416
-
417
-    venv/bin/pip install cffi==1.9.1
418
-    venv/bin/pip install cryptography==1.7.2
419
-    venv/bin/pip install markerlib==0.6.0
420
-    venv/bin/pip install distribute==0.7.3
421
-    venv/bin/pip install txtorcon==0.18.0
422
-    venv/bin/pip install --editable .
423
-}
424
-
425
 function create_tahoelafs_stealth_node {
385
 function create_tahoelafs_stealth_node {
426
     node_dir="$1"
386
     node_dir="$1"
427
     client_dir="$2"
387
     client_dir="$2"
655
 
615
 
656
     apt-get -yq install build-essential python-pip python-dev libffi-dev libssl-dev
616
     apt-get -yq install build-essential python-pip python-dev libffi-dev libssl-dev
657
     apt-get -yq install libcrypto++-dev python-pycryptopp python-cffi python-virtualenv
617
     apt-get -yq install libcrypto++-dev python-pycryptopp python-cffi python-virtualenv
618
+    apt-get -yq install tahoe-lafs
658
 
619
 
659
     # create a user
620
     # create a user
660
     if [ ! -d $TAHOE_DIR ]; then
621
     if [ ! -d $TAHOE_DIR ]; then
667
         rm -rf $TAHOE_DIR/Maildir
628
         rm -rf $TAHOE_DIR/Maildir
668
     fi
629
     fi
669
 
630
 
670
-    install_tahoelafs_to_directory $TAHOE_DIR/tahoelafs
671
-
672
     # remove files we don't need
631
     # remove files we don't need
673
     rm -rf $TAHOE_DIR/.mutt
632
     rm -rf $TAHOE_DIR/.mutt
674
     rm $TAHOE_DIR/.emacs-mutt
633
     rm $TAHOE_DIR/.emacs-mutt
691
     create_tahoelafs_stealth_node $TAHOE_DIR/storage $TAHOE_DIR/client ${node_nick} ${client_nick}
650
     create_tahoelafs_stealth_node $TAHOE_DIR/storage $TAHOE_DIR/client ${node_nick} ${client_nick}
692
 
651
 
693
     # start the storage node
652
     # start the storage node
694
-    su -c "$TAHOE_DIR/tahoelafs/venv/bin/python2 $TAHOE_DIR/tahoelafs/venv/bin/tahoe start $TAHOE_DIR/storage" - tahoelafs
653
+    su -c "/usr/bin/python2 /usr/bin/tahoe start $TAHOE_DIR/storage" - tahoelafs
695
     create_tahoelafs_daemon "storage"
654
     create_tahoelafs_daemon "storage"
696
 
655
 
697
     # start the client
656
     # start the client
698
-    su -c "$TAHOE_DIR/tahoelafs/venv/bin/python2 $TAHOE_DIR/tahoelafs/venv/bin/tahoe start $TAHOE_DIR/client" - tahoelafs
657
+    su -c "/usr/bin/python2 /usr/bin/tahoe start $TAHOE_DIR/client" - tahoelafs
699
     add_tahoelafs_server "$(get_tahoelafs_storage_hostname)" "$(get_tahoelafs_public_key)" "${node_nick}" "$(get_tahoelafs_furl)"
658
     add_tahoelafs_server "$(get_tahoelafs_storage_hostname)" "$(get_tahoelafs_public_key)" "${node_nick}" "$(get_tahoelafs_furl)"
700
     if ! grep -q "HidServAuth $(get_tahoelafs_storage_hostname)" /etc/tor/torrc; then
659
     if ! grep -q "HidServAuth $(get_tahoelafs_storage_hostname)" /etc/tor/torrc; then
701
         echo $'Unable to create tahoelafs server'
660
         echo $'Unable to create tahoelafs server'
707
     fi
666
     fi
708
     create_tahoelafs_daemon "client"
667
     create_tahoelafs_daemon "client"
709
 
668
 
710
-    set_completion_param "tahoelafs commit" "$TAHOELAFS_COMMIT"
711
     set_completion_param "tahoelafs onion domain" "$TAHOELAFS_ONION_HOSTNAME"
669
     set_completion_param "tahoelafs onion domain" "$TAHOELAFS_ONION_HOSTNAME"
712
 
670
 
713
     create_tahoelafs_web
671
     create_tahoelafs_web