Improved handling of Go version

This commit is contained in:
Bob Mottram 2016-04-29 13:55:17 +01:00
parent d334fbf399
commit 81ed974d4b
No known key found for this signature in database
GPG Key ID: BA68F26108DC9F87
5 changed files with 2286 additions and 2222 deletions

View File

@ -89,6 +89,8 @@ SSH_PORT=2222
IRC_PORT=6697 IRC_PORT=6697
IRC_ONION_PORT=6697 IRC_ONION_PORT=6697
GO_VERSION=1.5
# password used for accessing your repo mirrors # password used for accessing your repo mirrors
MY_MIRRORS_PASSWORD= MY_MIRRORS_PASSWORD=
# friend's repo mirrors # friend's repo mirrors
@ -2635,6 +2637,16 @@ function create_mirrors {
echo 'create_mirrors' >> $COMPLETION_FILE echo 'create_mirrors' >> $COMPLETION_FILE
} }
function select_go_version {
if [ ! -d $HOME/.gvm/scripts ]; then
echo $'GVM was not installed'
exit 629532
fi
cd $HOME/.gvm/scripts
gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH
}
function mesh_cjdns_tools { function mesh_cjdns_tools {
if grep -Fxq "mesh_cjdns_tools" $COMPLETION_FILE; then if grep -Fxq "mesh_cjdns_tools" $COMPLETION_FILE; then
return return
@ -2646,31 +2658,30 @@ function mesh_cjdns_tools {
mesh_cjdns mesh_cjdns
fi fi
select_go_version
apt-get -y install golang mercurial apt-get -y install golang mercurial
if [ ! -f ~/.bashrc ]; then if [ ! -f ~/.bashrc ]; then
touch ~/.bashrc touch ~/.bashrc
fi fi
export GOPATH=/home/git/go
if [ ! -d /home/git ]; then if [ ! -d /home/git ]; then
# add a gogs user account # add a gogs user account
adduser --disabled-login --gecos 'Gogs' git adduser --disabled-login --gecos 'Gogs' git
# install Go # install Go
export GOPATH=/home/git/go if ! grep -q "export GOPATH=" ~/.bashrc; then
if ! grep -q "export GOPATH=/home/git/go" ~/.bashrc; then echo "export GOPATH=$GOPATH" >> ~/.bashrc
echo 'export GOPATH=/home/git/go' >> ~/.bashrc
fi fi
systemctl set-environment GOPATH=/home/git/go systemctl set-environment GOPATH=$GOPATH
if ! grep -q "systemctl set-environment GOPATH=/home/git/go" ~/.bashrc; then if ! grep -q "systemctl set-environment GOPATH=" ~/.bashrc; then
echo 'systemctl set-environment GOPATH=/home/git/go' >> ~/.bashrc echo "systemctl set-environment GOPATH=$GOPATH" >> ~/.bashrc
fi fi
if [ ! -d $GOPATH ]; then if [ ! -d $GOPATH ]; then
mkdir -p $GOPATH mkdir -p $GOPATH
fi fi
fi fi
export GOPATH=$GOPATH
if ! grep -q "export GOPATH=" ~/.bashrc; then if ! grep -q "export GOPATH=" ~/.bashrc; then
echo "export GOPATH=$GOPATH" >> ~/.bashrc echo "export GOPATH=$GOPATH" >> ~/.bashrc
fi fi
@ -6309,12 +6320,12 @@ function upgrade_golang {
gvm install go1.4 gvm install go1.4
gvm use go1.4 gvm use go1.4
export GOROOT_BOOTSTRAP=$GOROOT export GOROOT_BOOTSTRAP=$GOROOT
gvm install go1.5 gvm install go${GO_VERSION}
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
echo $'Unable to upgrade golang' echo $'Unable to upgrade golang'
exit 529252 exit 529252
fi fi
gvm use go1.5 --default gvm use go${GO_VERSION} --default
if ! grep -q "gvm commit" $COMPLETION_FILE; then if ! grep -q "gvm commit" $COMPLETION_FILE; then
echo "gvm commit:$GVM_COMMIT" >> $COMPLETION_FILE echo "gvm commit:$GVM_COMMIT" >> $COMPLETION_FILE
@ -6333,8 +6344,7 @@ function install_gogs {
return return
fi fi
export GOPATH=/home/git/go select_go_version
systemctl set-environment GOPATH=/home/git/go
# update to the next commit # update to the next commit
set_repo_commit $GOPATH/src/github.com/gogits/gogs "Gogs commit" "$GOGS_COMMIT" $GIT_DOMAIN_REPO set_repo_commit $GOPATH/src/github.com/gogits/gogs "Gogs commit" "$GOGS_COMMIT" $GIT_DOMAIN_REPO
@ -6354,13 +6364,12 @@ function install_gogs {
# install Go # install Go
apt-get -y install golang libpam0g-dev apt-get -y install golang libpam0g-dev
export GOPATH=/home/git/go if ! grep -q "export GOPATH=" ~/.bashrc; then
if ! grep -q "export GOPATH=/home/git/go" ~/.bashrc; then echo "export GOPATH=$GOPATH" >> ~/.bashrc
echo 'export GOPATH=/home/git/go' >> ~/.bashrc
fi fi
systemctl set-environment GOPATH=/home/git/go systemctl set-environment GOPATH=$GOPATH
if ! grep -q "systemctl set-environment GOPATH=/home/git/go" ~/.bashrc; then if ! grep -q "systemctl set-environment GOPATH=" ~/.bashrc; then
echo 'systemctl set-environment GOPATH=/home/git/go' >> ~/.bashrc echo "systemctl set-environment GOPATH=$GOPATH" >> ~/.bashrc
fi fi
if [ ! -d $GOPATH ]; then if [ ! -d $GOPATH ]; then
mkdir -p $GOPATH mkdir -p $GOPATH
@ -6430,7 +6439,7 @@ function install_gogs {
echo $'Check "Enable Register Confirmation"' >> /home/$MY_USERNAME/README echo $'Check "Enable Register Confirmation"' >> /home/$MY_USERNAME/README
echo $'Check "Enable Mail Notification"' >> /home/$MY_USERNAME/README echo $'Check "Enable Mail Notification"' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README echo '' >> /home/$MY_USERNAME/README
echo $'After the initial install edit /home/git/go/src/github.com/gogits/gogs/custom/conf/app.ini' >> /home/$MY_USERNAME/README echo $"After the initial install edit ${GOPATH}/src/github.com/gogits/gogs/custom/conf/app.ini" >> /home/$MY_USERNAME/README
echo $'and within the [server] section set:' >> /home/$MY_USERNAME/README echo $'and within the [server] section set:' >> /home/$MY_USERNAME/README
echo " DOMAIN = $GIT_DOMAIN_NAME" >> /home/$MY_USERNAME/README echo " DOMAIN = $GIT_DOMAIN_NAME" >> /home/$MY_USERNAME/README
echo " ROOT_URL = http://$GIT_DOMAIN_NAME/" >> /home/$MY_USERNAME/README echo " ROOT_URL = http://$GIT_DOMAIN_NAME/" >> /home/$MY_USERNAME/README
@ -6456,14 +6465,14 @@ function install_gogs {
create_database gogs "$GOGS_ADMIN_PASSWORD" create_database gogs "$GOGS_ADMIN_PASSWORD"
chmod 600 /home/git/go/src/github.com/gogits/gogs/custom/conf/app.ini chmod 600 $GOPATH/src/github.com/gogits/gogs/custom/conf/app.ini
chown -R git:git /home/git chown -R git:git /home/git
cp $GOPATH/src/github.com/gogits/gogs/scripts/systemd/gogs.service /etc/systemd/system cp $GOPATH/src/github.com/gogits/gogs/scripts/systemd/gogs.service /etc/systemd/system
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=/home/git/go\"|g" /etc/systemd/system/gogs.service sed -i "s|Environment.*|Environment=\"USER=git\" \"HOME=/home/git\" \"GOPATH=$GOPATH\"|g" /etc/systemd/system/gogs.service
systemctl enable gogs systemctl enable gogs
systemctl daemon-reload systemctl daemon-reload
systemctl restart gogs systemctl restart gogs
@ -10079,11 +10088,10 @@ function install_ipfs {
return return
fi fi
export GOPATH=/home/git/go select_go_version
systemctl set-environment GOPATH=/home/git/go
# update to the next commit # update to the next commit
set_repo_commit /home/git/go/src/github.com/ipfs/go-ipfs "ipfs commit" "$IPFS_COMMIT" $IPFS_REPO set_repo_commit $GOPATH/src/github.com/ipfs/go-ipfs "ipfs commit" "$IPFS_COMMIT" $IPFS_REPO
if grep -Fxq "install_ipfs" $COMPLETION_FILE; then if grep -Fxq "install_ipfs" $COMPLETION_FILE; then
return return
@ -10096,21 +10104,19 @@ function install_ipfs {
adduser --disabled-login --gecos 'Gogs' git adduser --disabled-login --gecos 'Gogs' git
# install Go # install Go
export GOPATH=/home/git/go if ! grep -q "export GOPATH=" ~/.bashrc; then
if ! grep -q "export GOPATH=/home/git/go" ~/.bashrc; then echo "export GOPATH=$GOPATH" >> ~/.bashrc
echo 'export GOPATH=/home/git/go' >> ~/.bashrc
fi fi
systemctl set-environment GOPATH=/home/git/go systemctl set-environment GOPATH=$GOPATH
if ! grep -q "systemctl set-environment GOPATH=/home/git/go" ~/.bashrc; then if ! grep -q "systemctl set-environment GOPATH=" ~/.bashrc; then
echo 'systemctl set-environment GOPATH=/home/git/go' >> ~/.bashrc echo "systemctl set-environment GOPATH=$GOPATH" >> ~/.bashrc
fi fi
export GOPATH=/home/git/go
if [ ! -d $GOPATH ]; then if [ ! -d $GOPATH ]; then
mkdir -p $GOPATH mkdir -p $GOPATH
fi fi
fi fi
IPFS_PATH=/home/git/go/bin IPFS_PATH=$GOPATH/bin
export PATH="$GOPATH/bin:$PATH:" export PATH="$GOPATH/bin:$PATH:"
if ! grep -q 'GOPATH/bin' ~/.bashrc; then if ! grep -q 'GOPATH/bin' ~/.bashrc; then
echo 'export PATH="$GOPATH/bin:$PATH:";' >> ~/.bashrc echo 'export PATH="$GOPATH/bin:$PATH:";' >> ~/.bashrc
@ -10118,7 +10124,7 @@ function install_ipfs {
# set gopath for the user # set gopath for the user
if ! grep -q "GOPATH=" /home/$MY_USERNAME/.bashrc; then if ! grep -q "GOPATH=" /home/$MY_USERNAME/.bashrc; then
echo 'export GOPATH=/home/git/go' >> /home/$MY_USERNAME/.bashrc echo "export GOPATH=$GOPATH" >> /home/$MY_USERNAME/.bashrc
echo 'export PATH="$GOPATH/bin:$PATH:";' >> /home/$MY_USERNAME/.bashrc echo 'export PATH="$GOPATH/bin:$PATH:";' >> /home/$MY_USERNAME/.bashrc
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc
fi fi
@ -10129,7 +10135,7 @@ function install_ipfs {
exit 8242 exit 8242
fi fi
cd /home/git/go/src/$IPFS_GO_REPO2 cd $GOPATH/src/$IPFS_GO_REPO2
git checkout $IPFS_COMMIT -b $IPFS_COMMIT git checkout $IPFS_COMMIT -b $IPFS_COMMIT
if ! grep -q "ipfs commit" $COMPLETION_FILE; then if ! grep -q "ipfs commit" $COMPLETION_FILE; then
echo "ipfs commit:$IPFS_COMMIT" >> $COMPLETION_FILE echo "ipfs commit:$IPFS_COMMIT" >> $COMPLETION_FILE
@ -10171,7 +10177,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=/home/git/go\"" >> /etc/systemd/system/ipfs.service echo "Environment=\"USER=$MY_USERNAME\" \"HOME=/home/$MY_USERNAME\" \"GOPATH=$GOPATH\"" >> /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

@ -47,6 +47,13 @@ if [ -f $CONFIG_FILE ]; then
fi fi
fi 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}')
else
GO_VERSION=$(cat /usr/bin/${PROJECT_NAME} | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}')
fi
ADMIN_USERNAME= ADMIN_USERNAME=
ADMIN_NAME= ADMIN_NAME=
@ -370,6 +377,12 @@ function backup_users {
} }
function backup_directories { function backup_directories {
if [ -d $HOME/.gvm/scripts ]; then
cd $HOME/.gvm/scripts
gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH
fi
# directories to be backed up (source,dest) # directories to be backed up (source,dest)
backup_dirs=( backup_dirs=(
"none, none, /etc/letsencrypt, letsencrypt" "none, none, /etc/letsencrypt, letsencrypt"
@ -382,8 +395,8 @@ function backup_directories {
"none, none, /etc/nginx/sites-available, web" "none, none, /etc/nginx/sites-available, web"
"none, none, /home/$ADMIN_USERNAME/.ipfs, ipfs" "none, none, /home/$ADMIN_USERNAME/.ipfs, ipfs"
"none, none, /var/cache/minidlna, dlna" "none, none, /var/cache/minidlna, dlna"
"/home/git/go/src/github.com/gogits, gogs, /root/tempgogsdata, gogsdata" "$GOPATH/src/github.com/gogits, gogs, /root/tempgogsdata, gogsdata"
"none, none, /home/git/go/src/github.com/gogits/gogs/custom, gogs" "none, none, $GOPATH/src/github.com/gogits/gogs/custom, gogs"
"none, none, /home/git/gogs-repositories, gogsrepos" "none, none, /home/git/gogs-repositories, gogsrepos"
"none, none, /home/git/.ssh, gogsssh" "none, none, /home/git/.ssh, gogsssh"
"none, none, /var/lib/tox-bootstrapd, tox" "none, none, /var/lib/tox-bootstrapd, tox"
@ -451,8 +464,14 @@ function remove_backup_directory {
} }
function prepare_directories { function prepare_directories {
if [ -d $HOME/.gvm/scripts ]; then
cd $HOME/.gvm/scripts
gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH
fi
# Some miscellaneous preparation for backing up directories # Some miscellaneous preparation for backing up directories
if [ -d /home/git/go/src/github.com/gogits ]; then if [ -d $GOPATH/src/github.com/gogits ]; then
mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/$ADMIN_USERNAME mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/$ADMIN_USERNAME
fi fi
if [ -d /var/lib/tox-bootstrapd ]; then if [ -d /var/lib/tox-bootstrapd ]; then

View File

@ -40,6 +40,13 @@ export TEXTDOMAINDIR="/usr/share/locale"
# Temporary location for data to be backed up to other servers # Temporary location for data to be backed up to other servers
SERVER_DIRECTORY=/root/remotebackup SERVER_DIRECTORY=/root/remotebackup
# 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}')
else
GO_VERSION=$(cat /usr/bin/${PROJECT_NAME} | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}')
fi
ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}') ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
ADMIN_NAME=$(getent passwd $ADMIN_USERNAME | cut -d: -f5 | cut -d, -f1) ADMIN_NAME=$(getent passwd $ADMIN_USERNAME | cut -d: -f5 | cut -d, -f1)
ADMIN_EMAIL_ADDRESS=${ADMIN_USERNAME}@${HOSTNAME} ADMIN_EMAIL_ADDRESS=${ADMIN_USERNAME}@${HOSTNAME}
@ -367,13 +374,19 @@ function backup_mediagoblin {
} }
function backup_gogs { function backup_gogs {
if [ -d /home/git/go/src/github.com/gogits ]; then if [ -d $HOME/.gvm/scripts ]; then
cd $HOME/.gvm/scripts
gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH
fi
if [ -d $GOPATH/src/github.com/gogits ]; then
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}') GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
suspend_site ${GIT_DOMAIN_NAME} suspend_site ${GIT_DOMAIN_NAME}
backup_database_to_friend gogs backup_database_to_friend gogs
backup_directory_to_friend /root/tempgogsdata gogsdata backup_directory_to_friend /root/tempgogsdata gogsdata
echo $"Obtaining Gogs settings backup" echo $"Obtaining Gogs settings backup"
backup_directory_to_friend /home/git/go/src/github.com/gogits/gogs/custom gogs backup_directory_to_friend $GOPATH/src/github.com/gogits/gogs/custom gogs
echo $"Obtaining Gogs repos backup" echo $"Obtaining Gogs repos backup"
mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/bob mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/bob
backup_directory_to_friend /home/git/gogs-repositories gogsrepos backup_directory_to_friend /home/git/gogs-repositories gogsrepos

View File

@ -49,6 +49,13 @@ if [ -f $CONFIG_FILE ]; then
fi fi
fi 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}')
else
GO_VERSION=$(cat /usr/bin/${PROJECT_NAME} | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}')
fi
ADMIN_USERNAME= ADMIN_USERNAME=
ADMIN_NAME= ADMIN_NAME=
@ -922,6 +929,12 @@ function restore_mediagoblin {
} }
function restore_gogs { function restore_gogs {
if [ -d $HOME/.gvm/scripts ]; then
cd $HOME/.gvm/scripts
gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH
fi
if [[ $RESTORE_APP != 'all' ]]; then if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'gogs' ]]; then if [[ $RESTORE_APP != 'gogs' ]]; then
return return
@ -931,10 +944,10 @@ function restore_gogs {
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"
if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then if [ ! -d $GOPATH/src/github.com/gogits/gogs/custom ]; then
mkdir -p /home/git/go/src/github.com/gogits/gogs/custom mkdir -p $GOPATH/src/github.com/gogits/gogs/custom
fi fi
cp -r /root/tempgogs/home/git/go/src/github.com/gogits/gogs/custom/* /home/git/go/src/github.com/gogits/gogs/custom cp -r /root/tempgogs/$GOPATH/src/github.com/gogits/gogs/custom/* $GOPATH/src/github.com/gogits/gogs/custom
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
unmount_drive unmount_drive
exit 981 exit 981

View File

@ -87,6 +87,13 @@ else
echo "$NOW Restored encrypted data from $REMOTE_SERVER" >> /var/log/remotebackups.log echo "$NOW Restored encrypted data from $REMOTE_SERVER" >> /var/log/remotebackups.log
fi 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}')
else
GO_VERSION=$(cat /usr/bin/${PROJECT_NAME} | grep 'GO_VERSION=' | head -n 1 | awk -F '=' '{print $2}')
fi
# MariaDB password # MariaDB password
DATABASE_PASSWORD=$(cat /root/dbpass) DATABASE_PASSWORD=$(cat /root/dbpass)
@ -791,6 +798,12 @@ function restore_mediagoblin {
} }
function restore_gogs { function restore_gogs {
if [ -d $HOME/.gvm/scripts ]; then
cd $HOME/.gvm/scripts
gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH
fi
if [[ $RESTORE_APP != 'all' ]]; then if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'gogs' ]]; then if [[ $RESTORE_APP != 'gogs' ]]; then
return return
@ -800,10 +813,10 @@ function restore_gogs {
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}') GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
restore_database_from_friend gogs $GIT_DOMAIN_NAME restore_database_from_friend gogs $GIT_DOMAIN_NAME
if [ -d $SERVER_DIRECTORY/backup/gogs ]; then if [ -d $SERVER_DIRECTORY/backup/gogs ]; then
if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then if [ ! -d $GOPATH/src/github.com/gogits/gogs/custom ]; then
mkdir -p /home/git/go/src/github.com/gogits/gogs/custom mkdir -p $GOPATH/src/github.com/gogits/gogs/custom
fi fi
cp -r /root/tempgogs/home/git/go/src/github.com/gogits/gogs/custom/* /home/git/go/src/github.com/gogits/gogs/custom/ cp -r /root/tempgogs/$GOPATH/src/github.com/gogits/gogs/custom/* $GOPATH/src/github.com/gogits/gogs/custom/
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
exit 5885 exit 5885
fi fi