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
652475f1
Commit
652475f1
authored
Mar 24, 2023
by
longpanda
Browse files
Optimization for Fedora boot process
parent
abfc2a63
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
23 deletions
+100
-23
IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh
IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh
+42
-21
IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh
IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh
+13
-2
IMG/cpio/ventoy/hook/ventoy-os-lib.sh
IMG/cpio/ventoy/hook/ventoy-os-lib.sh
+45
-0
No files found.
IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh
View file @
652475f1
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
if
[
-f
$VTOY_PATH
/autoinstall
]
;
then
if
[
-f
$VTOY_PATH
/autoinstall
]
;
then
VTKS
=
"inst.ks=file:
$VTOY_PATH
/autoinstall"
VTKS
=
"inst.ks=file:
$VTOY_PATH
/autoinstall"
cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-autoexp.sh /lib/dracut/hooks/pre-mount/99-ventoy-autoexp.sh
else
else
for
vtParam
in
$(
$CAT
/proc/cmdline
)
;
do
for
vtParam
in
$(
$CAT
/proc/cmdline
)
;
do
if
echo
$vtParam
|
$GREP
-q
'ks=file:/'
;
then
if
echo
$vtParam
|
$GREP
-q
'ks=file:/'
;
then
...
@@ -90,23 +91,7 @@ if ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
...
@@ -90,23 +91,7 @@ if ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
fi
fi
echo
"vtInstDD=
$vtInstDD
"
>>
$VTLOG
echo
"vtInstDD=
$vtInstDD
"
>>
$VTLOG
if
$GREP
-q
'root=live'
/proc/cmdline
;
then
$SED
"s#printf
\(
.*
\)\$
CMDLINE#printf
\1\$
CMDLINE root=live:/dev/ventoy
$VTKS
$VTOVERLAY
$vtInstDD
#"
-i
/lib/dracut-lib.sh
else
$SED
"s#printf
\(
.*
\)\$
CMDLINE#printf
\1\$
CMDLINE inst.stage2=hd:/dev/ventoy
$VTKS
$VTOVERLAY
$vtInstDD
#"
-i
/lib/dracut-lib.sh
fi
ventoy_set_inotify_script rhel7/ventoy-inotifyd-hook.sh
#Fedora
if
$BUSYBOX_PATH
/which dmsquash-live-root
>
/dev/null
;
then
vtPriority
=
99
else
vtPriority
=
01
fi
$BUSYBOX_PATH
/cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/
${
vtPriority
}
-ventoy-inotifyd-start
.sh
$BUSYBOX_PATH
/cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/
${
vtPriority
}
-ventoy-timeout
.sh
vtNeedRepo
=
vtNeedRepo
=
if
[
-f
/etc/system-release
]
;
then
if
[
-f
/etc/system-release
]
;
then
...
@@ -131,13 +116,53 @@ if $GREP -i -q Fedora /etc/os-release; then
...
@@ -131,13 +116,53 @@ if $GREP -i -q Fedora /etc/os-release; then
fi
fi
fi
fi
echo
"vtNeedRepo=
$vtNeedRepo
"
>>
$VTLOG
echo
"vtNeedRepo=
$vtNeedRepo
"
>>
$VTLOG
if
[
"
$vtNeedRepo
"
=
"yes"
]
;
then
if
[
"
$vtNeedRepo
"
=
"yes"
]
;
then
$BUSYBOX_PATH
/cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-repo.sh /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh
$BUSYBOX_PATH
/cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-repo.sh /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh
fi
fi
#iso-scan (currently only for Fedora)
if
$GREP
-q
Fedora /etc/os-release
;
then
if
ventoy_iso_scan_check
;
then
echo
"iso_scan process ..."
>>
$VTLOG
vtIsoPath
=
$(
/ventoy/tool/vtoydump
-p
/ventoy/ventoy_os_param
)
VTISO_SCAN
=
"iso-scan/filename=
$vtIsoPath
"
echo
-n
$vtIsoPath
>
/ventoy/vtoy_iso_scan
$SED
"s#printf
\(
.*
\)\$
CMDLINE#printf
\1\$
CMDLINE
$VTISO_SCAN
$VTKS
$VTOVERLAY
$vtInstDD
#"
-i
/lib/dracut-lib.sh
if
[
"
$VTOY_LINUX_REMOUNT
"
=
"01"
-a
"
$vtNeedRepo
"
!=
"yes"
]
;
then
ventoy_rw_iso_scan
fi
exit
0
fi
fi
echo
"common process ..."
>>
$VTLOG
if
$GREP
-q
'root=live'
/proc/cmdline
;
then
$SED
"s#printf
\(
.*
\)\$
CMDLINE#printf
\1\$
CMDLINE root=live:/dev/ventoy
$VTKS
$VTOVERLAY
$VTISO_SCAN
$vtInstDD
#"
-i
/lib/dracut-lib.sh
else
$SED
"s#printf
\(
.*
\)\$
CMDLINE#printf
\1\$
CMDLINE inst.stage2=hd:/dev/ventoy
$VTKS
$VTOVERLAY
$VTISO_SCAN
$vtInstDD
#"
-i
/lib/dracut-lib.sh
fi
ventoy_set_inotify_script rhel7/ventoy-inotifyd-hook.sh
#Fedora
if
$BUSYBOX_PATH
/which dmsquash-live-root
>
/dev/null
;
then
vtPriority
=
99
else
vtPriority
=
01
fi
$BUSYBOX_PATH
/cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/
${
vtPriority
}
-ventoy-inotifyd-start
.sh
$BUSYBOX_PATH
/cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/
${
vtPriority
}
-ventoy-timeout
.sh
if
[
-e
/sbin/dmsquash-live-root
]
;
then
if
[
-e
/sbin/dmsquash-live-root
]
;
then
echo
"patch /sbin/dmsquash-live-root ..."
>>
$VTLOG
echo
"patch /sbin/dmsquash-live-root ..."
>>
$VTLOG
$SED
"1 a
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/rhel7/ventoy-make-link.sh"
-i
/sbin/dmsquash-live-root
$SED
"1 a
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/rhel7/ventoy-make-link.sh"
-i
/sbin/dmsquash-live-root
...
@@ -154,10 +179,6 @@ if $GREP -i -q 'fedora.*coreos' /etc/os-release; then
...
@@ -154,10 +179,6 @@ if $GREP -i -q 'fedora.*coreos' /etc/os-release; then
cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-make-link.sh /lib/dracut/hooks/pre-mount/99-ventoy-premount-mklink.sh
cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-make-link.sh /lib/dracut/hooks/pre-mount/99-ventoy-premount-mklink.sh
fi
fi
if
[
-f
$VTOY_PATH
/autoinstall
]
;
then
cp
-a
$VTOY_PATH
/hook/rhel7/ventoy-autoexp.sh /lib/dracut/hooks/pre-mount/99-ventoy-autoexp.sh
fi
#special distro magic
#special distro magic
$BUSYBOX_PATH
/mkdir
-p
$VTOY_PATH
/distmagic
$BUSYBOX_PATH
/mkdir
-p
$VTOY_PATH
/distmagic
...
...
IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh
View file @
652475f1
...
@@ -23,7 +23,18 @@ vtlog "##### $0 $* ..."
...
@@ -23,7 +23,18 @@ vtlog "##### $0 $* ..."
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
repodev
=
$(
ls
$VTOY_PATH
/dev_backup
*
)
if
[
-f
/ventoy/vtoy_iso_scan
]
;
then
echo
"inst.repo=hd:/dev/
${
repodev
#*dev_backup_
}
"
>>
/sysroot/etc/cmdline
repopath
=
$(
cat
/ventoy/vtoy_iso_scan
)
repodev
=
$(
vtoydump
-f
/ventoy/ventoy_os_param |
awk
-F
'#'
'{print $1}'
)
if
echo
$repodev
| egrep
-q
"nvme|mmc|nbd"
;
then
vtpart1
=
${
repodev
}
p1
else
vtpart1
=
${
repodev
}
1
fi
echo
"inst.repo=hd:
${
vtpart1
}
:
${
repopath
}
"
>>
/sysroot/etc/cmdline
else
repodev
=
$(
ls
$VTOY_PATH
/dev_backup
*
)
echo
"inst.repo=hd:/dev/
${
repodev
#*dev_backup_
}
"
>>
/sysroot/etc/cmdline
fi
PATH
=
$VTPATH_OLD
PATH
=
$VTPATH_OLD
IMG/cpio/ventoy/hook/ventoy-os-lib.sh
View file @
652475f1
...
@@ -121,3 +121,48 @@ ventoy_check_mount() {
...
@@ -121,3 +121,48 @@ ventoy_check_mount() {
$BUSYBOX_PATH
/mount
$1
$2
$BUSYBOX_PATH
/mount
$1
$2
fi
fi
}
}
ventoy_has_exfat_ko
()
{
vtExfat
=
''
vtKerVer
=
$(
$BUSYBOX_PATH
/uname
-r
)
if
[
-d
/lib/modules/
$vtKerVer
/kernel/fs/exfat
]
;
then
vtExfat
=
$(
ls
/lib/modules/
$vtKerVer
/kernel/fs/exfat/
)
fi
[
-n
"
$vtExfat
"
]
}
ventoy_is_exfat_part
()
{
$VTOY_PATH
/tool/vtoydump
-s
/ventoy/ventoy_os_param |
$GREP
-q
exfat
}
ventoy_iso_scan_path
()
{
if
[
-f
/sbin/iso-scan
]
;
then
echo
-n
'/sbin/iso-scan'
elif
[
-f
/bin/iso-scan
]
;
then
echo
-n
'/bin/iso-scan'
else
echo
-n
''
fi
}
ventoy_has_iso_scan
()
{
vtScanPath
=
$(
ventoy_iso_scan_path
)
[
-n
"
$vtScanPath
"
]
}
ventoy_rw_iso_scan
()
{
vtScanPath
=
$(
ventoy_iso_scan_path
)
if
[
-n
"
$vtScanPath
"
]
;
then
if
$GREP
-q
'mount.* ro .*isoscan'
$vtScanPath
;
then
$SED
-i
's/\(mount.*-o.*\) ro /\1 rw /'
$vtScanPath
fi
fi
}
ventoy_iso_scan_check
()
{
if
ventoy_is_exfat_part
;
then
if
ventoy_has_exfat_ko
;
then
ventoy_has_iso_scan
fi
fi
}
\ No newline at end of file
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