Server IP : 192.168.23.10  /  Your IP : 3.15.226.174
Web Server : Apache
System : Linux echo.premieradvertising.com 5.14.0-362.8.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 7 14:54:22 EST 2023 x86_64
User : rrrallyteam ( 1049)
PHP Version : 8.1.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF
Directory (0755) :  /lib/dracut/modules.d/50drm/../95lunmask/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //lib/dracut/modules.d/50drm/../95lunmask/parse-lunmask.sh
#!/usr/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

create_udev_rule() {
    local transport=$1
    local tgtid=$2
    local lun=$3
    local _rule=/etc/udev/rules.d/51-${transport}-lunmask-${tgtid}.rules

    [ -e "${_rule}" ] && return 0

    if [ ! -f "$_rule" ]; then
        if [ "$transport" = "fc" ]; then
            cat > "$_rule" << EOF
ACTION=="add", SUBSYSTEM=="fc_remote_ports", ATTR{port_name}=="$tgtid", PROGRAM="fc_transport_scan_lun.sh $lun"
EOF
        elif [ "$transport" = "sas" ]; then
            cat > "$_rule" << EOF
ACTION=="add", SUBSYSTEM=="sas_device", ATTR{sas_address}=="$tgtid", PROGRAM="sas_transport_scan_lun.sh $lun"
EOF
        fi
    fi
}

for lunmask_arg in $(getargs rd.lunmask); do
    (
        local OLDIFS="$IFS"
        local IFS=","
        # shellcheck disable=SC2086
        set $lunmask_arg
        IFS="$OLDIFS"
        if [ -d /sys/module/scsi_mod ]; then
            printf "manual" > /sys/module/scsi_mod/parameters/scan
        elif [ ! -f /etc/modprobe.d/95lunmask.conf ]; then
            echo "options scsi_mod scan=manual" > /etc/modprobe.d/95lunmask.conf
        fi
        create_udev_rule "$1" "$2" "$3"
    )
done