-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.sh
More file actions
90 lines (80 loc) · 2.31 KB
/
Copy pathlib.sh
File metadata and controls
90 lines (80 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# Universal ffmpeg installer - auto detects OS
set -e
echo "=== FFmpeg Auto-Installer ==="
echo "Detecting operating system..."
# Detect OS
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$ID
VERSION=$VERSION_ID
elif [ -f /etc/debian_version ]; then
OS="debian"
elif [ -f /etc/alpine-release ]; then
OS="alpine"
elif [[ "$OSTYPE" == "darwin"* ]]; then
OS="macos"
else
OS="unknown"
fi
echo "Detected: $OS"
case $OS in
alpine)
echo "📦 Using apk package manager..."
apk update
apk add ffmpeg
;;
debian|ubuntu|raspbian)
echo "📦 Using apt package manager..."
apt update
apt install -y ffmpeg
;;
centos|rhel|fedora)
echo "📦 Using yum/dnf package manager..."
if command -v dnf &> /dev/null; then
dnf install -y ffmpeg
else
# EPEL repo needed for CentOS/RHEL
yum install -y epel-release
yum install -y ffmpeg ffmpeg-devel
fi
;;
arch|manjaro)
echo "📦 Using pacman package manager..."
pacman -Sy --noconfirm ffmpeg
;;
opensuse*|suse)
echo "📦 Using zypper package manager..."
zypper install -y ffmpeg
;;
macos)
echo "📦 Using Homebrew..."
if ! command -v brew &> /dev/null; then
echo "Installing Homebrew first..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew install ffmpeg
;;
*)
echo "❌ Unsupported OS: $OS"
echo "Please install ffmpeg manually: https://ffmpeg.org/download.html"
exit 1
;;
esac
echo -e "\n✅ Verifying installation..."
if command -v ffmpeg &> /dev/null; then
FFMPEG_VERSION=$(ffmpeg -version | head -n1 | cut -d' ' -f3)
echo "✓ ffmpeg: $FFMPEG_VERSION"
else
echo "❌ ffmpeg installation failed!"
exit 1
fi
if command -v ffprobe &> /dev/null; then
FFPROBE_VERSION=$(ffprobe -version | head -n1 | cut -d' ' -f3)
echo "✓ ffprobe: $FFPROBE_VERSION"
fi
echo -e "\n📊 Installation info:"
if command -v du &> /dev/null; then
which ffmpeg ffprobe 2>/dev/null | xargs du -sh 2>/dev/null || echo " Size info unavailable"
fi
echo -e "\n🎉 FFmpeg installation complete!"