MOON
Server: Apache
System: Linux vmi433716.contaboserver.net 3.10.0-1160.144.1.el7.tuxcare.els4.x86_64 #1 SMP Tue Apr 7 08:40:40 UTC 2026 x86_64
User: affpashacom (1022)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: //lib/dracut/modules.d/95linuxmdm/module-setup.sh
#!/bin/bash
# dracut module: 95linuxmdm
#
# This module ships the LinuxMDM initramfs recovery hook. When the agent
# is installed, the customer/operator regenerates the initramfs:
#
#   sudo dracut -f
#
# The local-bottom hook then runs every boot, checks whether
# /sysroot/usr/local/bin/linuxmdm-agent is present + matches the SHA in
# /sysroot/boot/linuxmdm-recovery.json. If it's missing or tampered with,
# the hook decompresses /sysroot/boot/linuxmdm-recovery.tar.gz back into
# /sysroot/, restoring the agent before init starts.

check() {
    # Always include in the initramfs when the recovery archive is present.
    [[ -f /boot/linuxmdm-recovery.tar.gz ]] || return 1
    return 0
}

depends() {
    # We use no dracut deps — only base tools (cat, gzip, cpio).
    return 0
}

install() {
    # Install the runtime hook into local-bottom (runs after the rootfs is
    # mounted at /sysroot but before init takes over).
    inst_hook pre-pivot 99 "$moddir/linuxmdm-recover.sh"

    # Bring along the tools the hook needs. Most are already in dracut's
    # core but we ask explicitly to be safe.
    inst_multiple sha256sum cat cp tar gzip mkdir test
}