Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mkimage-profiles
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
mkimage-profiles
Commits
e355bd7c
Commit
e355bd7c
authored
Jun 21, 2012
by
Michael Shigorin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bashize tar2vm
Finally tired of expr(1) quirks, and even ash(1) does $((arithmetic-expansion))!
parent
0a5f164d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
tar2vm
bin/tar2vm
+5
-4
No files found.
bin/tar2vm
View file @
e355bd7c
#!/bin/sh -e
#!/bin/
ba
sh -e
.
shell-error
...
...
@@ -27,10 +27,10 @@ IMG="$2"
# image size in bytes (256M is a fallback)
TARSIZE
=
"
$(
stat
-Lc
%s
"
$TAR
"
)
"
DEFSIZE
=
"
$(
expr
3
'*'
"
$TARSIZE
"
'/'
2
)
"
DEFSIZE
=
"
$(
(
3
*
$TARSIZE
/
2
)
)
"
DISKSIZE
=
"
${
3
:-${
DEFSIZE
:-
268435456
}}
"
# ...and in megabytes
DISKSIZEM
=
"
$(
expr
"
$DISKSIZE
"
/ 1048576
)
"
DISKSIZEM
=
"
$(
(
$DISKSIZE
/
1048576
)
)
"
# tested to work: ext[234], jfs
ROOTFSTYPE
=
"
${
4
:-
ext4
}
"
...
...
@@ -68,7 +68,8 @@ trap exit_handler EXIT
# prepare disk image and a filesystem inside it
rm
-f
--
"
$IMG
"
dd
if
=
/dev/zero
of
=
"
$IMG
"
bs
=
1
count
=
1
seek
=
"
$DISKSIZE
"
conv
=
notrunc
dd
if
=
/dev/zero
of
=
"
$IMG
"
conv
=
notrunc
\
bs
=
1
count
=
1
seek
=
"
$((
$DISKSIZE
-
1
))
"
losetup
"
$LOOPDEV
"
"
$IMG
"
parted
--script
"
$LOOPDEV
"
mklabel msdos
...
...
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