mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 17:50:29 +08:00
feat: 一些新功能和修复
1.启用初步 DRM 显示支持 2.预装 gostc 内网穿透 3.修复 systemd.journal 缺失问题
This commit is contained in:
parent
9373790f37
commit
1729badc55
@ -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 \
|
||||||
|
|||||||
@ -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"
|
||||||
|
|||||||
@ -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,7 @@ 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 && \\
|
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 +221,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
|
||||||
@ -324,6 +372,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"
|
||||||
|
|||||||
@ -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
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;
|
||||||
|
}
|
||||||
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 |
Loading…
x
Reference in New Issue
Block a user