From c1c99f42f94798cea2d6c978e268589749cf96bb Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 9 May 2016 18:32:17 +0100 Subject: [PATCH] standardise gvm_home --- src/freedombone | 4 ++-- src/freedombone-backup-local | 6 ++++-- src/freedombone-backup-remote | 2 +- src/freedombone-restore-local | 6 ++++-- src/freedombone-restore-remote | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/freedombone b/src/freedombone index 1c5c8240..8c49ccb0 100755 --- a/src/freedombone +++ b/src/freedombone @@ -6561,7 +6561,7 @@ function install_gogs { sed -i 's|#After=mysqld.service|After=mysqld.service|g' /etc/systemd/system/gogs.service sed -i "s|WorkingDirectory=.*|WorkingDirectory=$GOPATH/src/github.com/gogits/gogs|g" /etc/systemd/system/gogs.service sed -i "s|ExecStart=.*|ExecStart=$GOPATH/src/github.com/gogits/gogs/gogs web|g" /etc/systemd/system/gogs.service - sed -i "s|Environment.*|Environment=\"USER=git\" \"HOME=/home/git\" \"GOPATH=$GOPATH\" \"GVM_ROOT=/home/git/.gvm\"|g" /etc/systemd/system/gogs.service + sed -i "s|Environment.*|Environment=\"USER=git\" \"HOME=/home/git\" \"GOPATH=$GOPATH\" \"GVM_ROOT=$GVM_HOME\"|g" /etc/systemd/system/gogs.service systemctl enable gogs systemctl daemon-reload systemctl restart gogs @@ -10274,7 +10274,7 @@ function install_ipfs { echo "WorkingDirectory=/home/$MY_USERNAME" >> /etc/systemd/system/ipfs.service echo "ExecStart=$IPFS_PATH/ipfs daemon --mount" >> /etc/systemd/system/ipfs.service echo 'Restart=on-failure' >> /etc/systemd/system/ipfs.service - echo "Environment=\"USER=$MY_USERNAME\" \"HOME=/home/$MY_USERNAME\" \"GOPATH=$GOPATH\" \"GVM_ROOT=/home/git/.gvm\"" >> /etc/systemd/system/ipfs.service + echo "Environment=\"USER=$MY_USERNAME\" \"HOME=/home/$MY_USERNAME\" \"GOPATH=$GOPATH\" \"GVM_ROOT=$GVM_HOME\"" >> /etc/systemd/system/ipfs.service echo '' >> /etc/systemd/system/ipfs.service echo '[Install]' >> /etc/systemd/system/ipfs.service echo 'WantedBy=multi-user.target' >> /etc/systemd/system/ipfs.service diff --git a/src/freedombone-backup-local b/src/freedombone-backup-local index e6ab1d2a..7710425e 100755 --- a/src/freedombone-backup-local +++ b/src/freedombone-backup-local @@ -50,8 +50,10 @@ fi # get the version of Go being used if [ -f /usr/local/bin/${PROJECT_NAME} ]; then GO_VERSION=$(cat /usr/local/bin/${PROJECT_NAME} | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') + GVM_HOME=$(cat /usr/local/bin/${PROJECT_NAME} | grep 'GVM_HOME=' | head -n 1 | awk -F '=' '{print $2}') else GO_VERSION=$(cat /usr/bin/${PROJECT_NAME} | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') + GVM_HOME=$(cat /usr/bin/${PROJECT_NAME} | grep 'GVM_HOME=' | head -n 1 | awk -F '=' '{print $2}') fi ADMIN_USERNAME= @@ -383,7 +385,7 @@ function backup_users { } function backup_directories { - export GVM_ROOT=$HOME/.gvm + export GVM_ROOT=$GVM_HOME if [ -d $GVM_ROOT/bin ]; then cd $GVM_ROOT/bin [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" @@ -472,7 +474,7 @@ function remove_backup_directory { } function prepare_directories { - export GVM_ROOT=$HOME/.gvm + export GVM_ROOT=$GVM_HOME if [ -d $GVM_ROOT/bin ]; then cd $GVM_ROOT/bin [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" diff --git a/src/freedombone-backup-remote b/src/freedombone-backup-remote index 7e38f544..1b62d300 100755 --- a/src/freedombone-backup-remote +++ b/src/freedombone-backup-remote @@ -380,7 +380,7 @@ function backup_mediagoblin { } function backup_gogs { - export GVM_ROOT=$HOME/.gvm + export GVM_ROOT=/home/git/gvm if [ -d $GVM_ROOT/bin ]; then cd $GVM_ROOT/bin [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" diff --git a/src/freedombone-restore-local b/src/freedombone-restore-local index 6c97220d..015d7e37 100755 --- a/src/freedombone-restore-local +++ b/src/freedombone-restore-local @@ -52,8 +52,10 @@ fi # get the version of Go being used if [ -f /usr/local/bin/${PROJECT_NAME} ]; then GO_VERSION=$(cat /usr/local/bin/${PROJECT_NAME} | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') + GVM_HOME=$(cat /usr/local/bin/${PROJECT_NAME} | grep 'GVM_HOME=' | head -n 1 | awk -F '=' '{print $2}') else GO_VERSION=$(cat /usr/bin/${PROJECT_NAME} | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') + GVM_HOME=$(cat /usr/bin/${PROJECT_NAME} | grep 'GVM_HOME=' | head -n 1 | awk -F '=' '{print $2}') fi ADMIN_USERNAME= @@ -978,7 +980,7 @@ function restore_mediagoblin { } function restore_gogs { - export GVM_ROOT=$HOME/.gvm + export GVM_ROOT=$GVM_HOME if [ -d $GVM_ROOT/bin ]; then cd $GVM_ROOT/bin [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" @@ -991,7 +993,7 @@ function restore_gogs { return fi fi - if [ $GIT_DOMAIN_NAME ]; then + if [ ${#GIT_DOMAIN_NAME} -gt 2 ]; then restore_database gogs ${GIT_DOMAIN_NAME} if [ -d $USB_MOUNT/backup/gogs ]; then echo $"Restoring Gogs settings" diff --git a/src/freedombone-restore-remote b/src/freedombone-restore-remote index f5ac0728..113e045d 100755 --- a/src/freedombone-restore-remote +++ b/src/freedombone-restore-remote @@ -846,7 +846,7 @@ function restore_mediagoblin { } function restore_gogs { - export GVM_ROOT=$HOME/.gvm + export GVM_ROOT=$GVM_HOME if [ -d $GVM_ROOT/bin ]; then cd $GVM_ROOT/bin [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"