Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
d07aa6ce
"...resnet50_tensorflow.git" did not exist on "d73569c595a3380962774d9dc84b2e735768bce1"
Commit
d07aa6ce
authored
May 14, 2021
by
longpanda
Browse files
Add -o option in CreatePersistentImg.sh (#903)
parent
93996cf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
INSTALL/CreatePersistentImg.sh
INSTALL/CreatePersistentImg.sh
+11
-2
No files found.
INSTALL/CreatePersistentImg.sh
View file @
d07aa6ce
...
@@ -4,6 +4,7 @@ size=1024
...
@@ -4,6 +4,7 @@ size=1024
fstype
=
ext4
fstype
=
ext4
label
=
casper-rw
label
=
casper-rw
config
=
''
config
=
''
outputfile
=
persistence.dat
print_usage
()
{
print_usage
()
{
echo
'Usage: CreatePersistentImg.sh [ -s size ] [ -t fstype ] [ -l LABEL ] [ -c CFG ]'
echo
'Usage: CreatePersistentImg.sh [ -s size ] [ -t fstype ] [ -l LABEL ] [ -c CFG ]'
...
@@ -12,6 +13,7 @@ print_usage() {
...
@@ -12,6 +13,7 @@ print_usage() {
echo
' -t filesystem type, default is ext4 ext2/ext3/ext4/xfs are supported now'
echo
' -t filesystem type, default is ext4 ext2/ext3/ext4/xfs are supported now'
echo
' -l label, default is casper-rw'
echo
' -l label, default is casper-rw'
echo
' -c configfile name inside the persistence file. File content is "/ union"'
echo
' -c configfile name inside the persistence file. File content is "/ union"'
echo
' -o outputfile name, default is persistence.dat'
echo
''
echo
''
}
}
...
@@ -28,6 +30,9 @@ while [ -n "$1" ]; do
...
@@ -28,6 +30,9 @@ while [ -n "$1" ]; do
elif
[
"
$1
"
=
"-c"
]
;
then
elif
[
"
$1
"
=
"-c"
]
;
then
shift
shift
config
=
$1
config
=
$1
elif
[
"
$1
"
=
"-o"
]
;
then
shift
outputfile
=
$1
elif
[
"
$1
"
=
"-h"
]
||
[
"
$1
"
=
"--help"
]
;
then
elif
[
"
$1
"
=
"-h"
]
||
[
"
$1
"
=
"--help"
]
;
then
print_usage
print_usage
exit
0
exit
0
...
@@ -69,13 +74,17 @@ else
...
@@ -69,13 +74,17 @@ else
exit
1
exit
1
fi
fi
if
[
"
$outputdir
"
!=
"persistence.dat"
]
;
then
mkdir
-p
"
$(
dirname
"
$outputfile
"
)
"
fi
# 00->ff avoid sparse file
# 00->ff avoid sparse file
dd
if
=
/dev/zero
bs
=
1M
count
=
$size
|
tr
'\000'
'\377'
>
persistence.dat
dd
if
=
/dev/zero
bs
=
1M
count
=
$size
|
tr
'\000'
'\377'
>
"
$outputfile
"
sync
sync
freeloop
=
$(
losetup
-f
)
freeloop
=
$(
losetup
-f
)
losetup
$freeloop
persistence.dat
losetup
$freeloop
"
$outputfile
"
mkfs
-t
$fstype
$fsopt
-L
$label
$freeloop
mkfs
-t
$fstype
$fsopt
-L
$label
$freeloop
...
...
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