Browse Source

trove enable git pull

Bob Mottram 9 years ago
parent
commit
17b438370e
1 changed files with 27 additions and 76 deletions
  1. 27
    76
      src/freedombone

+ 27
- 76
src/freedombone View File

@@ -557,17 +557,25 @@ function git_clone {
557 557
 
558 558
 function git_pull {
559 559
     git stash
560
+    git checkout master
560 561
     if [ "${FRIENDS_TROVE_SERVER}" ]; then
561 562
         if [ ${#FRIENDS_TROVE_SERVER} -gt 2 ]; then
562 563
             if [ "$FRIENDS_TROVE_PASSWORD" ]; then
563 564
                 if [ ${#FRIENDS_TROVE_PASSWORD} -gt 2 ]; then
564 565
                     sshpass -p "$FRIENDS_TROVE_PASSWORD" git pull
566
+                    if [ $1 ]; then
567
+                        git checkout $1 -b $1
568
+                    fi
565 569
                     return
566 570
                 fi
567 571
             fi
568 572
         fi
569 573
     fi
570 574
     git pull
575
+
576
+    if [ $1 ]; then
577
+        git checkout $1 -b $1
578
+    fi
571 579
 }
572 580
 
573 581
 function create_database {
@@ -1964,10 +1972,7 @@ function mesh_cjdns {
1964 1972
             CURRENT_CJDNS_COMMIT=$(grep "cjdns commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
1965 1973
             if [[ "$CURRENT_CJDNS_COMMIT" != "$CJDNS_COMMIT" ]]; then
1966 1974
                 cd /etc/cjdns
1967
-                git stash
1968
-                git checkout master
1969
-                git pull
1970
-                git checkout $CJDNS_COMMIT -b $CJDNS_COMMIT
1975
+                git_pull $CJDNS_COMMIT
1971 1976
                 sed -i "s/cjdns commit.*/cjdns commit:$CJDNS_COMMIT/g" $COMPLETION_FILE
1972 1977
                 ./do
1973 1978
             fi
@@ -2019,7 +2024,7 @@ function mesh_cjdns {
2019 2024
         useradd cjdns
2020 2025
     else
2021 2026
         cd /etc/cjdns
2022
-        git pull
2027
+        git_pull
2023 2028
         ./do
2024 2029
         if [ ! "$?" = "0" ]; then
2025 2030
             exit 9926
@@ -2302,10 +2307,7 @@ function install_zeronet_blog {
2302 2307
             CURRENT_ZERONET_BLOG_COMMIT=$(grep "ZeroNet Blog commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
2303 2308
             if [[ "$CURRENT_ZERONET_BLOG_COMMIT" != "$ZERONET_BLOG_COMMIT" ]]; then
2304 2309
                 cd /opt/zeronet/ZeroBlog
2305
-                git stash
2306
-                git checkout master
2307
-                git pull
2308
-                git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
2310
+                git_pull $ZERONET_BLOG_COMMIT
2309 2311
                 sed -i "s/ZeroNet Blog commit.*/ZeroNet Blog commit:$ZERONET_BLOG_COMMIT/g" $COMPLETION_FILE
2310 2312
             fi
2311 2313
         else
@@ -2428,10 +2430,7 @@ function install_zeronet_mail {
2428 2430
             CURRENT_ZERONET_MAIL_COMMIT=$(grep "ZeroNet Mail commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
2429 2431
             if [[ "$CURRENT_ZERONET_MAIL_COMMIT" != "$ZERONET_MAIL_COMMIT" ]]; then
2430 2432
                 cd /opt/zeronet/ZeroMail
2431
-                git stash
2432
-                git checkout master
2433
-                git pull
2434
-                git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
2433
+                git_pull $ZERONET_MAIL_COMMIT
2435 2434
                 sed -i "s/ZeroNet Mail commit.*/ZeroNet Mail commit:$ZERONET_MAIL_COMMIT/g" $COMPLETION_FILE
2436 2435
             fi
2437 2436
         else
@@ -2555,10 +2554,7 @@ function install_zeronet_forum {
2555 2554
             CURRENT_ZERONET_FORUM_COMMIT=$(grep "ZeroNet Forum commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
2556 2555
             if [[ "$CURRENT_ZERONET_FORUM_COMMIT" != "$ZERONET_FORUM_COMMIT" ]]; then
2557 2556
                 cd /opt/zeronet/ZeroTalk
2558
-                git stash
2559
-                git checkout master
2560
-                git pull
2561
-                git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
2557
+                git_pull $ZERONET_FORUM_COMMIT
2562 2558
                 sed -i "s/ZeroNet Forum commit.*/ZeroNet Forum commit:$ZERONET_FORUM_COMMIT/g" $COMPLETION_FILE
2563 2559
             fi
2564 2560
         else
@@ -2676,10 +2672,7 @@ function install_zeronet {
2676 2672
             CURRENT_ZERONET_COMMIT=$(grep "ZeroNet commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
2677 2673
             if [[ "$CURRENT_ZERONET_COMMIT" != "$ZERONET_COMMIT" ]]; then
2678 2674
                 cd /opt/zeronet
2679
-                git stash
2680
-                git checkout master
2681
-                git pull
2682
-                git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT
2675
+                git_pull $ZERONET_COMMIT
2683 2676
                 sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE
2684 2677
                 systemctl restart zeronet.service
2685 2678
             fi
@@ -5285,10 +5278,7 @@ function encrypt_incoming_email {
5285 5278
             CURRENT_GPGIT_COMMIT=$(grep "gpgit commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
5286 5279
             if [[ "$CURRENT_GPGIT_COMMIT" != "$GPGIT_COMMIT" ]]; then
5287 5280
                 cd $INSTALL_DIR/gpgit
5288
-                git stash
5289
-                git checkout master
5290
-                git pull
5291
-                git checkout $GPGIT_COMMIT -b $GPGIT_COMMIT
5281
+                git_pull $GPGIT_COMMIT
5292 5282
                 sed -i "s/gpgit commit.*/gpgit commit:$GPGIT_COMMIT/g" $COMPLETION_FILE
5293 5283
                 cp gpgit.pl /usr/bin/gpgit.pl
5294 5284
             fi
@@ -5600,10 +5590,7 @@ function email_archiving {
5600 5590
             CURRENT_CLEANUP_MAILDIR_COMMIT=$(grep "cleanup-maildir commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
5601 5591
             if [[ "$CURRENT_CLEANUP_MAILDIR_COMMIT" != "$CLEANUP_MAILDIR_COMMIT" ]]; then
5602 5592
                 cd $INSTALL_DIR/cleanup-maildir
5603
-                git stash
5604
-                git checkout master
5605
-                git pull
5606
-                git checkout $CLEANUP_MAILDIR_COMMIT -b $CLEANUP_MAILDIR_COMMIT
5593
+                git_pull $CLEANUP_MAILDIR_COMMIT
5607 5594
                 sed -i "s/cleanup-maildir commit.*/cleanup-maildir commit:$CLEANUP_MAILDIR_COMMIT/g" $COMPLETION_FILE
5608 5595
                 cp $INSTALL_DIR/cleanup-maildir/cleanup-maildir /usr/bin
5609 5596
             fi
@@ -5889,10 +5876,7 @@ function install_web_server {
5889 5876
             CURRENT_NGINX_ENSITE_COMMIT=$(grep "Nginx-ensite commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
5890 5877
             if [[ "$CURRENT_NGINX_ENSITE_COMMIT" != "$NGINX_ENSITE_COMMIT" ]]; then
5891 5878
                 $INSTALL_DIR/nginx_ensite
5892
-                git stash
5893
-                git checkout master
5894
-                git pull
5895
-                git checkout $NGINX_ENSITE_COMMIT -b $NGINX_ENSITE_COMMIT
5879
+                git_pull $NGINX_ENSITE_COMMIT
5896 5880
                 sed -i "s/Nginx-ensite commit.*/Nginx-ensite commit:$NGINX_ENSITE_COMMIT/g" $COMPLETION_FILE
5897 5881
                 make install
5898 5882
             fi
@@ -6158,10 +6142,7 @@ function install_owncloud_music_app {
6158 6142
             CURRENT_OWNCLOUD_MUSIC_APP_COMMIT=$(grep "Owncloud music app commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
6159 6143
             if [[ "$OWNCLOUD_MUSIC_APP_COMMIT" != "$OWNCLOUD_MUSIC_APP_COMMIT" ]]; then
6160 6144
                 cd /usr/share/owncloud/apps/music
6161
-                git stash
6162
-                git checkout master
6163
-                git pull
6164
-                git checkout $OWNCLOUD_MUSIC_APP_COMMIT -b $OWNCLOUD_MUSIC_APP_COMMIT
6145
+                git_pull $OWNCLOUD_MUSIC_APP_COMMIT
6165 6146
                 sed -i "s/Owncloud music app commit.*/Owncloud music app commit:$OWNCLOUD_MUSIC_APP_COMMIT/g" $COMPLETION_FILE
6166 6147
             fi
6167 6148
         else
@@ -6623,13 +6604,7 @@ function install_gogs {
6623 6604
             CURRENT_GOGS_COMMIT=$(grep "Gogs commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
6624 6605
             if [[ "$CURRENT_GOGS_COMMIT" != "$GOGS_COMMIT" ]]; then
6625 6606
                 cd $GOPATH/src/github.com/gogits/gogs
6626
-                git stash
6627
-                git checkout master
6628
-                git pull origin master
6629
-                git checkout $GOGS_COMMIT -b $GOGS_COMMIT
6630
-                if [ ! "$?" = "0" ]; then
6631
-                    git checkout $GOGS_COMMIT
6632
-                fi
6607
+                git_pull $GOGS_COMMIT
6633 6608
                 sed -i "s/Gogs commit.*/Gogs commit:$GOGS_COMMIT/g" $COMPLETION_FILE
6634 6609
                 go get -u ./...
6635 6610
                 if [ ! "$?" = "0" ]; then
@@ -6964,10 +6939,7 @@ function install_tox_node {
6964 6939
             CURRENT_TOX_COMMIT=$(grep "toxcore commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
6965 6940
             if [[ "$CURRENT_TOX_COMMIT" != "$TOX_COMMIT" ]]; then
6966 6941
                 cd $INSTALL_DIR/toxcore
6967
-                git stash
6968
-                git checkout master
6969
-                git pull
6970
-                git checkout $TOX_COMMIT -b $TOX_COMMIT
6942
+                git_pull $TOX_COMMIT
6971 6943
                 sed -i "s/toxcore commit.*/toxcore commit:$TOX_COMMIT/g" $COMPLETION_FILE
6972 6944
                 autoreconf -i
6973 6945
                 ./configure --enable-daemon
@@ -7133,10 +7105,7 @@ function install_tox_client {
7133 7105
             CURRENT_TOXIC_COMMIT=$(grep "Toxic commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
7134 7106
             if [[ "$CURRENT_TOXIC_COMMIT" != "$TOXIC_COMMIT" ]]; then
7135 7107
                 cd $INSTALL_DIR/toxic
7136
-                git stash
7137
-                git checkout master
7138
-                git pull
7139
-                git checkout $TOXIC_COMMIT -b $TOXIC_COMMIT
7108
+                git_pull $TOXIC_COMMIT
7140 7109
                 sed -i "s/Toxic commit.*/Toxic commit:$TOXIC_COMMIT/g" $COMPLETION_FILE
7141 7110
                 make
7142 7111
                 make install
@@ -7877,10 +7846,7 @@ function install_blog {
7877 7846
             CURRENT_FULLBLOG_COMMIT=$(grep "Blog commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
7878 7847
             if [[ "$CURRENT_FULLBLOG_COMMIT" != "$FULLBLOG_COMMIT" ]]; then
7879 7848
                 cd /var/www/$FULLBLOG_DOMAIN_NAME/htdocs
7880
-                git stash
7881
-                git checkout master
7882
-                git pull
7883
-                git checkout $FULLBLOG_COMMIT -b $FULLBLOG_COMMIT
7849
+                git_pull $FULLBLOG_COMMIT
7884 7850
                 sed -i "s/Blog commit.*/Blog commit:$FULLBLOG_COMMIT/g" $COMPLETION_FILE
7885 7851
                 chown -R www-data:www-data /var/www/$FULLBLOG_DOMAIN_NAME/htdocs
7886 7852
             fi
@@ -8257,10 +8223,7 @@ function install_gnu_social {
8257 8223
             CURRENT_GNUSOCIAL_COMMIT=$(grep "GNU Social commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
8258 8224
             if [[ "$CURRENT_GNUSOCIAL_COMMIT" != "$GNUSOCIAL_COMMIT" ]]; then
8259 8225
                 cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs
8260
-                git stash
8261
-                git checkout master
8262
-                git pull
8263
-                git checkout $GNUSOCIAL_COMMIT -b $GNUSOCIAL_COMMIT
8226
+                git_pull $GNUSOCIAL_COMMIT
8264 8227
                 sed -i "s/GNU Social commit.*/GNU Social commit:$GNUSOCIAL_COMMIT/g" $COMPLETION_FILE
8265 8228
                 chown -R www-data:www-data /var/www/$MICROBLOG_DOMAIN_NAME/htdocs
8266 8229
             fi
@@ -8625,10 +8588,7 @@ function install_hubzilla {
8625 8588
             CURRENT_HUBZILLA_COMMIT=$(grep "Hubzilla commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
8626 8589
             if [[ "$CURRENT_HUBZILLA_COMMIT" != "$HUBZILLA_COMMIT" ]]; then
8627 8590
                 cd /var/www/$HUBZILLA_DOMAIN_NAME/htdocs
8628
-                git stash
8629
-                git checkout master
8630
-                git pull
8631
-                git checkout $HUBZILLA_COMMIT -b $HUBZILLA_COMMIT
8591
+                git_pull $HUBZILLA_COMMIT
8632 8592
                 sed -i "s/Hubzilla commit.*/Hubzilla commit:$HUBZILLA_COMMIT/g" $COMPLETION_FILE
8633 8593
                 chown -R www-data:www-data /var/www/$HUBZILLA_DOMAIN_NAME/htdocs
8634 8594
             fi
@@ -8639,10 +8599,7 @@ function install_hubzilla {
8639 8599
             CURRENT_HUBZILLA_ADDONS_COMMIT=$(grep "Hubzilla addons commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
8640 8600
             if [[ "$CURRENT_HUBZILLA_ADDONS_COMMIT" != "$HUBZILLA_ADDONS_COMMIT" ]]; then
8641 8601
                 cd /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/addon
8642
-                git stash
8643
-                git checkout master
8644
-                git pull
8645
-                git checkout $HUBZILLA_ADDONS_COMMIT -b $HUBZILLA_ADDONS_COMMIT
8602
+                git_pull $HUBZILLA_ADDONS_COMMIT
8646 8603
                 sed -i "s/Hubzilla addons commit.*/Hubzilla addons commit:$HUBZILLA_ADDONS_COMMIT/g" $COMPLETION_FILE
8647 8604
                 chown -R www-data:www-data /var/www/$HUBZILLA_DOMAIN_NAME/htdocs
8648 8605
             fi
@@ -9487,10 +9444,7 @@ function install_dynamicdns {
9487 9444
             CURRENT_INADYN_COMMIT=$(grep "inadyn commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
9488 9445
             if [[ "$CURRENT_INADYN_COMMIT" != "$INADYN_COMMIT" ]]; then
9489 9446
                 cd $INSTALL_DIR/inadyn
9490
-                git stash
9491
-                git checkout master
9492
-                git pull
9493
-                git checkout $INADYN_COMMIT -b $INADYN_COMMIT
9447
+                git_pull $INADYN_COMMIT
9494 9448
                 sed -i "s/inadyn commit.*/inadyn commit:$INADYN_COMMIT/g" $COMPLETION_FILE
9495 9449
                 ./configure
9496 9450
                 USE_OPENSSL=1 make
@@ -9604,10 +9558,7 @@ function install_ipfs {
9604 9558
             CURRENT_IPFS_COMMIT=$(grep "ipfs commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
9605 9559
             if [[ "$CURRENT_IPFS_COMMIT" != "$IPFS_COMMIT" ]]; then
9606 9560
                 cd /home/git/go/src/github.com/ipfs/go-ipfs
9607
-                git stash
9608
-                git checkout master
9609
-                git pull
9610
-                git checkout $IPFS_COMMIT -b $IPFS_COMMIT
9561
+                git_pull $IPFS_COMMIT
9611 9562
                 sed -i "s/ipfs commit.*/ipfs commit:$IPFS_COMMIT/g" $COMPLETION_FILE
9612 9563
                 chown -R git:git /home/git
9613 9564
                 systemctl restart ipfs