First Upload (ffmpeg-install v1.0)
This commit is contained in:
commit
15d34e337b
166
ffmpeg-install
Executable file
166
ffmpeg-install
Executable file
|
@ -0,0 +1,166 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Script to install FFmpeg on GNU/Linux
|
||||
# Website: http://johnvansickle.com/ffmpeg/
|
||||
# Created by clamsawd (clamsawd@openmailbox.org)
|
||||
# Builds by John Van Sickle (john.vansickle@gmail.com)
|
||||
# Licensed by GPL v.2
|
||||
# Date: 16-10-2015
|
||||
# --------------------------------------
|
||||
VERSION=1.0
|
||||
|
||||
URL=http://johnvansickle.com/ffmpeg/
|
||||
URL_RELEASES=http://johnvansickle.com/ffmpeg/releases/
|
||||
URL_BUILDS=http://johnvansickle.com/ffmpeg/builds/
|
||||
TMP_DIR=/tmp
|
||||
PATH_INSTALL=/usr/bin/
|
||||
|
||||
# Check if 'user' is 'root'
|
||||
user=$(whoami)
|
||||
if [ "$user" == "root" ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "You must be root!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Detect "kernel" name
|
||||
KERNEL=$(uname -s)
|
||||
|
||||
if [ $KERNEL == "Linux" ]; then
|
||||
KERNEL=linux
|
||||
else
|
||||
echo "Unsupported OS ($KERNEL)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Detect "arch" system
|
||||
archs=`uname -m`
|
||||
case "$archs" in
|
||||
i?86)
|
||||
ARCH=32bit
|
||||
;;
|
||||
x86_64)
|
||||
ARCH=64bit
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported Arquitecture ($archs)"
|
||||
exit 0
|
||||
esac
|
||||
|
||||
#Check if 'curl' is installed.
|
||||
curl --help > /dev/null
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "You must install 'curl'."
|
||||
fi
|
||||
|
||||
# Check available downloaders (wget, axel or aria2c).
|
||||
wget --help > /dev/null
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
APP_DOWNLOAD='wget -c'
|
||||
else
|
||||
echo "wget disabled"
|
||||
fi
|
||||
|
||||
axel --help > /dev/null
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
APP_DOWNLOAD='axel'
|
||||
else
|
||||
echo "axel disabled"
|
||||
fi
|
||||
|
||||
aria2c --help > /dev/null
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
APP_DOWNLOAD='aria2c --check-certificate=false'
|
||||
else
|
||||
echo "aria2c disabled"
|
||||
fi
|
||||
|
||||
if [ "x$APP_DOWNLOAD" = "x" ] ; then
|
||||
echo "Error: You must install 'wget' or 'axel' or 'aria2'."
|
||||
fi
|
||||
|
||||
#Install, update & uninstall FFmpeg
|
||||
case $1 in
|
||||
|
||||
--install|-install|--update|-update)
|
||||
cd $TMP_DIR
|
||||
rm -rf ffmpeg-*
|
||||
if [ "$2" == "release" ] ; then
|
||||
curl $URL | grep "$URL_RELEASES" | cut -d '"' -f 2 | grep "$ARCH" > $TMP_DIR/ffmpeg-url
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "Connection problem!"
|
||||
echo "Exiting..."
|
||||
exit
|
||||
fi
|
||||
else
|
||||
curl $URL | grep "$URL_BUILDS" | cut -d '"' -f 2 | grep "$ARCH" > $TMP_DIR/ffmpeg-url
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "Connection problem!"
|
||||
echo "Exiting..."
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
URL_PACKAGE=`cat $TMP_DIR/ffmpeg-url`
|
||||
NAME_PACKAGE=`cat /tmp/ffmpeg-url | cut -d "/" -f 6`
|
||||
$APP_DOWNLOAD $URL_PACKAGE
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
echo "OK" > /dev/null
|
||||
else
|
||||
echo "Connection problem!"
|
||||
echo "Exiting..."
|
||||
exit
|
||||
fi
|
||||
tar Jxvf $NAME_PACKAGE
|
||||
cd ffmpeg-*
|
||||
cp -rf ffmpeg $PATH_INSTALL
|
||||
cp -rf ffmpeg-10bit $PATH_INSTALL
|
||||
cp -rf ffprobe $PATH_INSTALL
|
||||
cp -rf ffserver $PATH_INSTALL
|
||||
cd ..
|
||||
rm -rf ffmpeg-*
|
||||
echo "Done!"
|
||||
exit 0
|
||||
;;
|
||||
--uninstall|-uninstall)
|
||||
echo "Uninstalling..."
|
||||
sleep 3
|
||||
rm -rf /usr/bin/ffmpeg
|
||||
rm -rf /usr/bin/ffprobe
|
||||
rm -rf /usr/bin/ffserver
|
||||
rm -rf /usr/bin/ffmpeg-10bit
|
||||
echo "Done!"
|
||||
;;
|
||||
--help|-help|-h|*)
|
||||
clear
|
||||
echo ""
|
||||
echo "** ffmpeg-install v.$VERSION **"
|
||||
echo ""
|
||||
echo "* How to install:"
|
||||
echo ""
|
||||
echo " ffmpeg-install --install (Latest git version)"
|
||||
echo " ffmpeg-install --install release (Latest stable version)"
|
||||
echo ""
|
||||
echo "* How to update:"
|
||||
echo ""
|
||||
echo " ffmpeg-install --update (Latest git version)"
|
||||
echo " ffmpeg-install --update release (Latest stable version)"
|
||||
echo ""
|
||||
echo "* How to uninstall:"
|
||||
echo ""
|
||||
echo " ffmpeg-install --uninstall"
|
||||
echo ""
|
||||
echo "* Show help:"
|
||||
echo ""
|
||||
echo " ffmpeg --help"
|
||||
echo ""
|
||||
exit 0
|
||||
esac
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user