Move remote gogs restore to app script
This commit is contained in:
parent
ffb76f5d1d
commit
cd3aac7c3b
|
@ -184,7 +184,48 @@ function backup_remote_gogs {
|
|||
}
|
||||
|
||||
function restore_remote_gogs {
|
||||
echo -n ''
|
||||
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"
|
||||
gvm use go${GO_VERSION} --default
|
||||
systemctl set-environment GOPATH=$GOPATH
|
||||
fi
|
||||
|
||||
if grep -q "Gogs domain" $COMPLETION_FILE; then
|
||||
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
|
||||
function_check restore_database_from_friend
|
||||
restore_database_from_friend gogs $GIT_DOMAIN_NAME
|
||||
if [ -d $SERVER_DIRECTORY/backup/gogs ]; then
|
||||
if [ ! -d $GOPATH/src/github.com/gogits/gogs/custom ]; then
|
||||
mkdir -p $GOPATH/src/github.com/gogits/gogs/custom
|
||||
fi
|
||||
cp -r /root/tempgogs/$GOPATH/src/github.com/gogits/gogs/custom/* $GOPATH/src/github.com/gogits/gogs/custom/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 5885
|
||||
fi
|
||||
echo $"Restoring Gogs repos"
|
||||
restore_directory_from_friend /root/tempgogsrepos gogsrepos
|
||||
cp -r /root/tempgogsrepos/home/git/gogs-repositories/* /home/git/gogs-repositories/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 7649
|
||||
fi
|
||||
echo $"Restoring Gogs authorized_keys"
|
||||
restore_directory_from_friend /root/tempgogsssh gogsssh
|
||||
if [ ! -d /home/git/.ssh ]; then
|
||||
mkdir /home/git/.ssh
|
||||
fi
|
||||
cp -r /root/tempgogsssh/home/git/.ssh/* /home/git/.ssh/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 74239
|
||||
fi
|
||||
rm -rf /root/tempgogs
|
||||
rm -rf /root/tempgogsrepos
|
||||
rm -rf /root/tempgogsssh
|
||||
chown -R git:git /home/git
|
||||
echo $"Restore of Gogs complete"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function remove_gogs {
|
||||
|
|
|
@ -666,54 +666,6 @@ function restore_mailing_list {
|
|||
fi
|
||||
}
|
||||
|
||||
function restore_gogs {
|
||||
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"
|
||||
gvm use go${GO_VERSION} --default
|
||||
systemctl set-environment GOPATH=$GOPATH
|
||||
fi
|
||||
|
||||
if [[ $RESTORE_APP != 'all' ]]; then
|
||||
if [[ $RESTORE_APP != 'gogs' ]]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
if grep -q "Gogs domain" $COMPLETION_FILE; then
|
||||
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
|
||||
restore_database_from_friend gogs $GIT_DOMAIN_NAME
|
||||
if [ -d $SERVER_DIRECTORY/backup/gogs ]; then
|
||||
if [ ! -d $GOPATH/src/github.com/gogits/gogs/custom ]; then
|
||||
mkdir -p $GOPATH/src/github.com/gogits/gogs/custom
|
||||
fi
|
||||
cp -r /root/tempgogs/$GOPATH/src/github.com/gogits/gogs/custom/* $GOPATH/src/github.com/gogits/gogs/custom/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 5885
|
||||
fi
|
||||
echo $"Restoring Gogs repos"
|
||||
restore_directory_from_friend /root/tempgogsrepos gogsrepos
|
||||
cp -r /root/tempgogsrepos/home/git/gogs-repositories/* /home/git/gogs-repositories/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 7649
|
||||
fi
|
||||
echo $"Restoring Gogs authorized_keys"
|
||||
restore_directory_from_friend /root/tempgogsssh gogsssh
|
||||
if [ ! -d /home/git/.ssh ]; then
|
||||
mkdir /home/git/.ssh
|
||||
fi
|
||||
cp -r /root/tempgogsssh/home/git/.ssh/* /home/git/.ssh/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 74239
|
||||
fi
|
||||
rm -rf /root/tempgogs
|
||||
rm -rf /root/tempgogsrepos
|
||||
rm -rf /root/tempgogsssh
|
||||
chown -R git:git /home/git
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function restore_wiki {
|
||||
if [[ $RESTORE_APP != 'all' ]]; then
|
||||
if [[ $RESTORE_APP != 'wiki' ]]; then
|
||||
|
@ -934,7 +886,6 @@ restore_mailing_list
|
|||
restore_email
|
||||
#restore_apps remote
|
||||
|
||||
restore_gogs
|
||||
restore_wiki
|
||||
restore_blog
|
||||
restore_cjdns
|
||||
|
|
Loading…
Reference in New Issue