Browse Source

Handle git clone

Bob Mottram 9 years ago
parent
commit
be3658dd13
1 changed files with 39 additions and 21 deletions
  1. 39
    21
      src/freedombone

+ 39
- 21
src/freedombone View File

@@ -534,6 +534,24 @@ function show_help {
534 534
     exit 0
535 535
 }
536 536
 
537
+function git_clone {
538
+    repo_url="$1"
539
+    destination_dir="$2"
540
+    if [[ "$repo_url" == "ssh:"* ]]; then
541
+        if [ "${FRIENDS_TROVE_SERVER}" ]; then
542
+            if [ ${#FRIENDS_TROVE_SERVER} -gt 2 ]; then
543
+                if [ "$FRIENDS_TROVE_PASSWORD" ]; then
544
+                    if [ ${#FRIENDS_TROVE_PASSWORD} -gt 2 ]; then
545
+                        sshpass -p "$FRIENDS_TROVE_PASSWORD" git clone "$repo_url" "$destination_dir"
546
+                        return
547
+                    fi
548
+                fi
549
+            fi
550
+        fi
551
+    fi
552
+    git clone "$repo_url" "$destination_dir"
553
+}
554
+
537 555
 function create_database {
538 556
     app_name="$1"
539 557
     app_admin_password="$2"
@@ -1959,7 +1977,7 @@ function mesh_cjdns {
1959 1977
     fi
1960 1978
 
1961 1979
     if [ ! -d /etc/cjdns ]; then
1962
-        git clone $CJDNS_REPO /etc/cjdns
1980
+        git_clone $CJDNS_REPO /etc/cjdns
1963 1981
         cd /etc/cjdns
1964 1982
 
1965 1983
         git checkout $CJDNS_COMMIT -b $CJDNS_COMMIT
@@ -2319,7 +2337,7 @@ function install_zeronet_blog {
2319 2337
         exit 7638
2320 2338
     fi
2321 2339
 
2322
-    git clone $ZERONET_BLOG_REPO ZeroBlog
2340
+    git_clone $ZERONET_BLOG_REPO ZeroBlog
2323 2341
     if [ ! -d /opt/zeronet/ZeroBlog ]; then
2324 2342
         echo $'ZeroBlog repo could not be cloned'
2325 2343
         exit 6739
@@ -2445,7 +2463,7 @@ function install_zeronet_mail {
2445 2463
         exit 7638
2446 2464
     fi
2447 2465
 
2448
-    git clone $ZERONET_MAIL_REPO ZeroMail
2466
+    git_clone $ZERONET_MAIL_REPO ZeroMail
2449 2467
     if [ ! -d /opt/zeronet/ZeroMail ]; then
2450 2468
         echo $'ZeroMail repo could not be cloned'
2451 2469
         exit 6739
@@ -2572,7 +2590,7 @@ function install_zeronet_forum {
2572 2590
         exit 7638
2573 2591
     fi
2574 2592
 
2575
-    git clone $ZERONET_FORUM_REPO ZeroTalk
2593
+    git_clone $ZERONET_FORUM_REPO ZeroTalk
2576 2594
     if [ ! -d /opt/zeronet/ZeroTalk ]; then
2577 2595
         echo $'ZeroTalk repo could not be cloned'
2578 2596
         exit 6739
@@ -2654,7 +2672,7 @@ function install_zeronet {
2654 2672
     pip install msgpack-python --upgrade
2655 2673
 
2656 2674
     useradd -d /opt/zeronet/ -s /bin/false zeronet
2657
-    git clone $ZERONET_REPO /opt/zeronet
2675
+    git_clone $ZERONET_REPO /opt/zeronet
2658 2676
     if [ ! -d /opt/zeronet ]; then
2659 2677
         exit 56823
2660 2678
     fi
@@ -2766,7 +2784,7 @@ function install_atheros_wifi {
2766 2784
     fi
2767 2785
     cd $INSTALL_DIR
2768 2786
     if [ ! -d $INSTALL_DIR/open-ath9k-htc-firmware ]; then
2769
-        git clone $ATHEROS_WIFI_REPO $INSTALL_DIR/open-ath9k-htc-firmware
2787
+        git_clone $ATHEROS_WIFI_REPO $INSTALL_DIR/open-ath9k-htc-firmware
2770 2788
         if [ ! "$?" = "0" ]; then
2771 2789
             rm -rf $INSTALL_DIR/open-ath9k-htc-firmware
2772 2790
             exit 74283
@@ -4488,7 +4506,7 @@ function configure_email {
4488 4506
         mkdir -p $INSTALL_DIR
4489 4507
     fi
4490 4508
     cd $INSTALL_DIR
4491
-    git clone $EXIM_ONION_REPO $INSTALL_DIR/exim4-smtorp
4509
+    git_clone $EXIM_ONION_REPO $INSTALL_DIR/exim4-smtorp
4492 4510
     cd $INSTALL_DIR/exim4-smtorp/tor-smtp
4493 4511
     make
4494 4512
     if [ ! -f $INSTALL_DIR/exim4-smtorp/tor-smtp/tor-smtp ]; then
@@ -5265,7 +5283,7 @@ function encrypt_incoming_email {
5265 5283
     if [ ! -f /usr/bin/gpgit.pl ]; then
5266 5284
         apt-get -y install git libmail-gnupg-perl
5267 5285
         cd $INSTALL_DIR
5268
-        git clone $GPGIT_REPO $INSTALL_DIR/gpgit
5286
+        git_clone $GPGIT_REPO $INSTALL_DIR/gpgit
5269 5287
         cd $INSTALL_DIR/gpgit
5270 5288
         git checkout $GPGIT_COMMIT -b $GPGIT_COMMIT
5271 5289
         if ! grep -q "gpgit commit" $COMPLETION_FILE; then
@@ -5577,7 +5595,7 @@ function email_archiving {
5577 5595
         mkdir $INSTALL_DIR
5578 5596
     fi
5579 5597
     cd $INSTALL_DIR
5580
-    git clone $CLEANUP_MAILDIR_REPO $INSTALL_DIR/cleanup-maildir
5598
+    git_clone $CLEANUP_MAILDIR_REPO $INSTALL_DIR/cleanup-maildir
5581 5599
     cd $INSTALL_DIR/cleanup-maildir
5582 5600
     git checkout $CLEANUP_MAILDIR_COMMIT -b $CLEANUP_MAILDIR_COMMIT
5583 5601
     if ! grep -q "cleanup-maildir commit" $COMPLETION_FILE; then
@@ -5969,7 +5987,7 @@ function install_web_server {
5969 5987
         mkdir $INSTALL_DIR
5970 5988
     fi
5971 5989
     cd $INSTALL_DIR
5972
-    git clone $NGINX_ENSITE_REPO $INSTALL_DIR/nginx_ensite
5990
+    git_clone $NGINX_ENSITE_REPO $INSTALL_DIR/nginx_ensite
5973 5991
     cd $INSTALL_DIR/nginx_ensite
5974 5992
     git checkout $NGINX_ENSITE_COMMIT -b $NGINX_ENSITE_COMMIT
5975 5993
     if ! grep -q "Nginx-ensite commit" $COMPLETION_FILE; then
@@ -6131,7 +6149,7 @@ function install_owncloud_music_app {
6131 6149
     fi
6132 6150
 
6133 6151
     cd /usr/share/owncloud/apps
6134
-    git clone $OWNCLOUD_MUSIC_APP_REPO Music
6152
+    git_clone $OWNCLOUD_MUSIC_APP_REPO Music
6135 6153
     cd /usr/share/owncloud/apps/Music
6136 6154
     git checkout $OWNCLOUD_MUSIC_APP_COMMIT -b $OWNCLOUD_MUSIC_APP_COMMIT
6137 6155
     if ! grep -q "Owncloud music app commit" $COMPLETION_FILE; then
@@ -6631,7 +6649,7 @@ function install_gogs {
6631 6649
         mkdir -p $GOPATH/src/github.com/gogits
6632 6650
     fi
6633 6651
     cd $GOPATH/src/github.com/gogits
6634
-    git clone $GIT_DOMAIN_REPO $GOPATH/src/github.com/gogits/gogs
6652
+    git_clone $GIT_DOMAIN_REPO $GOPATH/src/github.com/gogits/gogs
6635 6653
     cd gogs
6636 6654
     git checkout $GOGS_COMMIT -b $GOGS_COMMIT
6637 6655
     if ! grep -q "Gogs commit" $COMPLETION_FILE; then
@@ -6887,7 +6905,7 @@ function tox_avahi {
6887 6905
 
6888 6906
     # install a command to obtain the Tox ID
6889 6907
     cd $INSTALL_DIR
6890
-    git clone $TOXID_REPO $INSTALL_DIR/toxid
6908
+    git_clone $TOXID_REPO $INSTALL_DIR/toxid
6891 6909
     if [ ! -d $INSTALL_DIR/toxid ]; then
6892 6910
         exit 63921
6893 6911
     fi
@@ -6948,7 +6966,7 @@ function install_tox_node {
6948 6966
     apt-get -y install libconfig9 libconfig-dev
6949 6967
 
6950 6968
     cd $INSTALL_DIR
6951
-    git clone $TOX_REPO $INSTALL_DIR/toxcore
6969
+    git_clone $TOX_REPO $INSTALL_DIR/toxcore
6952 6970
     cd $INSTALL_DIR/toxcore
6953 6971
 
6954 6972
     git checkout $TOX_COMMIT -b $TOX_COMMIT
@@ -7110,7 +7128,7 @@ function install_tox_client {
7110 7128
     apt-get -y install libncursesw5-dev libconfig-dev libqrencode-dev libcurl4-openssl-dev
7111 7129
 
7112 7130
     cd $INSTALL_DIR
7113
-    git clone $TOXIC_REPO $INSTALL_DIR/toxic
7131
+    git_clone $TOXIC_REPO $INSTALL_DIR/toxic
7114 7132
     cd $INSTALL_DIR/toxic
7115 7133
     git checkout $TOXIC_COMMIT -b $TOXIC_COMMIT
7116 7134
     if ! grep -q "Toxic commit" $COMPLETION_FILE; then
@@ -7855,7 +7873,7 @@ function install_blog {
7855 7873
     fi
7856 7874
 
7857 7875
     cd /var/www/$FULLBLOG_DOMAIN_NAME
7858
-    git clone $FULLBLOG_REPO htdocs
7876
+    git_clone $FULLBLOG_REPO htdocs
7859 7877
     cd htdocs
7860 7878
     git checkout $FULLBLOG_COMMIT -b $FULLBLOG_COMMIT
7861 7879
     if ! grep -q "Blog commit" $COMPLETION_FILE; then
@@ -8240,7 +8258,7 @@ function install_gnu_social {
8240 8258
         mkdir /var/www/$MICROBLOG_DOMAIN_NAME
8241 8259
     fi
8242 8260
     if [ ! -d /var/www/$MICROBLOG_DOMAIN_NAME/htdocs ]; then
8243
-        git clone $MICROBLOG_REPO /var/www/$MICROBLOG_DOMAIN_NAME/htdocs
8261
+        git_clone $MICROBLOG_REPO /var/www/$MICROBLOG_DOMAIN_NAME/htdocs
8244 8262
         if [ ! -d /var/www/$MICROBLOG_DOMAIN_NAME/htdocs ]; then
8245 8263
             echo $'Unable to clone gnusocial repo'
8246 8264
             exit 87525
@@ -8628,7 +8646,7 @@ function install_hubzilla {
8628 8646
 
8629 8647
     if [ ! -f /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/index.php ]; then
8630 8648
         cd $INSTALL_DIR
8631
-        git clone $HUBZILLA_REPO hubzilla
8649
+        git_clone $HUBZILLA_REPO hubzilla
8632 8650
         git checkout $HUBZILLA_COMMIT -b $HUBZILLA_COMMIT
8633 8651
         if ! grep -q "Hubzilla commit" $COMPLETION_FILE; then
8634 8652
             echo "Hubzilla commit:$HUBZILLA_COMMIT" >> $COMPLETION_FILE
@@ -8639,7 +8657,7 @@ function install_hubzilla {
8639 8657
         rm -rf /var/www/$HUBZILLA_DOMAIN_NAME/htdocs
8640 8658
         mv hubzilla /var/www/$HUBZILLA_DOMAIN_NAME/htdocs
8641 8659
 
8642
-        git clone $HUBZILLA_ADDONS_REPO /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/addon
8660
+        git_clone $HUBZILLA_ADDONS_REPO /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/addon
8643 8661
         cd /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/addon
8644 8662
         git checkout $HUBZILLA_ADDONS_COMMIT -b $HUBZILLA_ADDONS_COMMIT
8645 8663
         if ! grep -q "Hubzilla addons commit" $COMPLETION_FILE; then
@@ -8649,7 +8667,7 @@ function install_hubzilla {
8649 8667
         fi
8650 8668
 
8651 8669
         # some extra themes
8652
-        git clone $HUBZILLA_THEMES_REPO /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/redmatrix-themes1
8670
+        git_clone $HUBZILLA_THEMES_REPO /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/redmatrix-themes1
8653 8671
         cp -r /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/redmatrix-themes1/* view/theme/
8654 8672
 
8655 8673
         chown -R www-data:www-data /var/www/$HUBZILLA_DOMAIN_NAME/htdocs
@@ -9470,7 +9488,7 @@ function install_dynamicdns {
9470 9488
     # https version 1.99.8
9471 9489
 
9472 9490
     apt-get -y install build-essential curl libgnutls28-dev automake1.11
9473
-    git clone $INADYN_REPO $INSTALL_DIR/inadyn
9491
+    git_clone $INADYN_REPO $INSTALL_DIR/inadyn
9474 9492
     if [ ! -d $INSTALL_DIR/inadyn ]; then
9475 9493
         echo 'inadyn repo not cloned'
9476 9494
         echo -n | openssl s_client -showcerts -connect github.com:443 -CApath /etc/ssl/certs