mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-08-28 00:11:15 +00:00
initial commit
This commit is contained in:
42
IMG/cpio/ventoy/hook/default/13-dm-disk.rules
Normal file
42
IMG/cpio/ventoy/hook/default/13-dm-disk.rules
Normal file
@@ -0,0 +1,42 @@
|
||||
# Copyright (C) 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of LVM2.
|
||||
|
||||
# Udev rules for device-mapper devices.
|
||||
#
|
||||
# These rules create symlinks in /dev/disk directory.
|
||||
# Symlinks that depend on probing filesystem type,
|
||||
# label and uuid are created only if the device is not
|
||||
# suspended.
|
||||
|
||||
# "add" event is processed on coldplug only!
|
||||
ACTION!="add|change", GOTO="dm_end"
|
||||
ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end"
|
||||
ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="dm_end"
|
||||
|
||||
SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}"
|
||||
ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}"
|
||||
|
||||
ENV{DM_SUSPENDED}=="1", GOTO="dm_end"
|
||||
ENV{DM_NOSCAN}=="1", GOTO="dm_watch"
|
||||
|
||||
IMPORT{builtin}="blkid"
|
||||
ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS="link_priority=-100"
|
||||
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
|
||||
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
|
||||
ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}"
|
||||
ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}"
|
||||
ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_GPT_AUTO_ROOT}=="1", SYMLINK+="gpt-auto-root"
|
||||
|
||||
# Add inotify watch to track changes on this device.
|
||||
# Using the watch rule is not optimal - it generates a lot of spurious
|
||||
# and useless events whenever the device opened for read-write is closed.
|
||||
# The best would be to generete the event directly in the tool changing
|
||||
# relevant information so only relevant events will be processed
|
||||
# (like creating a filesystem, changing filesystem label etc.).
|
||||
#
|
||||
# But let's use this until we have something better...
|
||||
LABEL="dm_watch"
|
||||
OPTIONS+="watch"
|
||||
|
||||
LABEL="dm_end"
|
30
IMG/cpio/ventoy/hook/default/udev_disk_hook.sh
Normal file
30
IMG/cpio/ventoy/hook/default/udev_disk_hook.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/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 || not_ventoy_disk "${1:0:-1}"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ventoy_udev_disk_common_hook $*
|
||||
|
||||
# OK finish
|
||||
set_ventoy_hook_finish
|
||||
|
24
IMG/cpio/ventoy/hook/default/ventoy-hook.sh
Normal file
24
IMG/cpio/ventoy/hook/default/ventoy-hook.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/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"
|
Reference in New Issue
Block a user