mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-04 03:42:44 +08:00
feat: 增强构建系统功能和设备兼容性
- 在 common.sh 中新增 download_rc_local 函数,支持自动下载平台特定的 rc.local 文件 - 集成 rc.local 自动下载到 install.sh 的 config_base_files 函数中 - 更新 cumebox2 设备配置,使用较新的 Armbian 镜像版本并增加 900MB 扩展空间 - 更新 octopus-flanet 设备使用最新的 Armbian 25.05.0 镜像 - 在 udev 规则中为 ttyUSB0 设备添加 kvmd-hid 符号链接支持 - 完善文件下载机制,支持 GitHub Actions 环境下的临时文件清理
This commit is contained in:
@@ -244,6 +244,37 @@ download_file_if_missing() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# 下载 rc.local 文件
|
||||
download_rc_local() {
|
||||
local platform_id="$1"
|
||||
local rc_local_path="$SRCPATH/image/$platform_id/rc.local"
|
||||
local relative_path="image/$platform_id/rc.local"
|
||||
local remote_url="$REMOTE_PREFIX/$relative_path"
|
||||
|
||||
echo "信息:检查是否需要下载 rc.local 文件 ($platform_id)..."
|
||||
|
||||
# 如果本地文件不存在,尝试下载
|
||||
if [ ! -f "$rc_local_path" ]; then
|
||||
echo "信息:本地 rc.local 文件不存在,尝试从远程下载..."
|
||||
ensure_dir "$(dirname "$rc_local_path")"
|
||||
|
||||
if curl -sSL --fail "$remote_url" -o "$rc_local_path"; then
|
||||
echo "信息:成功下载 rc.local 文件:$remote_url"
|
||||
# 在 GitHub Actions 环境中记录下载的文件
|
||||
if is_github_actions; then
|
||||
echo "$rc_local_path" >> "$DOWNLOADED_FILES_LIST"
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
echo "信息:远程 rc.local 文件不存在或下载失败:$remote_url"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo "信息:使用本地 rc.local 文件:$rc_local_path"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# 清理下载的文件(仅在 GitHub Actions 环境中)
|
||||
cleanup_downloaded_files() {
|
||||
if is_github_actions && [[ -f "$DOWNLOADED_FILES_LIST" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user