From 37212a8ea44a4f1b294da70cc3d8cf2083fd1441 Mon Sep 17 00:00:00 2001 From: longpanda Date: Mon, 12 Apr 2021 18:56:26 +0800 Subject: [PATCH] 1. Fix a bug about source media missing when boot CentOS8 2. Support RED OS --- IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh | 14 +++++++++ .../ventoy/hook/rhel7/ventoy-inotifyd-hook.sh | 10 ++----- IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh | 29 +++++++++++++++++++ 3 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh diff --git a/IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh b/IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh index d3d7ab81..5e57ec25 100644 --- a/IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh +++ b/IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh @@ -85,6 +85,20 @@ 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= +if [ -f /etc/system-release ]; then + if $GREP -q 'RED OS' /etc/system-release ]; then + vtNeedRepo="yes" + fi +fi +if $GREP -q el8 /proc/version; then + vtNeedRepo="yes" +fi + +if [ "$vtNeedRepo" = "yes" ]; then + $BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-repo.sh /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh +fi + if [ -e /sbin/dmsquash-live-root ]; then 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 diff --git a/IMG/cpio/ventoy/hook/rhel7/ventoy-inotifyd-hook.sh b/IMG/cpio/ventoy/hook/rhel7/ventoy-inotifyd-hook.sh index 4058840b..4a2435e1 100644 --- a/IMG/cpio/ventoy/hook/rhel7/ventoy-inotifyd-hook.sh +++ b/IMG/cpio/ventoy/hook/rhel7/ventoy-inotifyd-hook.sh @@ -41,14 +41,8 @@ if is_inotify_ventoy_part $3; then vtlog "find ventoy partition ..." vtReplaceOpt=noreplace - - if $GREP -q el8 /proc/version && [ -f /etc/system-release ]; then - vtRhel8Ver=$($SED "s#.*8\.\([0-9]*\).*#\1#" /etc/system-release) - if [ $vtRhel8Ver -ge 3 ]; then - vtReplaceOpt="" - elif $GREP -q "Stream" /etc/system-release; then - vtReplaceOpt="" - fi + if [ -f /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh ]; then + vtReplaceOpt="" fi $BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 $vtReplaceOpt diff --git a/IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh b/IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh new file mode 100644 index 00000000..af85bebd --- /dev/null +++ b/IMG/cpio/ventoy/hook/rhel7/ventoy-repo.sh @@ -0,0 +1,29 @@ +#!/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 . +# +#************************************************************************************ + +. /ventoy/hook/ventoy-hook-lib.sh + +vtlog "##### $0 $* ..." + +VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH + +repodev=$(ls $VTOY_PATH/dev_backup*) +echo "inst.repo=hd:/dev/${repodev#*dev_backup_}" >> /sysroot/etc/cmdline + +PATH=$VTPATH_OLD