瀏覽代碼

Move tahoelafs to using debian package

Bob Mottram 7 年之前
父節點
當前提交
7685366ca2
共有 1 個文件被更改,包括 7 次插入49 次删除
  1. 7
    49
      src/freedombone-app-tahoelafs

+ 7
- 49
src/freedombone-app-tahoelafs 查看文件

@@ -36,16 +36,13 @@ IN_DEFAULT_INSTALL=0
36 36
 SHOW_ON_ABOUT=1
37 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 39
 TAHOELAFS_PORT=50213
43 40
 TAHOELAFS_STORAGE_PORT=50214
44 41
 TAHOELAFS_ONION_PORT=8096
45 42
 TAHOELAFS_STORAGE_ONION_PORT=8097
46 43
 
47 44
 TAHOE_DIR=/home/tahoelafs
48
-TAHOE_COMMAND="cd $TAHOE_DIR/tahoelafs && venv/bin/tahoe"
45
+TAHOE_COMMAND='/usr/bin/tahoe'
49 46
 tahoelafs_storage_file=$TAHOE_DIR/client/private/servers.yaml
50 47
 
51 48
 TAHOELAFS_SHARES_NEEDED=3
@@ -54,7 +51,6 @@ TAHOELAFS_SHARES_TOTAL=10
54 51
 
55 52
 tahoelafs_variables=(ONION_ONLY
56 53
                      MY_USERNAME
57
-                     TAHOELAFS_REPO
58 54
                      TAHOELAFS_PORT
59 55
                      TAHOELAFS_SHARES_NEEDED
60 56
                      TAHOELAFS_SHARES_HAPPY
@@ -273,18 +269,7 @@ function install_interactive_tahoelafs {
273 269
 }
274 270
 
275 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 275
 function backup_local_tahoelafs {
@@ -376,6 +361,8 @@ function remove_tahoelafs {
376 361
     systemctl disable tahoelafs-client
377 362
     rm /etc/systemd/system/tahoelafs-client.service
378 363
 
364
+    apt-get -yq remove tahoe-lafs
365
+
379 366
     if [ -d /var/lib/tahoelafs ]; then
380 367
         rm -rf /var/lib/tahoelafs
381 368
     fi
@@ -392,36 +379,9 @@ function remove_tahoelafs {
392 379
     if [ -f /etc/nginx/.htpasswd-tahoelafs ]; then
393 380
         shred -zu /etc/nginx/.htpasswd-tahoelafs
394 381
     fi
395
-    remove_completion_param "tahoelafs commit"
396 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 385
 function create_tahoelafs_stealth_node {
426 386
     node_dir="$1"
427 387
     client_dir="$2"
@@ -655,6 +615,7 @@ function install_tahoelafs {
655 615
 
656 616
     apt-get -yq install build-essential python-pip python-dev libffi-dev libssl-dev
657 617
     apt-get -yq install libcrypto++-dev python-pycryptopp python-cffi python-virtualenv
618
+    apt-get -yq install tahoe-lafs
658 619
 
659 620
     # create a user
660 621
     if [ ! -d $TAHOE_DIR ]; then
@@ -667,8 +628,6 @@ function install_tahoelafs {
667 628
         rm -rf $TAHOE_DIR/Maildir
668 629
     fi
669 630
 
670
-    install_tahoelafs_to_directory $TAHOE_DIR/tahoelafs
671
-
672 631
     # remove files we don't need
673 632
     rm -rf $TAHOE_DIR/.mutt
674 633
     rm $TAHOE_DIR/.emacs-mutt
@@ -691,11 +650,11 @@ function install_tahoelafs {
691 650
     create_tahoelafs_stealth_node $TAHOE_DIR/storage $TAHOE_DIR/client ${node_nick} ${client_nick}
692 651
 
693 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 654
     create_tahoelafs_daemon "storage"
696 655
 
697 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 658
     add_tahoelafs_server "$(get_tahoelafs_storage_hostname)" "$(get_tahoelafs_public_key)" "${node_nick}" "$(get_tahoelafs_furl)"
700 659
     if ! grep -q "HidServAuth $(get_tahoelafs_storage_hostname)" /etc/tor/torrc; then
701 660
         echo $'Unable to create tahoelafs server'
@@ -707,7 +666,6 @@ function install_tahoelafs {
707 666
     fi
708 667
     create_tahoelafs_daemon "client"
709 668
 
710
-    set_completion_param "tahoelafs commit" "$TAHOELAFS_COMMIT"
711 669
     set_completion_param "tahoelafs onion domain" "$TAHOELAFS_ONION_HOSTNAME"
712 670
 
713 671
     create_tahoelafs_web