mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
fix
This commit is contained in:
parent
4ee30e01be
commit
7f7b431824
@ -27,7 +27,7 @@ install_dependencies(){
|
|||||||
echo -e "正在安装依赖软件......"
|
echo -e "正在安装依赖软件......"
|
||||||
apt install -y python3.10 python3-pip python3-dev patch iptables nginx \
|
apt install -y python3.10 python3-pip python3-dev patch iptables nginx \
|
||||||
tesseract-ocr tesseract-ocr-eng janus libevent-dev libgpiod-dev \
|
tesseract-ocr tesseract-ocr-eng janus libevent-dev libgpiod-dev \
|
||||||
tesseract-ocr-chi-sim libjpeg-dev libfreetype6-dev
|
tesseract-ocr-chi-sim libjpeg-dev libfreetype6-dev gcc
|
||||||
}
|
}
|
||||||
|
|
||||||
#安装PiKVM
|
#安装PiKVM
|
||||||
@ -104,13 +104,13 @@ onecloud_conf(){
|
|||||||
else
|
else
|
||||||
echo "为玩客云配置开机脚本"
|
echo "为玩客云配置开机脚本"
|
||||||
cat <<EOF >/etc/rc.local
|
cat <<EOF >/etc/rc.local
|
||||||
#!/bin/sh -e
|
#!/bin/bash
|
||||||
echo "default-on" >/sys/class/leds/onecloud\:green\:alive/trigger
|
echo "default-on" >/sys/class/leds/onecloud\:green\:alive/trigger
|
||||||
echo "none" >/sys/class/leds/onecloud\:red\:alive/trigger
|
echo "none" >/sys/class/leds/onecloud\:red\:alive/trigger
|
||||||
echo "none" >/sys/class/leds/onecloud\:blue\:alive/trigger
|
echo "none" >/sys/class/leds/onecloud\:blue\:alive/trigger
|
||||||
cpufreq-set -d 1200MHz -u 1200MHz
|
cpufreq-set -d 1200MHz -u 1200MHz
|
||||||
echo device > /sys/class/usb_role/c9040000.usb-role-switch/role
|
echo device > /sys/class/usb_role/c9040000.usb-role-switch/role
|
||||||
systemctl disabled kvmd
|
systemctl disable kvmd
|
||||||
systemctl start kvmd
|
systemctl start kvmd
|
||||||
exit 0
|
exit 0
|
||||||
EOF
|
EOF
|
||||||
@ -120,7 +120,7 @@ EOF
|
|||||||
|
|
||||||
#打印完成信息
|
#打印完成信息
|
||||||
show_info(){
|
show_info(){
|
||||||
echo -e "安装结束"
|
echo -e "安装结束,重启之后即可开始使用One-KVM"
|
||||||
/usr/bin/armbian-motd
|
/usr/bin/armbian-motd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
36
kvmd_display_install.sh
Executable file
36
kvmd_display_install.sh
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CURRENTWD=$PWD
|
||||||
|
|
||||||
|
#配置采集卡简单环出功能
|
||||||
|
kvmd_display(){
|
||||||
|
echo "正在配置采集卡简单环出功能功能..."
|
||||||
|
cd $CURRENTWD
|
||||||
|
apt install -y ffmpeg
|
||||||
|
cat > /lib/systemd/system/kvmd-display.service << EOF
|
||||||
|
[Unit]
|
||||||
|
Description=PiKVM - Transcode (Static Config)
|
||||||
|
After=network.target network-online.target nss-lookup.target kvmd.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=kvmd
|
||||||
|
Group=kvmd
|
||||||
|
Type=simple
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=3
|
||||||
|
AmbientCapabilities=CAP_NET_RAW
|
||||||
|
LimitNOFILE=65536
|
||||||
|
UMask=0117
|
||||||
|
ExecStart=/usr/share/kvmd/display_when_ustream_exists.sh
|
||||||
|
TimeoutStopSec=10
|
||||||
|
KillMode=mixed
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
cp -f ./patch/stream.sh /usr/share/kvmd/ && cp -f ./patch/stream_when_ustream_exists.sh /usr/share/kvmd/ && chmod +x /usr/share/kvmd/stream.sh /usr/share/kvmd/stream_when_ustream_exists.sh
|
||||||
|
#启动服务
|
||||||
|
systemctl enable kvmd-display && systemctl start kvmd-display
|
||||||
|
}
|
||||||
|
|
||||||
|
kvmd_display
|
||||||
0
kvmd_h264_install.sh
Normal file → Executable file
0
kvmd_h264_install.sh
Normal file → Executable file
10
patch/display.sh
Executable file
10
patch/display.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#tty清屏
|
||||||
|
echo -e "\033c" > /dev/tty1
|
||||||
|
|
||||||
|
#隐藏光标
|
||||||
|
echo -e "\033[?25l" > /dev/tty1
|
||||||
|
|
||||||
|
#在HDMI显示器输出采集卡画面
|
||||||
|
ustreamer-dump --sink=kvmd::ustreamer::jpeg --output - | ffmpeg -use_wallclock_as_timestamps 1 -i pipe:c:v -an -pix_fmt bgr24 -f fbdev /dev/fb0
|
||||||
43
patch/display_when_ustream_exists
Executable file
43
patch/display_when_ustream_exists
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 存储 stream.sh 的进程 ID
|
||||||
|
b_pid=""
|
||||||
|
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "Received SIGINT. Terminating the process group..."
|
||||||
|
[ -n "$b_pid" ] && pkill -9 -g $b_pid # 终止整个进程组
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# 捕获 SIGINT 信号
|
||||||
|
trap cleanup SIGINT
|
||||||
|
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
# 检测是否有包含 "ustreamer" 的进程
|
||||||
|
if pgrep -f "/usr/bin/ustreamer " > /dev/null; then
|
||||||
|
# 如果存在,但是 stream.sh 进程不存在,执行 stream.sh 并记录其进程 ID
|
||||||
|
if [ -z "$b_pid" ]; then
|
||||||
|
echo "Found a process with 'ustreamer' in the command. Executing stream.sh in the background..."
|
||||||
|
setsid /usr/share/kvmd/diaplay.sh &
|
||||||
|
b_pid=$(ps -o pgid= $!)
|
||||||
|
echo "stream.sh started with PID: $b_pid"
|
||||||
|
else
|
||||||
|
echo "Process with 'ustreamer' is already running. Skipping..."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# 如果不存在 "ustreamer" 进程,但是 stream.sh 进程存在,终止 stream.sh 并清除进程 ID
|
||||||
|
if [ -n "$b_pid" ]; then
|
||||||
|
echo "No process with 'ustreamer' found. Terminating stream.sh (PID: $b_pid)..."
|
||||||
|
pkill -9 -g $b_pid
|
||||||
|
b_pid=""
|
||||||
|
else
|
||||||
|
echo "No process with 'ustreamer' found. Waiting for the next check..."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 等待一段时间,可以根据需要调整等待的时间间隔
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
done
|
||||||
Loading…
x
Reference in New Issue
Block a user