diff --git a/IMG/cpio/ventoy/hook/euleros/disk_mount_hook.sh b/IMG/cpio/ventoy/hook/euleros/disk_mount_hook.sh new file mode 100644 index 00000000..f12e4304 --- /dev/null +++ b/IMG/cpio/ventoy/hook/euleros/disk_mount_hook.sh @@ -0,0 +1,24 @@ +#!/ventoy/busybox/sh + +. /ventoy/hook/ventoy-hook-lib.sh + +vtlog "######### $0 $* ############" + +if is_ventoy_hook_finished; then + exit 0 +fi + +wait_for_usb_disk_ready + +vtdiskname=$(get_ventoy_disk_name) +if [ "$vtdiskname" = "unknown" ]; then + vtlog "ventoy disk not found" + exit 0 +fi + +vtlog "vtdiskname=$vtdiskname" + +ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace" + +# OK finish +set_ventoy_hook_finish diff --git a/IMG/cpio/ventoy/hook/euleros/hook_func.sh b/IMG/cpio/ventoy/hook/euleros/hook_func.sh new file mode 100644 index 00000000..d1430fe0 --- /dev/null +++ b/IMG/cpio/ventoy/hook/euleros/hook_func.sh @@ -0,0 +1,7 @@ + +function ft_mountCdromDir() +{ + /ventoy/busybox/sh /ventoy/hook/euleros/disk_mount_hook.sh + ft_mountCdromDirXX "$@" +} + diff --git a/IMG/cpio/ventoy/hook/euleros/ventoy-hook.sh b/IMG/cpio/ventoy/hook/euleros/ventoy-hook.sh new file mode 100644 index 00000000..5750753b --- /dev/null +++ b/IMG/cpio/ventoy/hook/euleros/ventoy-hook.sh @@ -0,0 +1,42 @@ +#!/ventoy/busybox/sh +#************************************************************************************ +# Copyright (c) 2020, longpanda +# +# 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 . +# +#************************************************************************************ + +. $VTOY_PATH/hook/ventoy-os-lib.sh + +TRANSFILE=/usr/Euler/project/load/filetransfer.sh + +LINE=$($GREP -n 'function ft_mountCdromDir' $TRANSFILE | $AWK -F':' '{print $1}') + +echo "LINE=$LINE" >> $VTLOG + +$SED 's#FT_SR_DEV=.*#FT_SR_DEV=/dev/mapper/ventoy#g' -i $TRANSFILE +$SED 's/function ft_mountCdromDir/function ft_mountCdromDirXX/' -i $TRANSFILE + +let LINE-- +$SED -n "1,${LINE}p" $TRANSFILE >> /ventoy/filetransfer.sh + +$CAT $VTOY_PATH/hook/euleros/hook_func.sh >> /ventoy/filetransfer.sh + +let LINE++ +$SED -n "${LINE},\$p" $TRANSFILE >> /ventoy/filetransfer.sh + +$BUSYBOX_PATH/mv /ventoy/filetransfer.sh $TRANSFILE + +#fix the euler os shell script +$SED 's/-z ${harddisk_disk_list}/-z "${harddisk_disk_list}"/' -i /usr/Euler/project/disk/disk_tool.sh diff --git a/IMG/cpio/ventoy/ventoy_chain.sh b/IMG/cpio/ventoy/ventoy_chain.sh index e57d73f3..f816b094 100644 --- a/IMG/cpio/ventoy/ventoy_chain.sh +++ b/IMG/cpio/ventoy/ventoy_chain.sh @@ -100,7 +100,11 @@ ventoy_get_os_type() { echo 'rhel7'; return elif $GREP -q 'euleros' /proc/version; then - echo 'rhel7'; return + if [ -d /usr/Euler/project/init ]; then + echo 'euleros'; return + else + echo 'rhel7'; return + fi # SUSE elif $GREP -q 'SUSE' /proc/version; then