From 17b438370e5bc15ff57e02baf14ff7a144dc83a1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 27 Jan 2016 09:38:44 +0000 Subject: [PATCH] trove enable git pull --- src/freedombone | 103 +++++++++++++----------------------------------- 1 file changed, 27 insertions(+), 76 deletions(-) diff --git a/src/freedombone b/src/freedombone index fcd2d35a..629ff592 100755 --- a/src/freedombone +++ b/src/freedombone @@ -557,17 +557,25 @@ function git_clone { function git_pull { git stash + git checkout master if [ "${FRIENDS_TROVE_SERVER}" ]; then if [ ${#FRIENDS_TROVE_SERVER} -gt 2 ]; then if [ "$FRIENDS_TROVE_PASSWORD" ]; then if [ ${#FRIENDS_TROVE_PASSWORD} -gt 2 ]; then sshpass -p "$FRIENDS_TROVE_PASSWORD" git pull + if [ $1 ]; then + git checkout $1 -b $1 + fi return fi fi fi fi git pull + + if [ $1 ]; then + git checkout $1 -b $1 + fi } function create_database { @@ -1964,10 +1972,7 @@ function mesh_cjdns { CURRENT_CJDNS_COMMIT=$(grep "cjdns commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_CJDNS_COMMIT" != "$CJDNS_COMMIT" ]]; then cd /etc/cjdns - git stash - git checkout master - git pull - git checkout $CJDNS_COMMIT -b $CJDNS_COMMIT + git_pull $CJDNS_COMMIT sed -i "s/cjdns commit.*/cjdns commit:$CJDNS_COMMIT/g" $COMPLETION_FILE ./do fi @@ -2019,7 +2024,7 @@ function mesh_cjdns { useradd cjdns else cd /etc/cjdns - git pull + git_pull ./do if [ ! "$?" = "0" ]; then exit 9926 @@ -2302,10 +2307,7 @@ function install_zeronet_blog { CURRENT_ZERONET_BLOG_COMMIT=$(grep "ZeroNet Blog commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_ZERONET_BLOG_COMMIT" != "$ZERONET_BLOG_COMMIT" ]]; then cd /opt/zeronet/ZeroBlog - git stash - git checkout master - git pull - git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT + git_pull $ZERONET_BLOG_COMMIT sed -i "s/ZeroNet Blog commit.*/ZeroNet Blog commit:$ZERONET_BLOG_COMMIT/g" $COMPLETION_FILE fi else @@ -2428,10 +2430,7 @@ function install_zeronet_mail { CURRENT_ZERONET_MAIL_COMMIT=$(grep "ZeroNet Mail commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_ZERONET_MAIL_COMMIT" != "$ZERONET_MAIL_COMMIT" ]]; then cd /opt/zeronet/ZeroMail - git stash - git checkout master - git pull - git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT + git_pull $ZERONET_MAIL_COMMIT sed -i "s/ZeroNet Mail commit.*/ZeroNet Mail commit:$ZERONET_MAIL_COMMIT/g" $COMPLETION_FILE fi else @@ -2555,10 +2554,7 @@ function install_zeronet_forum { CURRENT_ZERONET_FORUM_COMMIT=$(grep "ZeroNet Forum commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_ZERONET_FORUM_COMMIT" != "$ZERONET_FORUM_COMMIT" ]]; then cd /opt/zeronet/ZeroTalk - git stash - git checkout master - git pull - git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT + git_pull $ZERONET_FORUM_COMMIT sed -i "s/ZeroNet Forum commit.*/ZeroNet Forum commit:$ZERONET_FORUM_COMMIT/g" $COMPLETION_FILE fi else @@ -2676,10 +2672,7 @@ function install_zeronet { CURRENT_ZERONET_COMMIT=$(grep "ZeroNet commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_ZERONET_COMMIT" != "$ZERONET_COMMIT" ]]; then cd /opt/zeronet - git stash - git checkout master - git pull - git checkout $ZERONET_COMMIT -b $ZERONET_COMMIT + git_pull $ZERONET_COMMIT sed -i "s/ZeroNet commit.*/ZeroNet commit:$ZERONET_COMMIT/g" $COMPLETION_FILE systemctl restart zeronet.service fi @@ -5285,10 +5278,7 @@ function encrypt_incoming_email { CURRENT_GPGIT_COMMIT=$(grep "gpgit commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_GPGIT_COMMIT" != "$GPGIT_COMMIT" ]]; then cd $INSTALL_DIR/gpgit - git stash - git checkout master - git pull - git checkout $GPGIT_COMMIT -b $GPGIT_COMMIT + git_pull $GPGIT_COMMIT sed -i "s/gpgit commit.*/gpgit commit:$GPGIT_COMMIT/g" $COMPLETION_FILE cp gpgit.pl /usr/bin/gpgit.pl fi @@ -5600,10 +5590,7 @@ function email_archiving { CURRENT_CLEANUP_MAILDIR_COMMIT=$(grep "cleanup-maildir commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_CLEANUP_MAILDIR_COMMIT" != "$CLEANUP_MAILDIR_COMMIT" ]]; then cd $INSTALL_DIR/cleanup-maildir - git stash - git checkout master - git pull - git checkout $CLEANUP_MAILDIR_COMMIT -b $CLEANUP_MAILDIR_COMMIT + git_pull $CLEANUP_MAILDIR_COMMIT sed -i "s/cleanup-maildir commit.*/cleanup-maildir commit:$CLEANUP_MAILDIR_COMMIT/g" $COMPLETION_FILE cp $INSTALL_DIR/cleanup-maildir/cleanup-maildir /usr/bin fi @@ -5889,10 +5876,7 @@ function install_web_server { CURRENT_NGINX_ENSITE_COMMIT=$(grep "Nginx-ensite commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_NGINX_ENSITE_COMMIT" != "$NGINX_ENSITE_COMMIT" ]]; then $INSTALL_DIR/nginx_ensite - git stash - git checkout master - git pull - git checkout $NGINX_ENSITE_COMMIT -b $NGINX_ENSITE_COMMIT + git_pull $NGINX_ENSITE_COMMIT sed -i "s/Nginx-ensite commit.*/Nginx-ensite commit:$NGINX_ENSITE_COMMIT/g" $COMPLETION_FILE make install fi @@ -6158,10 +6142,7 @@ function install_owncloud_music_app { CURRENT_OWNCLOUD_MUSIC_APP_COMMIT=$(grep "Owncloud music app commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$OWNCLOUD_MUSIC_APP_COMMIT" != "$OWNCLOUD_MUSIC_APP_COMMIT" ]]; then cd /usr/share/owncloud/apps/music - git stash - git checkout master - git pull - git checkout $OWNCLOUD_MUSIC_APP_COMMIT -b $OWNCLOUD_MUSIC_APP_COMMIT + git_pull $OWNCLOUD_MUSIC_APP_COMMIT sed -i "s/Owncloud music app commit.*/Owncloud music app commit:$OWNCLOUD_MUSIC_APP_COMMIT/g" $COMPLETION_FILE fi else @@ -6623,13 +6604,7 @@ function install_gogs { CURRENT_GOGS_COMMIT=$(grep "Gogs commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_GOGS_COMMIT" != "$GOGS_COMMIT" ]]; then cd $GOPATH/src/github.com/gogits/gogs - git stash - git checkout master - git pull origin master - git checkout $GOGS_COMMIT -b $GOGS_COMMIT - if [ ! "$?" = "0" ]; then - git checkout $GOGS_COMMIT - fi + git_pull $GOGS_COMMIT sed -i "s/Gogs commit.*/Gogs commit:$GOGS_COMMIT/g" $COMPLETION_FILE go get -u ./... if [ ! "$?" = "0" ]; then @@ -6964,10 +6939,7 @@ function install_tox_node { CURRENT_TOX_COMMIT=$(grep "toxcore commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_TOX_COMMIT" != "$TOX_COMMIT" ]]; then cd $INSTALL_DIR/toxcore - git stash - git checkout master - git pull - git checkout $TOX_COMMIT -b $TOX_COMMIT + git_pull $TOX_COMMIT sed -i "s/toxcore commit.*/toxcore commit:$TOX_COMMIT/g" $COMPLETION_FILE autoreconf -i ./configure --enable-daemon @@ -7133,10 +7105,7 @@ function install_tox_client { CURRENT_TOXIC_COMMIT=$(grep "Toxic commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_TOXIC_COMMIT" != "$TOXIC_COMMIT" ]]; then cd $INSTALL_DIR/toxic - git stash - git checkout master - git pull - git checkout $TOXIC_COMMIT -b $TOXIC_COMMIT + git_pull $TOXIC_COMMIT sed -i "s/Toxic commit.*/Toxic commit:$TOXIC_COMMIT/g" $COMPLETION_FILE make make install @@ -7877,10 +7846,7 @@ function install_blog { CURRENT_FULLBLOG_COMMIT=$(grep "Blog commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_FULLBLOG_COMMIT" != "$FULLBLOG_COMMIT" ]]; then cd /var/www/$FULLBLOG_DOMAIN_NAME/htdocs - git stash - git checkout master - git pull - git checkout $FULLBLOG_COMMIT -b $FULLBLOG_COMMIT + git_pull $FULLBLOG_COMMIT sed -i "s/Blog commit.*/Blog commit:$FULLBLOG_COMMIT/g" $COMPLETION_FILE chown -R www-data:www-data /var/www/$FULLBLOG_DOMAIN_NAME/htdocs fi @@ -8257,10 +8223,7 @@ function install_gnu_social { CURRENT_GNUSOCIAL_COMMIT=$(grep "GNU Social commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_GNUSOCIAL_COMMIT" != "$GNUSOCIAL_COMMIT" ]]; then cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs - git stash - git checkout master - git pull - git checkout $GNUSOCIAL_COMMIT -b $GNUSOCIAL_COMMIT + git_pull $GNUSOCIAL_COMMIT sed -i "s/GNU Social commit.*/GNU Social commit:$GNUSOCIAL_COMMIT/g" $COMPLETION_FILE chown -R www-data:www-data /var/www/$MICROBLOG_DOMAIN_NAME/htdocs fi @@ -8625,10 +8588,7 @@ function install_hubzilla { CURRENT_HUBZILLA_COMMIT=$(grep "Hubzilla commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_HUBZILLA_COMMIT" != "$HUBZILLA_COMMIT" ]]; then cd /var/www/$HUBZILLA_DOMAIN_NAME/htdocs - git stash - git checkout master - git pull - git checkout $HUBZILLA_COMMIT -b $HUBZILLA_COMMIT + git_pull $HUBZILLA_COMMIT sed -i "s/Hubzilla commit.*/Hubzilla commit:$HUBZILLA_COMMIT/g" $COMPLETION_FILE chown -R www-data:www-data /var/www/$HUBZILLA_DOMAIN_NAME/htdocs fi @@ -8639,10 +8599,7 @@ function install_hubzilla { CURRENT_HUBZILLA_ADDONS_COMMIT=$(grep "Hubzilla addons commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_HUBZILLA_ADDONS_COMMIT" != "$HUBZILLA_ADDONS_COMMIT" ]]; then cd /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/addon - git stash - git checkout master - git pull - git checkout $HUBZILLA_ADDONS_COMMIT -b $HUBZILLA_ADDONS_COMMIT + git_pull $HUBZILLA_ADDONS_COMMIT sed -i "s/Hubzilla addons commit.*/Hubzilla addons commit:$HUBZILLA_ADDONS_COMMIT/g" $COMPLETION_FILE chown -R www-data:www-data /var/www/$HUBZILLA_DOMAIN_NAME/htdocs fi @@ -9487,10 +9444,7 @@ function install_dynamicdns { CURRENT_INADYN_COMMIT=$(grep "inadyn commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_INADYN_COMMIT" != "$INADYN_COMMIT" ]]; then cd $INSTALL_DIR/inadyn - git stash - git checkout master - git pull - git checkout $INADYN_COMMIT -b $INADYN_COMMIT + git_pull $INADYN_COMMIT sed -i "s/inadyn commit.*/inadyn commit:$INADYN_COMMIT/g" $COMPLETION_FILE ./configure USE_OPENSSL=1 make @@ -9604,10 +9558,7 @@ function install_ipfs { CURRENT_IPFS_COMMIT=$(grep "ipfs commit" $COMPLETION_FILE | awk -F ':' '{print $2}') if [[ "$CURRENT_IPFS_COMMIT" != "$IPFS_COMMIT" ]]; then cd /home/git/go/src/github.com/ipfs/go-ipfs - git stash - git checkout master - git pull - git checkout $IPFS_COMMIT -b $IPFS_COMMIT + git_pull $IPFS_COMMIT sed -i "s/ipfs commit.*/ipfs commit:$IPFS_COMMIT/g" $COMPLETION_FILE chown -R git:git /home/git systemctl restart ipfs