Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.toolbox
Commits
89a14af6
Commit
89a14af6
authored
Dec 29, 2011
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support dynamic offset calculation
parent
aa9adc87
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
+18
-5
CHANGES.txt
CHANGES.txt
+2
-2
setup.py
setup.py
+1
-1
slapos/builder/__init__.py
slapos/builder/__init__.py
+15
-2
No files found.
CHANGES.txt
View file @
89a14af6
0.12 (2011-12-2
4
)
0.12 (2011-12-2
9
)
=================
*
No changes yet.
*
builder: dynamic offset calculation [Romain Courteaud]
0.11 (2011-12-23)
=================
...
...
setup.py
View file @
89a14af6
...
...
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
import
glob
import
os
version
=
'0.12
-dev
'
version
=
'0.12'
name
=
'slapos.toolbox'
long_description
=
open
(
"README.txt"
).
read
()
+
"
\
n
"
+
\
open
(
"CHANGES.txt"
).
read
()
+
"
\
n
"
...
...
slapos/builder/__init__.py
View file @
89a14af6
...
...
@@ -30,7 +30,7 @@ import sys
from
optparse
import
OptionParser
,
Option
from
subprocess
import
call
as
subprocessCall
from
stat
import
S_ISBLK
,
ST_MODE
from
tempfile
import
mkdtemp
from
tempfile
import
mkdtemp
,
mkstemp
import
shutil
import
pkg_resources
...
...
@@ -138,10 +138,23 @@ def run(config):
print
"Creating temp directory"
if
not
dry_run
:
mount_dir_path
=
mkdtemp
()
fdisk_output_path
=
mkstemp
()
else
:
mount_dir_path
=
"/tmp/a_generated_directory"
fdisk_output_path
=
"/tmp/a_generated_file"
try
:
_call
([
'mount'
,
'-o'
,
'loop,offset=32256'
,
config
.
system_path
,
offset
=
0
fdisk_output_file
=
open
(
fdisk_output_path
,
'w'
)
_call
([
'sfdisk'
,
'-d'
,
'-uS'
,
config
.
system_path
],
stdout
=
fdisk_output_file
)
fdisk_output_file
.
close
()
fdisk_output_file
=
open
(
fdisk_output_path
,
'r'
)
for
line
in
fdisk_output_file
:
line
=
line
.
rstrip
().
replace
(
' '
,
''
)
if
line
.
endswith
(
"bootable"
):
offset
=
int
(
line
.
split
(
':'
)[
1
].
split
(
','
)[
0
].
split
(
'='
)[
1
])
fdisk_output_file
.
close
()
offset
=
offset
*
512
_call
([
'mount'
,
'-o'
,
'loop,offset=%i'
%
offset
,
config
.
system_path
,
mount_dir_path
],
dry_run
=
dry_run
)
try
:
# Create slapos configuration directory if needed
...
...
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