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
1e129695
Commit
1e129695
authored
Mar 13, 2021
by
longpanda
Browse files
add support for openEuler
parent
db892d5e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
260 additions
and
0 deletions
+260
-0
IMG/cpio/ventoy/hook/openEuler/ventoy-hook.sh
IMG/cpio/ventoy/hook/openEuler/ventoy-hook.sh
+79
-0
IMG/cpio/ventoy/hook/openEuler/ventoy-inotifyd-hook.sh
IMG/cpio/ventoy/hook/openEuler/ventoy-inotifyd-hook.sh
+67
-0
IMG/cpio/ventoy/hook/openEuler/ventoy-inotifyd-start.sh
IMG/cpio/ventoy/hook/openEuler/ventoy-inotifyd-start.sh
+31
-0
IMG/cpio/ventoy/hook/openEuler/ventoy-make-link.sh
IMG/cpio/ventoy/hook/openEuler/ventoy-make-link.sh
+35
-0
IMG/cpio/ventoy/hook/openEuler/ventoy-timeout.sh
IMG/cpio/ventoy/hook/openEuler/ventoy-timeout.sh
+34
-0
IMG/cpio/ventoy/ventoy_chain.sh
IMG/cpio/ventoy/ventoy_chain.sh
+6
-0
IMG/cpio/ventoy/ventoy_loop.sh
IMG/cpio/ventoy/ventoy_loop.sh
+8
-0
No files found.
IMG/cpio/ventoy/hook/openEuler/ventoy-hook.sh
0 → 100644
View file @
1e129695
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
$VTOY_PATH
/hook/ventoy-os-lib.sh
#ventoy_systemd_udevd_work_around
#ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k noreplace"
if
[
-f
$VTOY_PATH
/autoinstall
]
;
then
VTKS
=
"inst.ks=file:
$VTOY_PATH
/autoinstall"
else
for
vtParam
in
$(
$CAT
/proc/cmdline
)
;
do
if
echo
$vtParam
|
$GREP
-q
'inst.ks=hd:LABEL='
;
then
vtRawKs
=
$(
echo
$vtParam
|
$AWK
-F
:
'{print $NF}'
)
VTKS
=
"inst.ks=hd:/dev/dm-0:
$vtRawKs
"
break
fi
if
echo
$vtParam
|
$GREP
-q
'^ks=.*:/'
;
then
vtRawKs
=
$(
echo
$vtParam
|
$AWK
-F
:
'{print $NF}'
)
VTKS
=
"ks=hd:/dev/dm-0:
$vtRawKs
"
break
fi
done
fi
echo
"VTKS=
$VTKS
"
>>
$VTLOG
if
ls
$VTOY_PATH
|
$GREP
-q
'ventoy_dud[0-9]'
;
then
for
vtDud
in
$(
ls
$VTOY_PATH
/ventoy_dud
*
)
;
do
vtInstDD
=
"
$vtInstDD
inst.dd=file:
$vtDud
"
done
fi
echo
"vtInstDD=
$vtInstDD
"
>>
$VTLOG
if
$GREP
-q
'root=live'
/proc/cmdline
;
then
$SED
"s#printf
\(
.*
\)\$
CMDLINE#printf
\1\$
CMDLINE root=live:/dev/dm-0
$VTKS
$vtInstDD
#"
-i
/lib/dracut-lib.sh
else
$SED
"s#printf
\(
.*
\)\$
CMDLINE#printf
\1\$
CMDLINE inst.stage2=hd:/dev/dm-0
$VTKS
$vtInstDD
#"
-i
/lib/dracut-lib.sh
fi
ventoy_set_inotify_script openEuler/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/openEuler/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/
${
vtPriority
}
-ventoy-inotifyd-start
.sh
$BUSYBOX_PATH
/cp
-a
$VTOY_PATH
/hook/openEuler/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/
${
vtPriority
}
-ventoy-timeout
.sh
if
[
-e
/sbin/dmsquash-live-root
]
;
then
echo
"patch /sbin/dmsquash-live-root ..."
>>
$VTLOG
$SED
"1 a
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/openEuler/ventoy-make-link.sh"
-i
/sbin/dmsquash-live-root
fi
# suppress write protected mount warning
if
[
-e
/usr/sbin/anaconda-diskroot
]
;
then
$SED
's/^mount $dev $repodir/mount -oro $dev $repodir/'
-i
/usr/sbin/anaconda-diskroot
fi
IMG/cpio/ventoy/hook/openEuler/ventoy-inotifyd-hook.sh
0 → 100644
View file @
1e129695
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
/ventoy/hook/ventoy-hook-lib.sh
if
is_ventoy_hook_finished
;
then
exit
0
fi
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
if
is_inotify_ventoy_part
$3
;
then
vtlog
"##### INOTIFYD:
$2
/
$3
is created (YES) ..."
vtGenRulFile
=
'/etc/udev/rules.d/99-live-squash.rules'
if
[
-e
$vtGenRulFile
]
&&
$GREP
-q
dmsquash
$vtGenRulFile
;
then
vtScript
=
$(
$GREP
-m1
'RUN.='
$vtGenRulFile
|
$AWK
-F
'RUN.='
'{print $2}'
|
$SED
's/"\(.*\)".*/\1/'
)
vtlog
"vtScript=
$vtScript
"
$vtScript
else
vtlog
"
$vtGenRulFile
not exist..."
fi
vtlog
"find ventoy partition ..."
vtReplaceOpt
=
noreplace
$BUSYBOX_PATH
/sh
$VTOY_PATH
/hook/default/udev_disk_hook.sh
$3
$vtReplaceOpt
blkdev_num
=
$(
$VTOY_PATH
/tool/dmsetup
ls
|
grep
ventoy |
sed
's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/'
)
vtDM
=
$(
ventoy_find_dm_id
${
blkdev_num
}
)
if
[
"
$vtDM
"
=
"dm-0"
]
;
then
vtlog
"This is dm-0, OK ..."
else
vtlog
"####### This is
$vtDM
####### this is abnormal ..."
ventoy_swap_device /dev/dm-0 /dev/
$vtDM
fi
if
[
-e
/sbin/anaconda-diskroot
]
;
then
vtlog
"set anaconda-diskroot ..."
/sbin/anaconda-diskroot /dev/dm-0
fi
set_ventoy_hook_finish
else
vtlog
"##### INOTIFYD:
$2
/
$3
is created (NO) ..."
fi
PATH
=
$VTPATH_OLD
IMG/cpio/ventoy/hook/openEuler/ventoy-inotifyd-start.sh
0 → 100644
View file @
1e129695
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
/ventoy/hook/ventoy-hook-lib.sh
vtHook
=
$(
$CAT
$VTOY_PATH
/inotifyd-hook-script.txt
)
vtdisk
=
$(
get_ventoy_disk_name
)
if
[
"
$vtdisk
"
=
"unknown"
]
;
then
vtlog
"... start inotifyd listen
$vtHook
..."
$BUSYBOX_PATH
/nohup
$VTOY_PATH
/tool/inotifyd
$vtHook
/dev:n 2>&- &
else
vtlog
"...
$vtdisk
already exist ..."
$BUSYBOX_PATH
/sh
$vtHook
n /dev
"
${
vtdisk
#/dev/
}
2"
fi
IMG/cpio/ventoy/hook/openEuler/ventoy-make-link.sh
0 → 100644
View file @
1e129695
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
/ventoy/hook/ventoy-hook-lib.sh
if
!
[
-e
/dev/mapper/ventoy
]
;
then
vtlog
"link to /dev/mapper/ventoy"
ln
-s
/dev/dm-0 /dev/mapper/ventoy
fi
VTLABEL
=
$(
$BUSYBOX_PATH
/blkid /dev/dm-0 |
$SED
's/.*LABEL="\([^"]*\)".*/\1/'
)
vtlog
"VTLABEL=
$VTLABEL
"
if
[
-n
"
$VTLABEL
"
]
;
then
if
!
[
-e
"/dev/disk/by-label/
$VTLABEL
"
]
;
then
vtlog
"link to /dev/disk/by-label/
$VTLABEL
"
ln
-s
/dev/dm-0
"/dev/disk/by-label/
$VTLABEL
"
fi
fi
IMG/cpio/ventoy/hook/openEuler/ventoy-timeout.sh
0 → 100644
View file @
1e129695
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
.
/ventoy/hook/ventoy-hook-lib.sh
vtlog
"#####
$0
$*
..."
VTPATH_OLD
=
$PATH
;
PATH
=
$BUSYBOX_PATH
:
$VTOY_PATH
/tool:
$PATH
blkdev_num
=
$(
dmsetup
ls
|
grep
ventoy |
sed
's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/'
)
vtDM
=
$(
ventoy_find_dm_id
${
blkdev_num
}
)
if
[
-e
/sbin/anaconda-diskroot
]
;
then
vtlog
"set anaconda-diskroot ..."
/sbin/anaconda-diskroot /dev/dm-0
fi
PATH
=
$VTPATH_OLD
IMG/cpio/ventoy/ventoy_chain.sh
View file @
1e129695
...
@@ -151,6 +151,8 @@ ventoy_get_os_type() {
...
@@ -151,6 +151,8 @@ ventoy_get_os_type() {
echo
'debian'
;
return
echo
'debian'
;
return
elif
$GREP
-q
'Solus'
/etc/os-release
;
then
elif
$GREP
-q
'Solus'
/etc/os-release
;
then
echo
'rhel7'
;
return
echo
'rhel7'
;
return
elif
$GREP
-q
'openEuler'
/etc/os-release
;
then
echo
'openEuler'
;
return
fi
fi
fi
fi
...
@@ -320,6 +322,10 @@ ventoy_get_os_type() {
...
@@ -320,6 +322,10 @@ ventoy_get_os_type() {
fi
fi
fi
fi
if
[
-f
/etc/openEuler-release
]
;
then
echo
"openEuler"
;
return
fi
echo
"default"
echo
"default"
}
}
...
...
IMG/cpio/ventoy/ventoy_loop.sh
View file @
1e129695
...
@@ -196,6 +196,8 @@ ventoy_get_os_type() {
...
@@ -196,6 +196,8 @@ ventoy_get_os_type() {
echo
'debian'
;
return
echo
'debian'
;
return
elif
$GREP
-q
'Solus'
/etc/os-release
;
then
elif
$GREP
-q
'Solus'
/etc/os-release
;
then
echo
'rhel7'
;
return
echo
'rhel7'
;
return
elif
$GREP
-q
'openEuler'
/etc/os-release
;
then
echo
'openEuler'
;
return
fi
fi
fi
fi
...
@@ -360,9 +362,15 @@ ventoy_get_os_type() {
...
@@ -360,9 +362,15 @@ ventoy_get_os_type() {
if
[
-f
/DISTRO_SPECS
]
;
then
if
[
-f
/DISTRO_SPECS
]
;
then
if
$GREP
-q
'[Pp]uppy'
/DISTRO_SPECS
;
then
if
$GREP
-q
'[Pp]uppy'
/DISTRO_SPECS
;
then
echo
'debian'
;
return
echo
'debian'
;
return
elif
$GREP
-q
'veket'
/DISTRO_SPECS
;
then
echo
'debian'
;
return
fi
fi
fi
fi
if
[
-f
/etc/openEuler-release
]
;
then
echo
"openEuler"
;
return
fi
echo
"default"
echo
"default"
}
}
...
...
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