standardise gvm_home

This commit is contained in:
Bob Mottram 2016-05-09 18:32:17 +01:00
parent d70d6d97b4
commit c1c99f42f9
5 changed files with 12 additions and 8 deletions

View File

@ -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|#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|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|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 enable gogs
systemctl daemon-reload systemctl daemon-reload
systemctl restart gogs systemctl restart gogs
@ -10274,7 +10274,7 @@ function install_ipfs {
echo "WorkingDirectory=/home/$MY_USERNAME" >> /etc/systemd/system/ipfs.service echo "WorkingDirectory=/home/$MY_USERNAME" >> /etc/systemd/system/ipfs.service
echo "ExecStart=$IPFS_PATH/ipfs daemon --mount" >> /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 '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 '' >> /etc/systemd/system/ipfs.service
echo '[Install]' >> /etc/systemd/system/ipfs.service echo '[Install]' >> /etc/systemd/system/ipfs.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/ipfs.service echo 'WantedBy=multi-user.target' >> /etc/systemd/system/ipfs.service

View File

@ -50,8 +50,10 @@ fi
# get the version of Go being used # get the version of Go being used
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then 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}') 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 else
GO_VERSION=$(cat /usr/bin/${PROJECT_NAME} | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') 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 fi
ADMIN_USERNAME= ADMIN_USERNAME=
@ -383,7 +385,7 @@ function backup_users {
} }
function backup_directories { function backup_directories {
export GVM_ROOT=$HOME/.gvm export GVM_ROOT=$GVM_HOME
if [ -d $GVM_ROOT/bin ]; then if [ -d $GVM_ROOT/bin ]; then
cd $GVM_ROOT/bin cd $GVM_ROOT/bin
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
@ -472,7 +474,7 @@ function remove_backup_directory {
} }
function prepare_directories { function prepare_directories {
export GVM_ROOT=$HOME/.gvm export GVM_ROOT=$GVM_HOME
if [ -d $GVM_ROOT/bin ]; then if [ -d $GVM_ROOT/bin ]; then
cd $GVM_ROOT/bin cd $GVM_ROOT/bin
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"

View File

@ -380,7 +380,7 @@ function backup_mediagoblin {
} }
function backup_gogs { function backup_gogs {
export GVM_ROOT=$HOME/.gvm export GVM_ROOT=/home/git/gvm
if [ -d $GVM_ROOT/bin ]; then if [ -d $GVM_ROOT/bin ]; then
cd $GVM_ROOT/bin cd $GVM_ROOT/bin
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"

View File

@ -52,8 +52,10 @@ fi
# get the version of Go being used # get the version of Go being used
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then 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}') 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 else
GO_VERSION=$(cat /usr/bin/${PROJECT_NAME} | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}') 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 fi
ADMIN_USERNAME= ADMIN_USERNAME=
@ -978,7 +980,7 @@ function restore_mediagoblin {
} }
function restore_gogs { function restore_gogs {
export GVM_ROOT=$HOME/.gvm export GVM_ROOT=$GVM_HOME
if [ -d $GVM_ROOT/bin ]; then if [ -d $GVM_ROOT/bin ]; then
cd $GVM_ROOT/bin cd $GVM_ROOT/bin
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
@ -991,7 +993,7 @@ function restore_gogs {
return return
fi fi
fi fi
if [ $GIT_DOMAIN_NAME ]; then if [ ${#GIT_DOMAIN_NAME} -gt 2 ]; then
restore_database gogs ${GIT_DOMAIN_NAME} restore_database gogs ${GIT_DOMAIN_NAME}
if [ -d $USB_MOUNT/backup/gogs ]; then if [ -d $USB_MOUNT/backup/gogs ]; then
echo $"Restoring Gogs settings" echo $"Restoring Gogs settings"

View File

@ -846,7 +846,7 @@ function restore_mediagoblin {
} }
function restore_gogs { function restore_gogs {
export GVM_ROOT=$HOME/.gvm export GVM_ROOT=$GVM_HOME
if [ -d $GVM_ROOT/bin ]; then if [ -d $GVM_ROOT/bin ]; then
cd $GVM_ROOT/bin cd $GVM_ROOT/bin
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"