Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
e6a937e5
Commit
e6a937e5
authored
8 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Move local restore of gogs to app script
parent
e3f0ae96
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/freedombone-app-gogs
+87
-11
87 additions, 11 deletions
src/freedombone-app-gogs
src/freedombone-restore-local
+1
-56
1 addition, 56 deletions
src/freedombone-restore-local
with
88 additions
and
67 deletions
src/freedombone-app-gogs
+
87
−
11
View file @
e6a937e5
...
...
@@ -50,21 +50,93 @@ function upgrade_gogs {
}
function
backup_local_gogs
{
if
grep
-q
"Gogs domain"
$COMPLETION_FILE
;
then
if
[
-d
/home/git/gogs-repositories
]
;
then
GIT_DOMAIN_NAME
=
$(
cat
$COMPLETION_FILE
|
grep
"Gogs domain"
|
awk
-F
':'
'{print $2}'
)
if
!
grep
-q
"Gogs domain"
$COMPLETION_FILE
;
then
return
fi
if
[
!
-d
/home/git/gogs-repositories
]
;
then
return
fi
GIT_DOMAIN_NAME
=
$(
cat
$COMPLETION_FILE
|
grep
"Gogs domain"
|
awk
-F
':'
'{print $2}'
)
echo
$"Backing up gogs"
function_check backup_database_to_usb
backup_database_to_usb gogs
echo
$"Backing up gogs"
function_check backup_directory_to_usb
backup_directory_to_usb
$GOPATH
/src/github.com/gogits/gogs/custom gogs
backup_directory_to_usb /home/git/gogs-repositories gogsrepos
backup_directory_to_usb /home/git/.ssh gogsssh
function_check backup_database_to_usb
backup_database_to_usb gogs
echo
$"Gogs backup complete"
}
function_check backup_directory_to_usb
backup_directory_to_usb
$GOPATH
/src/github.com/gogits/gogs/custom gogs
backup_directory_to_usb /home/git/gogs-repositories gogsrepos
backup_directory_to_usb /home/git/.ssh gogsssh
function
restore_local_gogs
{
if
!
grep
-q
"Gogs domain"
$COMPLETION_FILE
;
then
return
fi
if
[
!
-d
/home/git/gogs-repositories
]
;
then
return
fi
echo
$"Gogs backup complete"
GIT_DOMAIN_NAME
=
$(
cat
$COMPLETION_FILE
|
grep
"Gogs domain"
|
awk
-F
':'
'{print $2}'
)
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
[
${#
GIT_DOMAIN_NAME
}
-gt
2
]
;
then
function_check restore_database
restore_database gogs
${
GIT_DOMAIN_NAME
}
temp_restore_dir
=
/root/tempgogs
if
[
-d
$USB_MOUNT
/backup/gogs
]
;
then
echo
$"Restoring Gogs settings"
if
[
!
-d
$GOPATH
/src/github.com/gogits/gogs/custom
]
;
then
mkdir
-p
$GOPATH
/src/github.com/gogits/gogs/custom
fi
cp
-r
${
temp_restore_dir
}
/
$GOPATH
/src/github.com/gogits/gogs/custom/
*
$GOPATH
/src/github.com/gogits/gogs/custom
if
[
!
"
$?
"
=
"0"
]
;
then
function_check set_user_permissions
set_user_permissions
function_check backup_unmount_drive
backup_unmount_drive
exit
981
fi
echo
$"Restoring Gogs repos"
function_check restore_directory_from_usb
restore_directory_from_usb
${
temp_restore_dir
}
repos gogsrepos
cp
-r
${
temp_restore_dir
}
repos/home/git/gogs-repositories/
*
/home/git/gogs-repositories/
if
[
!
"
$?
"
=
"0"
]
;
then
function_check set_user_permissions
set_user_permissions
function_check backup_unmount_drive
backup_unmount_drive
exit
67574
fi
echo
$"Restoring Gogs authorized_keys"
function_check restore_directory_from_usb
restore_directory_from_usb
${
temp_restore_dir
}
ssh gogsssh
if
[
!
-d
/home/git/.ssh
]
;
then
mkdir
/home/git/.ssh
fi
cp
-r
${
temp_restore_dir
}
ssh/home/git/.ssh/
*
/home/git/.ssh/
if
[
!
"
$?
"
=
"0"
]
;
then
function_check set_user_permissions
set_user_permissions
function_check backup_unmount_drive
backup_unmount_drive
exit
8463
fi
rm
-rf
${
temp_restore_dir
}
rm
-rf
${
temp_restore_dir
}
repos
rm
-rf
${
temp_restore_dir
}
ssh
chown
-R
git:git /home/git
fi
fi
}
...
...
@@ -73,6 +145,10 @@ function backup_remote_gogs {
echo
-n
''
}
function
restore_remote_gogs
{
echo
-n
''
}
function
remove_gogs
{
if
!
grep
-Fxq
"install_gogs"
$COMPLETION_FILE
;
then
return
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-restore-local
+
1
−
56
View file @
e6a937e5
...
...
@@ -38,7 +38,7 @@ RESTORE_APP='all'
export
TEXTDOMAIN
=
${
PROJECT_NAME
}
-restore-local
export
TEXTDOMAINDIR
=
"/usr/share/locale"
# include utils which allow function_check and drive mount
# include utils which allow function_check
, go
and drive mount
UTILS_FILES
=
/usr/share/
${
PROJECT_NAME
}
/utils/
${
PROJECT_NAME
}
-utils-
*
for
f
in
$UTILS_FILES
do
...
...
@@ -980,60 +980,6 @@ function restore_mediagoblin {
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
[
${#
GIT_DOMAIN_NAME
}
-gt
2
]
;
then
restore_database gogs
${
GIT_DOMAIN_NAME
}
if
[
-d
$USB_MOUNT
/backup/gogs
]
;
then
echo
$"Restoring Gogs settings"
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
set_user_permissions
backup_unmount_drive
exit
981
fi
echo
$"Restoring Gogs repos"
restore_directory_from_usb /root/tempgogsrepos gogsrepos
cp
-r
/root/tempgogsrepos/home/git/gogs-repositories/
*
/home/git/gogs-repositories/
if
[
!
"
$?
"
=
"0"
]
;
then
set_user_permissions
backup_unmount_drive
exit
67574
fi
echo
$"Restoring Gogs authorized_keys"
restore_directory_from_usb /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
set_user_permissions
backup_unmount_drive
exit
8463
fi
rm
-rf
/root/tempgogs
rm
-rf
/root/tempgogsrepos
rm
-rf
/root/tempgogsssh
chown
-R
git:git /home/git
fi
fi
}
function
restore_email
{
if
[[
$RESTORE_APP
!=
'all'
]]
;
then
if
[[
$RESTORE_APP
!=
'email'
]]
;
then
...
...
@@ -1128,7 +1074,6 @@ restore_hubzilla
restore_rss
restore_syncthing
restore_mediagoblin
restore_gogs
restore_email
restore_apps
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment