Linux在没有记录的情况下向连接的显示器显示消息

时间:2015-09-04 23:27:48

标签: linux user-interface x11

您好我正在尝试保护我已经构建的Linux机器。 我想阻止人们克隆硬盘驱动器。 我有一个在启动时使用init运行的脚本,每隔1小时运行一次。

脚本是这样的。它有硬编码的硬盘驱动器序列号,主板序列号和其他一些序列号。脚本检查硬盘驱动器和母亲的序列号与硬编码序列号。如果不匹配。它向系统发送暂停消息,系统关闭。

现在我想在暂停系统之前在连接的显示器/监视器上显示一条消息。显然,当发生这种情况时,用户不会登录。所以我正在寻找一种方法将消息发送到屏幕而不记录。

以下是脚本代码段。

#!/bin/bash
$coded-hdserial="W4837486938473ASD534354"
$coded-mbserial="XFD6345-32423-IRJDFJDF-234823729"

$check-hdserial=`smartctl -i /dev/sda | grep "Serial Number" | awk -F ":" {'print $2'} |  sed -e 's/^[ \t]*//'`
$check-mbserial=`lshw | grep -A 15 "*-core" | grep "serial:" | awk -F ":" {'print $2'} |sed -e 's/^[ \t]*//' | tr -d '.'`

if 
$coded-hdserial == $check-hdserial
then
echo "OK" >/dev/null 2>&1
else
echo "This copy of the software cannot be validated, it may be is a counterfeit. Therefore you cannot continue to enjoy the privilege to use this software. Please contact the support for further information. 

This system will now be shut down. Further attempts to make counterfeit or duplicate copies of this system will initiate the self destruction and you will loose all data."
halt in 1 minute
fi

if 
$coded-mbserial == $check-mbserial
then
echo "OK" >/dev/null 2>&1
else
echo "This copy of the software cannot be validated, it may be is a counterfeit. Therefore you cannot continue to enjoy the privilege to use this software. Please contact the support for further information. 

This system will now be shut down. Further attempts to make counterfeit or duplicate copies of this system will initiate the self destruction and you will loose all data."
halt in 1 minute
fi

我的问题如何向连接的显示器显示一个好看的警告信息。或者可能是屏幕上的JPG图像有警告。

1 个答案:

答案 0 :(得分:0)

查看内核对帧缓冲设备的支持,您可以从位图图像文件中转储原始像素数据。这就是GRand Unified Bootloader(GRUB)创建图形启动菜单的方式。不需要X,但是你不会得到实际的对话窗口。如果你想要一个轻量级的ASCII艺术交互式菜单系统,请查看像ncurses这样的Curses实现。