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
d402338a
".github/vscode:/vscode.git/clone" did not exist on "b62e7e99b80e3df5f34916de95d0324200ee032d"
Commit
d402338a
authored
Nov 19, 2021
by
longpanda
Browse files
Optimization for shell script (#1259)
parent
d938100e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
24 deletions
+47
-24
INSTALL/tool/ventoy_lib.sh
INSTALL/tool/ventoy_lib.sh
+47
-24
No files found.
INSTALL/tool/ventoy_lib.sh
View file @
d402338a
...
...
@@ -241,6 +241,11 @@ format_ventoy_disk_mbr() {
vtdebug
"part1_start_sector=
$part1_start_sector
part1_end_sector=
$part1_end_sector
"
vtdebug
"part2_start_sector=
$part2_start_sector
part2_end_sector=
$part2_end_sector
"
if
[
-e
$PART1
]
;
then
echo
"delete
$PART1
"
rm
-f
$PART1
fi
if
[
-e
$PART2
]
;
then
echo
"delete
$PART2
"
rm
-f
$PART2
...
...
@@ -293,27 +298,34 @@ EOF
sleep
3
echo
"Done"
echo
'mkfs on disk partitions ...'
for
i
in
1 2 3 4 5 6 7
;
do
if
[
-b
$PART2
]
;
then
echo
'Wait for partitions ...'
for
i
in
0 1 2 3 4 5 6 7 8 9
;
do
if
[
-b
$PART1
-a
-b
$PART2
]
;
then
break
else
echo
"
w
ait
$PART2
..."
echo
"
W
ait
for
$PART1
/
$PART2
..."
sleep
1
fi
done
if
!
[
-b
$PART1
]
;
then
MajorMinor
=
$(
sed
"s/:/ /"
/sys/class/block/
${
PART1
#/dev/
}
/dev
)
echo
"mknod -m 0660
$PART1
b
$MajorMinor
..."
mknod
-m
0660
$PART1
b
$MajorMinor
fi
if
!
[
-b
$PART2
]
;
then
MajorMinor
=
$(
sed
"s/:/ /"
/sys/class/block/
${
PART2
#/dev/
}
/dev
)
echo
"mknod -m 0660
$PART2
b
$MajorMinor
..."
mknod
-m
0660
$PART2
b
$MajorMinor
if
!
[
-b
$PART1
]
;
then
MajorMinor
=
$(
sed
"s/:/ /"
/sys/class/block/
${
PART1
#/dev/
}
/dev
)
echo
"mknod -m 0660
$PART1
b
$MajorMinor
..."
mknod
-m
0660
$PART1
b
$MajorMinor
fi
mknod
-m
0660
$PART2
b
$MajorMinor
fi
if
[
-b
$PART1
-a
-b
$PART2
]
;
then
echo
"partition exist OK"
else
echo
"[FAIL]
$PART1
/
$PART2
does not exist"
exit
1
fi
echo
"create efi fat fs
$PART2
..."
...
...
@@ -366,6 +378,11 @@ format_ventoy_disk_gpt() {
vtdebug
"part1_start_sector=
$part1_start_sector
part1_end_sector=
$part1_end_sector
"
vtdebug
"part2_start_sector=
$part2_start_sector
part2_end_sector=
$part2_end_sector
"
if
[
-e
$PART1
]
;
then
echo
"delete
$PART1
"
rm
-f
$PART1
fi
if
[
-e
$PART2
]
;
then
echo
"delete
$PART2
"
rm
-f
$PART2
...
...
@@ -399,27 +416,33 @@ format_ventoy_disk_gpt() {
sleep
3
echo
"Done"
echo
'
mkfs on disk
partitions ...'
for
i
in
1 2 3 4 5 6 7
;
do
if
[
-b
$PART2
]
;
then
echo
'
Wait for
partitions ...'
for
i
in
0
1 2 3 4 5 6 7
8 9
;
do
if
[
-b
$PART1
-a
-b
$PART2
]
;
then
break
else
echo
"
w
ait
$PART2
..."
echo
"
W
ait
for
$PART1
/
$PART2
..."
sleep
1
fi
done
if
!
[
-b
$PART1
]
;
then
MajorMinor
=
$(
sed
"s/:/ /"
/sys/class/block/
${
PART1
#/dev/
}
/dev
)
echo
"mknod -m 0660
$PART1
b
$MajorMinor
..."
mknod
-m
0660
$PART1
b
$MajorMinor
fi
if
!
[
-b
$PART2
]
;
then
MajorMinor
=
$(
sed
"s/:/ /"
/sys/class/block/
${
PART2
#/dev/
}
/dev
)
echo
"mknod -m 0660
$PART2
b
$MajorMinor
..."
mknod
-m
0660
$PART2
b
$MajorMinor
if
!
[
-b
$PART1
]
;
then
MajorMinor
=
$(
sed
"s/:/ /"
/sys/class/block/
${
PART1
#/dev/
}
/dev
)
echo
"mknod -m 0660
$PART1
b
$MajorMinor
..."
mknod
-m
0660
$PART1
b
$MajorMinor
fi
mknod
-m
0660
$PART2
b
$MajorMinor
fi
if
[
-b
$PART1
-a
-b
$PART2
]
;
then
echo
"partition exist OK"
else
echo
"[FAIL]
$PART1
/
$PART2
does not exist"
exit
1
fi
echo
"create efi fat fs
$PART2
..."
...
...
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