#!/bin/sh
# Embedded .ko - run: sh ./SCRIPT.sh (no separate .ko file needed)
set -e
TMP=$(mktemp)
trap "rm -f \"$TMP\"" EXIT INT TERM
base64 -d <<'__EMBEDDED_KO_B64__' > "$TMP"
[encoded data, 145008 characters]
AAAAAAEAAAAAAAAAAAAAAAAAAAA=
__EMBEDDED_KO_B64__
COLOR_GREEN=$(printf '\033[0;32m')
COLOR_RED=$(printf '\033[0;31m')
RESET_SEQ=$(printf '\033[0m')
set +e
ERROR_MSG=$(insmod "$TMP" 2>&1)
INSMOD_STATUS=$?
set -e
if [ $INSMOD_STATUS -eq 0 ]; then
    echo "${COLOR_GREEN}内核模块加载成功${RESET_SEQ}"
    dmesg | tail -50 | grep -i paradise || true
else
    echo "${COLOR_RED}驱动加载失败${RESET_SEQ}"
    echo "$ERROR_MSG"
    dmesg | tail -50 | grep -i paradise || true
    exit 1
fi
