From 29ef5f238fffaf87f87024178822faf69377980c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=B5=E6=9B=A6?= Date: Mon, 1 Jul 2024 11:47:31 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=20ffmpeg=20=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install_dependencies.sh | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index 079efaa..f79c5dd 100644 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -6,22 +6,39 @@ # 判断系统架构 arch=$(uname -m) -pkg="none" -if [[ "${arch}" == "x86_64" ]]; then - pkg=ffmpeg-master-latest-linux64-gpl -elif [[ "${arch}" == "arm64" ]]; then - pkg=ffmpeg-master-latest-linuxarm64-gpl -fi +# 输出架构信息 +echo "当前系统架构是:$arch" -if [[ "${pkg}" != "none" ]]; then +install_from_build() { + pkg=$1 wget https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/$pkg.tar.xz tar -xvJf $pkg.tar.xz mv $pkg ffmpeg -else +} + +install_from_apt() { apt-get update apt-get install -y ffmpeg rm -rf /var/lib/apt/lists/* mkdir -p /app/ffmpeg/bin ln -s /usr/bin/ffmpeg /app/ffmpeg/bin/ffmpeg ln -s /usr/bin/ffprobe /app/ffmpeg/bin/ffprobe -fi +} + +# 基于架构执行不同的操作 +case "$arch" in +x86_64) + echo "64位 x86 架构" + pkg=ffmpeg-master-latest-linux64-gpl + install_from_build "$pkg" + ;; +arm64 | aarch64) + echo "64位 ARM 架构" + pkg=ffmpeg-master-latest-linuxarm64-gpl + install_from_build "$pkg" + ;; +*) + echo "未知架构 $arch" + install_from_apt + ;; +esac