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
6c904ee9
Commit
6c904ee9
authored
7 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
We don't really need to backup mailpile
parent
364b57a3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-app-mailpile
+5
-104
5 additions, 104 deletions
src/freedombone-app-mailpile
with
5 additions
and
104 deletions
src/freedombone-app-mailpile
+
5
−
104
View file @
6c904ee9
...
...
@@ -13,7 +13,7 @@
# License
# =======
#
# Copyright (C) 2016 Bob Mottram <bob@freedombone.net>
# Copyright (C) 2016
-2017
Bob Mottram <bob@freedombone.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -110,118 +110,19 @@ function upgrade_mailpile {
}
function
backup_local_mailpile
{
if
[
!
-f
/etc/systemd/system/mailpile.service
]
;
then
return
fi
MAILPILE_DOMAIN_NAME
=
'mailpile.local'
if
grep
-q
"mailpile domain"
$COMPLETION_FILE
;
then
MAILPILE_DOMAIN_NAME
=
$(
get_completion_param
"mailpile domain"
)
fi
source_directory
=
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.local
if
[
-d
$source_directory
]
;
then
systemctl stop mailpile
function_check backup_directory_to_usb
backup_directory_to_usb
$source_directory
mailpile
systemctl start mailpile
fi
echo
-n
''
}
function
restore_local_mailpile
{
if
[
!
-f
/etc/systemd/system/mailpile.service
]
;
then
return
fi
MAILPILE_DOMAIN_NAME
=
'mailpile.local'
if
grep
-q
"mailpile domain"
$COMPLETION_FILE
;
then
MAILPILE_DOMAIN_NAME
=
$(
get_completion_param
"mailpile domain"
)
fi
if
[
$MAILPILE_DOMAIN_NAME
]
;
then
systemctl stop mailpile
temp_restore_dir
=
/root/tempmailpile
restore_directory_from_usb
$temp_restore_dir
mailpile
if
[
-d
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.local
]
;
then
mv
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.local /var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.previous
fi
temp_source_dir
=
$(
find
${
temp_restore_dir
}
-name
".local"
)
cp
-r
${
temp_source_dir
}
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/
if
[
!
"
$?
"
=
"0"
]
;
then
if
[
-d
mv
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.previous
]
;
then
if
[
-d
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.previous
]
;
then
rm
-rf
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.previous
fi
mv
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.previous /var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.local
fi
backup_unmount_drive
exit
3685
fi
rm
-rf
${
temp_restore_dir
}
chown
-R
mailpile: /var/www/
$MAILPILE_DOMAIN_NAME
/mail/
if
[
-d
/etc/letsencrypt/live/
${
MAILPILE_DOMAIN_NAME
}
]
;
then
ln
-s
/etc/letsencrypt/live/
${
MAILPILE_DOMAIN_NAME
}
/privkey.pem /etc/ssl/private/
${
MAILPILE_DOMAIN_NAME
}
.key
ln
-s
/etc/letsencrypt/live/
${
MAILPILE_DOMAIN_NAME
}
/fullchain.pem /etc/ssl/certs/
${
MAILPILE_DOMAIN_NAME
}
.pem
fi
systemctl start mailpile
fi
echo
-n
''
}
function
backup_remote_mailpile
{
if
[
!
-f
/etc/systemd/system/mailpile.service
]
;
then
return
fi
MAILPILE_DOMAIN_NAME
=
'mailpile.local'
if
grep
-q
"mailpile domain"
$COMPLETION_FILE
;
then
MAILPILE_DOMAIN_NAME
=
$(
get_completion_param
"mailpile domain"
)
fi
source_directory
=
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.local
if
[
-d
$source_directory
]
;
then
systemctl stop mailpile
function_check backup_directory_to_usb
backup_directory_to_friend
$source_directory
mailpile
systemctl start mailpile
fi
echo
-n
''
}
function
restore_remote_mailpile
{
if
[
!
-f
/etc/systemd/system/mailpile.service
]
;
then
return
fi
MAILPILE_DOMAIN_NAME
=
'mailpile.local'
if
grep
-q
"mailpile domain"
$COMPLETION_FILE
;
then
MAILPILE_DOMAIN_NAME
=
$(
get_completion_param
"mailpile domain"
)
fi
if
[
$MAILPILE_DOMAIN_NAME
]
;
then
systemctl stop mailpile
temp_restore_dir
=
/root/tempmailpile
restore_directory_from_friend
$temp_restore_dir
mailpile
if
[
-d
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.local
]
;
then
mv
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.local /var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.previous
fi
temp_source_dir
=
$(
find
${
temp_restore_dir
}
-name
".local"
)
cp
-r
${
temp_source_dir
}
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/
if
[
!
"
$?
"
=
"0"
]
;
then
if
[
-d
mv
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.previous
]
;
then
mv
/var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.previous /var/www/
${
MAILPILE_DOMAIN_NAME
}
/mail/.local
fi
backup_unmount_drive
exit
36732
fi
rm
-rf
${
temp_restore_dir
}
chown
-R
mailpile: /var/www/
$MAILPILE_DOMAIN_NAME
/mail/
if
[
-d
/etc/letsencrypt/live/
${
MAILPILE_DOMAIN_NAME
}
]
;
then
ln
-s
/etc/letsencrypt/live/
${
MAILPILE_DOMAIN_NAME
}
/privkey.pem /etc/ssl/private/
${
MAILPILE_DOMAIN_NAME
}
.key
ln
-s
/etc/letsencrypt/live/
${
MAILPILE_DOMAIN_NAME
}
/fullchain.pem /etc/ssl/certs/
${
MAILPILE_DOMAIN_NAME
}
.pem
fi
systemctl start mailpile
fi
echo
-n
''
}
function
remove_mailpile
{
...
...
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