AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.144.45.178
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/dracut/modules.d/04watchdog/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /usr/lib/dracut/modules.d/04watchdog/module-setup.sh
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

check() {
    return 255
}

depends() {
    return 0
}

install() {
    # Do not add watchdog hooks if systemd module is included
    # In that case, systemd will manage watchdog kick
    if ! dracut_module_included "systemd"; then
        inst_hook cmdline   00 "$moddir/watchdog.sh"
        inst_hook cmdline   50 "$moddir/watchdog.sh"
        inst_hook pre-trigger 00 "$moddir/watchdog.sh"
        inst_hook initqueue 00 "$moddir/watchdog.sh"
        inst_hook mount     00 "$moddir/watchdog.sh"
        inst_hook mount     50 "$moddir/watchdog.sh"
        inst_hook mount     99 "$moddir/watchdog.sh"
        inst_hook pre-pivot 00 "$moddir/watchdog.sh"
        inst_hook pre-pivot 99 "$moddir/watchdog.sh"
        inst_hook cleanup   00 "$moddir/watchdog.sh"
        inst_hook cleanup   99 "$moddir/watchdog.sh"
    fi
    inst_hook emergency 02 "$moddir/watchdog-stop.sh"
    inst_multiple -o wdctl
}

installkernel() {
    local -A _drivers
    local _alldrivers _active _wdtdrv _wdtppath _dir
    [[ -d /sys/class/watchdog/ ]] || return
    for _dir in /sys/class/watchdog/*; do
        [[ -d "$_dir" ]] || continue
        [[ -f "$_dir/state" ]] || continue
        _active=$(< "$_dir/state")
        ! [[ $hostonly ]] || [[ "$_active" =  "active" ]] || continue
        # device/modalias will return driver of this device
        _wdtdrv=$(< "$_dir/device/modalias")
        # There can be more than one module represented by same
        # modalias. Currently load all of them.
        # TODO: Need to find a way to avoid any unwanted module
        # represented by modalias
        _wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
        if [[ $_wdtdrv ]]; then
            instmods $_wdtdrv
            for i in $_wdtdrv; do
                _drivers[$i]=1
            done
        fi
        # however in some cases, we also need to check that if there is
        # a specific driver for the parent bus/device.  In such cases
        # we also need to enable driver for parent bus/device.
        _wdtppath=$(readlink -f "$_dir/device")
        while [[ -d "$_wdtppath" ]] && [[ "$_wdtppath" != "/sys" ]]; do
            _wdtppath=$(readlink -f "$_wdtppath/..")
            [[ -f "$_wdtppath/modalias" ]] || continue

            _wdtdrv=$(< "$_wdtppath/modalias")
            _wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
            if [[ $_wdtdrv ]]; then
                instmods $_wdtdrv
                for i in $_wdtdrv; do
                    _drivers[$i]=1
                done
            fi
        done
    done
    # ensure that watchdog module is loaded as early as possible
    _alldrivers="${!_drivers[*]}"
    [[ $_alldrivers ]] && echo "rd.driver.pre=${_alldrivers// /,}" > ${initdir}/etc/cmdline.d/00-watchdog.conf

    return 0
}

Anon7 - 2022
AnonSec Team