-
Notifications
You must be signed in to change notification settings - Fork 10
/
requirements.sh
executable file
·68 lines (61 loc) · 2.83 KB
/
requirements.sh
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
#!/bin/bash
set -e
WORK_DIR=$(dirname $(readlink -f "${BASH_SOURCE[0]}") )
# Check system
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$ID
VERSION_ID=$VERSION_ID
else
echo "Unsupported operating system"
exit 1
fi
if [[ "$OS" != "ubuntu" && "$OS" != "centos" && "$OS" != "kylin" && "$OS" != "debian" ]]; then
echo "Unsupported operating system: $OS"
exit 1
fi
# Check whether into Docker
if [ -f /.dockerenv ]; then
IN_DOCKER=true
else
IN_DOCKER=false
fi
# Install necessary dependencies
install_dependencies() {
if [ "$IN_DOCKER" = true ] && [ "$(id -u)" != "0" ]; then
echo "Running inside Docker as non-root user. Please ensure the necessary dependencies are installed manually."
fi
SUDO=sudo
if [ "$(id -u)" = "0" ]; then
SUDO=""
fi
if [ "$OS" == "ubuntu" ]; then
$SUDO apt-get update
$SUDO apt-get install -y autoconf automake build-essential cmake git-core libtool pkg-config wget
$SUDO apt-get install -y libass-dev libfreetype6-dev libsdl2-dev libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev texinfo zlib1g-dev yasm nasm libmp3lame-dev
elif [ "$OS" == "debian" ]; then
$SUDO apt-get update
$SUDO apt-get install -y autoconf automake build-essential cmake git-core libtool pkg-config wget
$SUDO apt-get install -y libass-dev libfreetype6-dev libsdl2-dev libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev texinfo zlib1g-dev yasm nasm libmp3lame-dev
elif [ "$OS" == "centos" ]; then
$SUDO yum install -y epel-release
$SUDO yum groupinstall -y "Development Tools"
$SUDO yum install -y autoconf automake cmake git libtool pkgconfig
$SUDO yum install -y freetype-devel libass-devel libva-devel libvdpau-devel libvorbis-devel libxcb-devel libX11-devel libXext-devel libXfixes-devel zlib-devel yasm nasm lame lame-devel
elif [ "$OS" == "kylin" ]; then
$SUDO apt-get update
$SUDO apt-get install -y autoconf automake build-essential cmake git libtool pkg-config wget
$SUDO apt-get install -y libass-dev libfreetype6-dev libsdl2-dev libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev texinfo zlib1g-dev yasm nasm libmp3lame-dev
# $SUDO yum update -y
# $SUDO yum install -y autoconf automake cmake git libtool pkgconfig wget
# $SUDO yum install -y freetype-devel libass-devel libva-devel libvdpau-devel libvorbis-devel libxcb-devel libX11-devel libXext-devel libXfixes-devel zlib-devel yasm nasm lame lame-devel
fi
}
# Main
install_dependencies
# Check yasm and nasm
if ! command -v yasm &> /dev/null && ! command -v nasm &> /dev/null; then
echo "Error: yasm or nams instal failed!!!!!!"
fi
echo ""
echo "FFmpeg dependencies has been installed successfully"