From 0e25f41eb643a55b99bee31d29055986e1993133 Mon Sep 17 00:00:00 2001 From: lan-yonghui Date: Mon, 29 Sep 2025 16:06:39 +0800 Subject: [PATCH] feat: add install FFmpeg --- data.yaml | 56 +++++++++++++++++++++++++- sh/install_ffmpeg.sh | 95 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 sh/install_ffmpeg.sh diff --git a/data.yaml b/data.yaml index fa7f486..2d3d005 100644 --- a/data.yaml +++ b/data.yaml @@ -6,20 +6,24 @@ scripts: interactive: true name: en: "Install Docker" + es-es: "Instalar Docker" ja: "Dockerをインストール" ko: "Docker 설치" ms: "Pasang Docker" pt-br: "Instalar Docker" ru: "Установить Docker" + tr: "Docker'ı Kur" zh-hant: "安裝 Docker" zh: "安装 Docker" description: en: "Install Docker" + es-es: "Instalar Docker" ja: "Dockerをインストール" ko: "Docker 설치" ms: "Pasang Docker" pt-br: "Instalar Docker" ru: "Установить Docker" + tr: "Docker'ı Kur" zh-hant: "安裝 Docker" zh: "安装 Docker" - key: install_clamav @@ -28,20 +32,24 @@ scripts: interactive: false name: en: "Install ClamAV" + es-es: "Instalar ClamAV" ja: "ClamAVをインストール" ko: "ClamAV 설치" ms: "Pasang ClamAV" pt-br: "Instalar ClamAV" ru: "Установить ClamAV" + tr: "ClamAV Kur" zh-hant: "安裝 ClamAV" zh: "安装 ClamAV" description: en: "Install ClamAV" + es-es: "Instalar ClamAV" ja: "ClamAVをインストール" ko: "ClamAV 설치" ms: "Pasang ClamAV" pt-br: "Instalar ClamAV" ru: "Установить ClamAV" + tr: "ClamAV Kur" zh-hant: "安裝 ClamAV" zh: "安装 ClamAV" - key: install_fail2ban @@ -50,20 +58,24 @@ scripts: interactive: false name: en: "Install Fail2ban" + es-es: "Instalar Fail2ban" ja: "Fail2banをインストール" ko: "Fail2ban 설치" ms: "Pasang Fail2ban" pt-br: "Instalar Fail2ban" ru: "Установить Fail2ban" + tr: "Fail2ban Kur" zh-hant: "安裝 Fail2ban" zh: "安装 Fail2ban" description: en: "Install Fail2ban" + es-es: "Instalar Fail2ban" ja: "Fail2banをインストール" ko: "Fail2ban 설치" ms: "Pasang Fail2ban" pt-br: "Instalar Fail2ban" ru: "Установить Fail2ban" + tr: "Fail2ban Kur" zh-hant: "安裝 Fail2ban" zh: "安装 Fail2ban" - key: install_firewall @@ -72,20 +84,24 @@ scripts: interactive: true name: en: "Install Firewall" + es-es: "Instalar Firewall" ja: "Firewallをインストール" ko: "Firewall 설치" ms: "Pasang Firewall" pt-br: "Instalar Firewall" ru: "Установить Firewall" + tr: "Firewall Kur" zh-hant: "安裝 Firewall" zh: "安装 Firewall" description: en: "Install Firewall" + es-es: "Instalar Firewall" ja: "Firewallをインストール" ko: "Firewall 설치" ms: "Pasang Firewall" pt-br: "Instalar Firewall" ru: "Установить Firewall" + tr: "Firewall Kur" zh-hant: "安裝 Firewall" zh: "安装 Firewall" - key: install_pure_ftpd @@ -94,20 +110,24 @@ scripts: interactive: false name: en: "Install Pure-FTPd" + es-es: "Instalar Pure-FTPd" ja: "Pure-FTPdをインストール" ko: "Pure-FTPd 설치" ms: "Pasang Pure-FTPd" pt-br: "Instalar Pure-FTPd" ru: "Установить Pure-FTPd" + tr: "Pure-FTPd Kur" zh-hant: "安裝 Pure-FTPd" zh: "安装 Pure-FTPd" description: en: "Install Pure-FTPd" + es-es: "Instalar Pure-FTPd" ja: "Pure-FTPdをインストール" ko: "Pure-FTPd 설치" ms: "Pasang Pure-FTPd" pt-br: "Instalar Pure-FTPd" ru: "Установить Pure-FTPd" + tr: "Pure-FTPd Kur" zh-hant: "安裝 Pure-FTPd" zh: "安装 Pure-FTPd" - key: install_supervisor @@ -116,20 +136,24 @@ scripts: interactive: false name: en: "Install Supervisor" + es-es: "Instalar Supervisor" ja: "Supervisorをインストール" ko: "Supervisor 설치" ms: "Pasang Supervisor" pt-br: "Instalar Supervisor" ru: "Установить Supervisor" + tr: "Supervisor Kur" zh-hant: "安裝 Supervisor" zh: "安装 Supervisor" description: en: "Install Supervisor" + es-es: "Instalar Supervisor" ja: "Supervisorをインストール" ko: "Supervisor 설치" ms: "Pasang Supervisor" pt-br: "Instalar Supervisor" ru: "Установить Supervisor" + tr: "Supervisor Kur" zh-hant: "安裝 Supervisor" zh: "安装 Supervisor" - key: install_rsync @@ -138,19 +162,49 @@ scripts: interactive: false name: en: "Install Rsync" + es-es: "Instalar Rsync" ja: "Rsyncをインストール" ko: "Rsync 설치" ms: "Pasang Rsync" pt-br: "Instalar Rsync" ru: "Установить Rsync" + tr: "Rsync Kur" zh-hant: "安裝 Rsync" zh: "安装 Rsync" description: en: "Install Rsync" + es-es: "Instalar Rsync" ja: "Rsyncをインストール" ko: "Rsync 설치" ms: "Pasang Rsync" pt-br: "Instalar Rsync" ru: "Установить Rsync" + tr: "Rsync Kur" zh-hant: "安裝 Rsync" - zh: "安装 Rsync" + zh: "安装 Rsync" + - key: install_ffmpeg + sort: 80 + groups: system + interactive: false + name: + en: "Install FFmpeg" + es-es: "Instalar FFmpeg" + ja: "FFmpegをインストール" + ko: "FFmpeg 설치" + ms: "Pasang FFmpeg" + pt-br: "Instalar FFmpeg" + ru: "Установить FFmpeg" + tr: "FFmpeg Kur" + zh-hant: "安裝 FFmpeg" + zh: "安装 FFmpeg" + description: + en: "Install FFmpeg" + es-es: "Instalar FFmpeg" + ja: "FFmpegをインストール" + ko: "FFmpeg 설치" + ms: "Pasang FFmpeg" + pt-br: "Instalar FFmpeg" + ru: "Установить FFmpeg" + tr: "FFmpeg Kur" + zh-hant: "安裝 FFmpeg" + zh: "安装 FFmpeg" \ No newline at end of file diff --git a/sh/install_ffmpeg.sh b/sh/install_ffmpeg.sh new file mode 100644 index 0000000..7f9334e --- /dev/null +++ b/sh/install_ffmpeg.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +# Install FFmpeg +# Support Ubuntu/Debian/CentOS/RHEL/Alpine/Arch Linux + +set -e + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +OS="" +VERSION="" + +detect_os() { + if [ -f /etc/os-release ]; then + . /etc/os-release + OS=$ID + VERSION=$VERSION_ID + if [ -n "$ID_LIKE" ]; then + OS_LIKE=$ID_LIKE + fi + elif type lsb_release >/dev/null 2>&1; then + OS=$(lsb_release -si | tr '[:upper:]' '[:lower:]') + VERSION=$(lsb_release -sr) + elif [ -f /etc/redhat-release ]; then + OS="rhel" + VERSION=$(grep -oE '[0-9]+\.[0-9]+' /etc/redhat-release) + OS_LIKE="rhel" + elif [ -f /etc/alpine-release ]; then + OS="alpine" + VERSION=$(cat /etc/alpine-release) + else + OS=$(uname -s | tr '[:upper:]' '[:lower:]') + VERSION=$(uname -r) + fi +} + +install_ffmpeg() { + echo -e "${GREEN}Detected system: $OS $VERSION, start to install FFmpeg...${NC}" + case "$OS" in + ubuntu|debian) + apt-get update + apt-get install -y ffmpeg + ;; + centos|rhel|fedora) + if [ "$OS" = "rhel" ] && [ "${VERSION%%.*}" -ge 8 ]; then + # CentOS 8 / RHEL 8+ + dnf install -y epel-release + dnf install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm + dnf install -y ffmpeg ffmpeg-devel + else + # CentOS 7 / RHEL 7 + yum install -y epel-release + yum install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm + yum install -y ffmpeg ffmpeg-devel || { + # fallback to Nux Dextop if still not available + rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro + rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm + yum install -y ffmpeg ffmpeg-devel + } + fi + ;; + alpine) + apk update + apk add ffmpeg + ;; + arch) + pacman -Sy --noconfirm ffmpeg + ;; + *) + echo -e "${RED}Unsupported system: $OS $VERSION${NC}" + exit 1 + ;; + esac +} + +check_ffmpeg_install() { + if command -v ffmpeg >/dev/null 2>&1; then + echo -e "${GREEN}FFmpeg is installed. Version: $(ffmpeg -version | head -n 1)${NC}" + else + echo -e "${RED}FFmpeg installation failed or not found.${NC}" + exit 1 + fi +} + +main() { + detect_os + install_ffmpeg + check_ffmpeg_install +} + +main "$@" +