Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
64fdb4dd
Commit
64fdb4dd
authored
Mar 04, 2015
by
Toilal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Behave nicely when mailinabox.version file is missing
parent
1be0f39b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
migrate.py
setup/migrate.py
+12
-3
start.sh
setup/start.sh
+4
-0
No files found.
setup/migrate.py
View file @
64fdb4dd
...
...
@@ -84,13 +84,22 @@ def run_migrations():
env
=
load_environment
()
migration_id_file
=
os
.
path
.
join
(
env
[
'STORAGE_ROOT'
],
'mailinabox.version'
)
migration_id
=
None
if
os
.
path
.
exists
(
migration_id_file
):
with
open
(
migration_id_file
)
as
f
:
ourver
=
int
(
f
.
read
()
.
strip
())
else
:
migration_id
=
f
.
read
()
.
strip
();
if
migration_id
is
None
:
# Load the legacy location of the migration ID. We'll drop support
# for this eventually.
ourver
=
int
(
env
.
get
(
"MIGRATIONID"
,
"0"
))
migration_id
=
env
.
get
(
"MIGRATIONID"
)
if
migration_id
is
None
:
print
()
print
(
"
%
s file doesn't exists. Skipping migration..."
%
(
migration_id_file
,))
return
ourver
=
int
(
migration_id
)
while
True
:
next_ver
=
(
ourver
+
1
)
...
...
setup/start.sh
View file @
64fdb4dd
...
...
@@ -109,6 +109,10 @@ fi
# Create the STORAGE_ROOT if it not exists
if
[
!
-d
$STORAGE_ROOT
]
;
then
mkdir
-p
$STORAGE_ROOT
fi
# Create mailinabox.version file if not exists
if
[
!
-f
$STORAGE_ROOT
/mailinabox.version
]
;
then
echo
$(
setup/migrate.py
--current
)
>
$STORAGE_ROOT
/mailinabox.version
chown
$STORAGE_USER
.
$STORAGE_USER
$STORAGE_ROOT
/mailinabox.version
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment