mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-03-18 00:46:44 +08:00
Compare commits
7 Commits
build-2509
...
v251001
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ab5e2b431 | ||
|
|
65874c6b43 | ||
|
|
67b943c151 | ||
|
|
593de19df5 | ||
|
|
5296e61281 | ||
|
|
1729badc55 | ||
|
|
9373790f37 |
@@ -87,6 +87,18 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis
|
|||||||
fi \
|
fi \
|
||||||
&& curl https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.$ARCH -L -o /usr/local/bin/ttyd \
|
&& curl https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.$ARCH -L -o /usr/local/bin/ttyd \
|
||||||
&& chmod +x /usr/local/bin/ttyd \
|
&& chmod +x /usr/local/bin/ttyd \
|
||||||
|
&& mkdir -p /tmp/gostc && cd /tmp/gostc \
|
||||||
|
&& case ${TARGETARCH} in \
|
||||||
|
amd64) GOSTC_ARCH=amd64_v1 ;; \
|
||||||
|
arm) GOSTC_ARCH=arm_7 ;; \
|
||||||
|
arm64) GOSTC_ARCH=arm64_v8.0 ;; \
|
||||||
|
*) echo "Unsupported architecture for gostc: ${TARGETARCH}" && exit 1 ;; \
|
||||||
|
esac \
|
||||||
|
&& curl -L https://github.com/mofeng-git/gostc-open/releases/download/v2.0.8-beta.2/gostc_linux_${GOSTC_ARCH}.tar.gz -o gostc.tar.gz \
|
||||||
|
&& tar -xzf gostc.tar.gz \
|
||||||
|
&& mv gostc /usr/bin/ \
|
||||||
|
&& chmod +x /usr/bin/gostc \
|
||||||
|
&& cd / && rm -rf /tmp/gostc \
|
||||||
&& adduser kvmd --gecos "" --disabled-password \
|
&& adduser kvmd --gecos "" --disabled-password \
|
||||||
&& ln -sf /usr/share/tesseract-ocr/*/tessdata /usr/share/tessdata \
|
&& ln -sf /usr/share/tesseract-ocr/*/tessdata /usr/share/tessdata \
|
||||||
&& mkdir -p /etc/kvmd_backup/override.d \
|
&& mkdir -p /etc/kvmd_backup/override.d \
|
||||||
@@ -98,6 +110,8 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis
|
|||||||
/run/kvmd \
|
/run/kvmd \
|
||||||
/tmp/kvmd-nginx \
|
/tmp/kvmd-nginx \
|
||||||
&& touch /run/kvmd/ustreamer.sock \
|
&& touch /run/kvmd/ustreamer.sock \
|
||||||
|
&& groupadd kvmd-selfauth \
|
||||||
|
&& usermod -a -G kvmd-selfauth root \
|
||||||
&& apt clean \
|
&& apt clean \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& rm -rf /tmp/lib /tmp/wheel \
|
&& rm -rf /tmp/lib /tmp/wheel \
|
||||||
|
|||||||
@@ -162,9 +162,9 @@ RUN if [ ${TARGETARCH} = arm64 ]; then \
|
|||||||
RUN sed --in-place --expression 's|^#include "refcount.h"$|#include "../refcount.h"|g' /usr/include/janus/plugins/plugin.h \
|
RUN sed --in-place --expression 's|^#include "refcount.h"$|#include "../refcount.h"|g' /usr/include/janus/plugins/plugin.h \
|
||||||
&& git clone --depth=1 https://github.com/mofeng-git/ustreamer /tmp/ustreamer \
|
&& git clone --depth=1 https://github.com/mofeng-git/ustreamer /tmp/ustreamer \
|
||||||
&& if [ ${TARGETARCH} = arm64 ]; then \
|
&& if [ ${TARGETARCH} = arm64 ]; then \
|
||||||
make -j$(nproc) WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 WITH_MPP=1 -C /tmp/ustreamer; \
|
make -j$(nproc) WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 WITH_MPP=1 WITH_DRM=1 -C /tmp/ustreamer; \
|
||||||
else \
|
else \
|
||||||
make -j$(nproc) WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 -C /tmp/ustreamer; \
|
make -j$(nproc) WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 WITH_DRM=1 -C /tmp/ustreamer; \
|
||||||
fi \
|
fi \
|
||||||
&& /tmp/ustreamer/ustreamer -v \
|
&& /tmp/ustreamer/ustreamer -v \
|
||||||
&& /tmp/ustreamer/ustreamer-dump -v \
|
&& /tmp/ustreamer/ustreamer-dump -v \
|
||||||
|
|||||||
@@ -347,6 +347,16 @@ config_onecloud_pro_files() {
|
|||||||
echo "信息:Onecloud Pro 特定配置完成。"
|
echo "信息:Onecloud Pro 特定配置完成。"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config_onecloud_files() {
|
||||||
|
echo "信息:配置 Onecloud 特定文件..."
|
||||||
|
|
||||||
|
# 在 ustreamer 命令中添加 DRM 设备配置
|
||||||
|
echo "信息:为 Onecloud 添加 DRM 设备支持..."
|
||||||
|
run_in_chroot "sed -i \"/--device=\\/dev\\/video0/a\\ - \\\"--drm-device=/dev/dri/card1\\\"\" /etc/kvmd/override.yaml"
|
||||||
|
|
||||||
|
echo "信息:Onecloud 特定配置完成。"
|
||||||
|
}
|
||||||
|
|
||||||
oec_turbo_rootfs() {
|
oec_turbo_rootfs() {
|
||||||
local source_image="$SRCPATH/image/oec-turbo/Flash_Armbian_25.05.0_rockchip_efused-wxy-oec_bookworm_6.1.99_server_2025.03.20.img"
|
local source_image="$SRCPATH/image/oec-turbo/Flash_Armbian_25.05.0_rockchip_efused-wxy-oec_bookworm_6.1.99_server_2025.03.20.img"
|
||||||
local target_image="$TMPDIR/rootfs.img"
|
local target_image="$TMPDIR/rootfs.img"
|
||||||
@@ -374,15 +384,25 @@ config_oec_turbo_files() {
|
|||||||
echo "信息:配置 VPU 硬件编码支持..."
|
echo "信息:配置 VPU 硬件编码支持..."
|
||||||
run_in_chroot "sed -i 's/--h264-hwenc=disabled/--h264-hwenc=rkmpp/g' /etc/kvmd/override.yaml"
|
run_in_chroot "sed -i 's/--h264-hwenc=disabled/--h264-hwenc=rkmpp/g' /etc/kvmd/override.yaml"
|
||||||
|
|
||||||
|
run_in_chroot "cat > /etc/udev/rules.d/99-kvmd-hw-access.rules <<'EOF'
|
||||||
|
SUBSYSTEM=="dma_heap", KERNEL=="system-uncached", GROUP="render", MODE="0660"
|
||||||
|
KERNEL=="mpp_service", GROUP="render", MODE="0660"
|
||||||
|
EOF"
|
||||||
|
|
||||||
|
|
||||||
# 配置 rc.local 自启脚本,添加设备权限设置
|
# 配置 rc.local 自启脚本,添加设备权限设置
|
||||||
echo "信息:配置 rc.local 自启脚本..."
|
echo "信息:配置 rc.local 自启脚本..."
|
||||||
run_in_chroot "cat > /etc/rc.local << 'EOF'
|
run_in_chroot "cat > /etc/rc.local << 'EOF'
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
chmod 777 /dev/mpp_service /dev/rga
|
usermod -aG render,video kvmd
|
||||||
exit 0
|
exit 0
|
||||||
EOF"
|
EOF"
|
||||||
run_in_chroot "chmod +x /etc/rc.local"
|
run_in_chroot "chmod +x /etc/rc.local"
|
||||||
|
|
||||||
|
# 确保 rc-local.service 被启用,以便 kvmd 服务可以依赖它
|
||||||
|
echo "信息:启用 rc-local.service 服务..."
|
||||||
|
run_in_chroot "systemctl enable rc-local.service"
|
||||||
|
|
||||||
# 替换 DTB 文件
|
# 替换 DTB 文件
|
||||||
replace_oec_turbo_dtb
|
replace_oec_turbo_dtb
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ install_base_packages() {
|
|||||||
iptables network-manager curl kmod libmicrohttpd12 libjansson4 libssl3 \\
|
iptables network-manager curl kmod libmicrohttpd12 libjansson4 libssl3 \\
|
||||||
libsofia-sip-ua0 libglib2.0-0 libopus0 libogg0 libcurl4 libconfig9 \\
|
libsofia-sip-ua0 libglib2.0-0 libopus0 libogg0 libcurl4 libconfig9 \\
|
||||||
python3-pip net-tools libavcodec59 libavformat59 libavutil57 libswscale6 \\
|
python3-pip net-tools libavcodec59 libavformat59 libavutil57 libswscale6 \\
|
||||||
libavfilter8 libavdevice59 v4l-utils libv4l-0 nano unzip dnsmasq && \\
|
libavfilter8 libavdevice59 v4l-utils libv4l-0 nano unzip dnsmasq python3-systemd && \\
|
||||||
apt clean && \\
|
apt clean && \\
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
"
|
"
|
||||||
@@ -194,7 +194,9 @@ configure_system() {
|
|||||||
sed -i 's/8080/80/g' /etc/kvmd/override.yaml && \\
|
sed -i 's/8080/80/g' /etc/kvmd/override.yaml && \\
|
||||||
sed -i 's/4430/443/g' /etc/kvmd/override.yaml && \\
|
sed -i 's/4430/443/g' /etc/kvmd/override.yaml && \\
|
||||||
chown kvmd -R /var/lib/kvmd/msd/ && \\
|
chown kvmd -R /var/lib/kvmd/msd/ && \\
|
||||||
systemctl enable dnsmasq kvmd kvmd-otg kvmd-nginx kvmd-vnc kvmd-ipmi kvmd-webterm kvmd-janus kvmd-media && \\
|
rm /etc/resolv.conf && \\
|
||||||
|
printf '%s\\n' 'nameserver 1.1.1.1' 'nameserver 1.0.0.1' > /etc/resolv.conf && \
|
||||||
|
systemctl enable dnsmasq kvmd kvmd-otg kvmd-nginx kvmd-vnc kvmd-ipmi kvmd-webterm kvmd-janus kvmd-media kvmd-gostc && \\
|
||||||
systemctl disable nginx systemd-resolved && \\
|
systemctl disable nginx systemd-resolved && \\
|
||||||
rm -rf /One-KVM
|
rm -rf /One-KVM
|
||||||
"
|
"
|
||||||
@@ -221,6 +223,54 @@ install_webterm() {
|
|||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_gostc() {
|
||||||
|
local arch="$1" # armhf, aarch64, x86_64
|
||||||
|
local gostc_arch="$arch"
|
||||||
|
local gostc_version="v2.0.8-beta.2"
|
||||||
|
|
||||||
|
# 根据架构映射下载文件名
|
||||||
|
case "$arch" in
|
||||||
|
armhf) gostc_arch="arm_7" ;;
|
||||||
|
aarch64) gostc_arch="arm64_v8.0" ;;
|
||||||
|
x86_64|amd64) gostc_arch="amd64_v1" ;;
|
||||||
|
*) echo "错误:不支持的架构 $arch"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "信息:在 chroot 环境中下载并安装 gostc ($gostc_arch)..."
|
||||||
|
run_in_chroot "
|
||||||
|
mkdir -p /tmp/gostc && cd /tmp/gostc && \\
|
||||||
|
curl -L https://github.com/mofeng-git/gostc-open/releases/download/${gostc_version}/gostc_linux_${gostc_arch}.tar.gz -o gostc.tar.gz && \\
|
||||||
|
tar -xzf gostc.tar.gz && \\
|
||||||
|
mv gostc /usr/bin/ && \\
|
||||||
|
chmod +x /usr/bin/gostc && \\
|
||||||
|
cd / && rm -rf /tmp/gostc
|
||||||
|
"
|
||||||
|
|
||||||
|
echo "信息:创建 gostc systemd 服务文件..."
|
||||||
|
run_in_chroot "
|
||||||
|
cat > /etc/systemd/system/kvmd-gostc.service << 'EOF'
|
||||||
|
[Unit]
|
||||||
|
Description=基于FRP开发的内网穿透 客户端/节点
|
||||||
|
ConditionFileIsExecutable=/usr/bin/gostc
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
StartLimitInterval=5
|
||||||
|
StartLimitBurst=10
|
||||||
|
ExecStart=/usr/bin/gostc \"-web-addr\" \"0.0.0.0:18080\"
|
||||||
|
WorkingDirectory=/usr/bin
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
EnvironmentFile=-/etc/sysconfig/gostc
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
"
|
||||||
|
|
||||||
|
echo "信息:gostc 安装和配置完成"
|
||||||
|
}
|
||||||
|
|
||||||
apply_kvmd_tweaks() {
|
apply_kvmd_tweaks() {
|
||||||
local arch="$1" # armhf, aarch64, x86_64
|
local arch="$1" # armhf, aarch64, x86_64
|
||||||
local device_type="$2" # "gpio" or "video1" or other
|
local device_type="$2" # "gpio" or "video1" or other
|
||||||
@@ -283,6 +333,8 @@ apply_kvmd_tweaks() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "信息:KVMD 配置调整完成。"
|
echo "信息:KVMD 配置调整完成。"
|
||||||
|
|
||||||
|
run_in_chroot "apt remove -y --purge systemd-resolved"
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- 整体安装流程 ---
|
# --- 整体安装流程 ---
|
||||||
@@ -324,6 +376,7 @@ install_and_configure_kvmd() {
|
|||||||
configure_network "$network_type"
|
configure_network "$network_type"
|
||||||
install_python_deps
|
install_python_deps
|
||||||
configure_kvmd_core
|
configure_kvmd_core
|
||||||
|
install_gostc "$arch" # 安装 gostc
|
||||||
configure_system
|
configure_system
|
||||||
install_webterm "$arch" # 传递原始架构名给ttyd下载
|
install_webterm "$arch" # 传递原始架构名给ttyd下载
|
||||||
apply_kvmd_tweaks "$arch" "$device_type"
|
apply_kvmd_tweaks "$arch" "$device_type"
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ video: {
|
|||||||
sink = "kvmd::ustreamer::h264"
|
sink = "kvmd::ustreamer::h264"
|
||||||
}
|
}
|
||||||
acap: {
|
acap: {
|
||||||
device = "hw:0"
|
device = "hw:0,0"
|
||||||
tc358743 = "/dev/video0"
|
tc358743 = "/dev/video0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,17 @@ stdout_logfile=/dev/stdout
|
|||||||
stdout_logfile_maxbytes = 0
|
stdout_logfile_maxbytes = 0
|
||||||
redirect_stderr=true
|
redirect_stderr=true
|
||||||
|
|
||||||
|
[program:kvmd-gostc]
|
||||||
|
command=/usr/bin/gostc -web-addr 0.0.0.0:18080
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
startsecs=5
|
||||||
|
priority=300
|
||||||
|
stopasgroup=true
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes = 0
|
||||||
|
redirect_stderr=true
|
||||||
|
|
||||||
[program:clean_when_exit]
|
[program:clean_when_exit]
|
||||||
command=/etc/kvmd/clean_when_exit.sh
|
command=/etc/kvmd/clean_when_exit.sh
|
||||||
autostart=true
|
autostart=true
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
#
|
#
|
||||||
# NEVER use the same passwords for KVMD, IPMI and VNCAuth users.
|
# NEVER use the same passwords for KVMD, IPMI and VNCAuth users.
|
||||||
|
|
||||||
admin
|
admin -> admin:admin
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=One-KVM - The main daemon
|
Description=One-KVM - The main daemon
|
||||||
After=network.target network-online.target nss-lookup.target
|
After=network.target network-online.target nss-lookup.target rc-local.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=kvmd
|
User=kvmd
|
||||||
|
|||||||
6
extras/gostc/manifest.yaml
Normal file
6
extras/gostc/manifest.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: GOSTC
|
||||||
|
description: GOSTC Server
|
||||||
|
icon: share/svg/gostc.svg
|
||||||
|
path: extras/gostc
|
||||||
|
daemon: kvmd-gostc
|
||||||
|
place: 11
|
||||||
7
extras/gostc/nginx.ctx-server.conf
Normal file
7
extras/gostc/nginx.ctx-server.conf
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
location /extras/gostc {
|
||||||
|
proxy_pass http://127.0.0.1:18080;
|
||||||
|
include /etc/kvmd/nginx/loc-proxy.conf;
|
||||||
|
include /etc/kvmd/nginx/loc-websocket.conf;
|
||||||
|
include /etc/kvmd/nginx/loc-login.conf;
|
||||||
|
include /etc/kvmd/nginx/loc-nocache.conf;
|
||||||
|
}
|
||||||
@@ -657,7 +657,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<td>Writable:
|
<td i18n="msd-rw-switch">Writable:
|
||||||
</td>
|
</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<div class="switch-box">
|
<div class="switch-box">
|
||||||
|
|||||||
@@ -103,10 +103,10 @@ function __showKvmdInfo(info) {
|
|||||||
|
|
||||||
if (info.meta !== null && info.meta.server && info.meta.server.host) {
|
if (info.meta !== null && info.meta.server && info.meta.server.host) {
|
||||||
$("kvmd-meta-server-host").innerText = info.meta.server.host;
|
$("kvmd-meta-server-host").innerText = info.meta.server.host;
|
||||||
document.title = `${info.meta.server.host} | PiKVM Index`;
|
document.title = `${info.meta.server.host} | One-KVM Index`;
|
||||||
} else {
|
} else {
|
||||||
$("kvmd-meta-server-host").innerHTML = "<i>Invalid meta</i>";
|
$("kvmd-meta-server-host").innerHTML = "<i>Invalid meta</i>";
|
||||||
document.title = "PiKVM Index";
|
document.title = "One-KVM Index";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export function Keyboard(__recordWsEvent) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_captured) {
|
if (is_captured) {
|
||||||
title = "Keyboard captured, PiKVM offline";
|
title = "Keyboard captured, One-KVM offline";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("hid-keyboard-led").className = led;
|
$("hid-keyboard-led").className = led;
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ export function Mouse(__getGeometry, __recordWsEvent) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_captured) {
|
if (is_captured) {
|
||||||
title = "Mouse captured, PiKVM offline";
|
title = "Mouse captured, One-KVM offline";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("hid-mouse-led").className = led;
|
$("hid-mouse-led").className = led;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export function Streamer() {
|
|||||||
var __init__ = function() {
|
var __init__ = function() {
|
||||||
__streamer = new MjpegStreamer(__setActive, __setInactive, __setInfo, __organizeHook);
|
__streamer = new MjpegStreamer(__setActive, __setInactive, __setInfo, __organizeHook);
|
||||||
|
|
||||||
$("stream-led").title = "No stream from PiKVM";
|
$("stream-led").title = "No stream from One-KVM";
|
||||||
|
|
||||||
tools.slider.setParams($("stream-quality-slider"), 5, 100, 5, 80, function(value) {
|
tools.slider.setParams($("stream-quality-slider"), 5, 100, 5, 80, function(value) {
|
||||||
$("stream-quality-value").innerText = `${value}%`;
|
$("stream-quality-value").innerText = `${value}%`;
|
||||||
@@ -289,7 +289,7 @@ export function Streamer() {
|
|||||||
|
|
||||||
var __setInactive = function() {
|
var __setInactive = function() {
|
||||||
$("stream-led").className = "led-gray";
|
$("stream-led").className = "led-gray";
|
||||||
$("stream-led").title = "No stream from PiKVM";
|
$("stream-led").title = "No stream from One-KVM";
|
||||||
};
|
};
|
||||||
|
|
||||||
var __setControlsEnabled = function(enabled) {
|
var __setControlsEnabled = function(enabled) {
|
||||||
@@ -317,7 +317,7 @@ export function Streamer() {
|
|||||||
if (text.length > 0) {
|
if (text.length > 0) {
|
||||||
title += text;
|
title += text;
|
||||||
} else {
|
} else {
|
||||||
title += "No stream from PiKVM";
|
title += "No stream from One-KVM";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
el_grab.innerText = el_info.innerText = title;
|
el_grab.innerText = el_info.innerText = title;
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ export function MediaStreamer(__setActive, __setInactive, __setInfo, __organizeH
|
|||||||
var __setupCodec = function(formats) {
|
var __setupCodec = function(formats) {
|
||||||
__closeDecoder();
|
__closeDecoder();
|
||||||
if (formats.h264 === undefined) {
|
if (formats.h264 === undefined) {
|
||||||
let msg = "No H.264 stream available on PiKVM";
|
let msg = "No H.264 stream available on One-KVM";
|
||||||
__setInfo(false, false, msg);
|
__setInfo(false, false, msg);
|
||||||
__logInfo(msg);
|
__logInfo(msg);
|
||||||
return;
|
return;
|
||||||
|
|||||||
1
web/share/svg/gostc.svg
Normal file
1
web/share/svg/gostc.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 30 KiB |
Reference in New Issue
Block a user