Better indent in source code

This commit is contained in:
q3aql 2021-03-28 03:29:56 +02:00
parent 92d2f8d6c1
commit eb69ed31ae

View File

@ -24,99 +24,99 @@ NAME_APP_DOWNLOAD="x"
# Function to check root permission # Function to check root permission
function rootMessage() { function rootMessage() {
mkdir -p /etc/root &> /dev/null mkdir -p /etc/root &> /dev/null
administrator=$? administrator=$?
if [ ${administrator} -eq 0 ] ; then if [ ${administrator} -eq 0 ] ; then
rm -rf /etc/root rm -rf /etc/root
else else
echo "" echo ""
echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)" echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)"
echo "" echo ""
echo "+ Root permissions are required!" echo "+ Root permissions are required!"
echo "" echo ""
exit exit
fi fi
} }
# Function to detect "kernel" name # Function to detect "kernel" name
function kernelCheck() { function kernelCheck() {
KERNEL=$(uname -s) KERNEL=$(uname -s)
if [ $KERNEL == "Linux" ]; then if [ $KERNEL == "Linux" ]; then
KERNEL=linux KERNEL=linux
else else
echo "" echo ""
echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)" echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)"
echo "" echo ""
echo "+ Unsupported OS ($KERNEL)" echo "+ Unsupported OS ($KERNEL)"
echo "" echo ""
exit exit
fi fi
} }
# Function to detect "arch" system. # Function to detect "arch" system.
function archCheck() { function archCheck() {
archs=`uname -m` archs=`uname -m`
case "$archs" in case "$archs" in
i?86) i?86)
ARCH=i686 ARCH=i686
;; ;;
x86_64) x86_64)
ARCH=amd64 ARCH=amd64
;; ;;
*) *)
echo "" echo ""
echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)" echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)"
echo "" echo ""
echo "+ Unsupported Arquitecture ($archs)" echo "+ Unsupported Arquitecture ($archs)"
echo "" echo ""
exit exit
esac esac
} }
# Function to check if 'curl' is installed. # Function to check if 'curl' is installed.
function curlCheck () { function curlCheck () {
curl --help &> /dev/null curl --help &> /dev/null
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
echo "OK" > /dev/null echo "OK" > /dev/null
else else
echo "" echo ""
echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)" echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)"
echo "" echo ""
echo "+ Error: You must install 'curl'." echo "+ Error: You must install 'curl'."
echo "" echo ""
exit exit
fi fi
} }
# Function to check available downloaders (wget, axel or aria2c). # Function to check available downloaders (wget, axel or aria2c).
function checkDownloader() { function checkDownloader() {
# Check wget installed # Check wget installed
wget --help &> /dev/null wget --help &> /dev/null
checkWget="$?" checkWget="$?"
# Check axel installed # Check axel installed
axel --help &> /dev/null axel --help &> /dev/null
checkAxel="$?" checkAxel="$?"
# Check aria2c installed # Check aria2c installed
aria2c --help &> /dev/null aria2c --help &> /dev/null
checkAria2="$?" checkAria2="$?"
# Check variables # Check variables
if [ ${checkAria2} -eq 0 ] ; then if [ ${checkAria2} -eq 0 ] ; then
APP_DOWNLOAD='aria2c --check-certificate=false' APP_DOWNLOAD='aria2c --check-certificate=false'
NAME_APP_DOWNLOAD="aria2c" NAME_APP_DOWNLOAD="aria2c"
elif [ ${checkAxel} -eq 0 ] ; then elif [ ${checkAxel} -eq 0 ] ; then
APP_DOWNLOAD='axel' APP_DOWNLOAD='axel'
NAME_APP_DOWNLOAD="axel" NAME_APP_DOWNLOAD="axel"
elif [ ${checkWget} -eq 0 ] ; then elif [ ${checkWget} -eq 0 ] ; then
APP_DOWNLOAD='wget -c' APP_DOWNLOAD='wget -c'
NAME_APP_DOWNLOAD="wget" NAME_APP_DOWNLOAD="wget"
elif [ "x${APP_DOWNLOAD}" = "x" ] ; then elif [ "x${APP_DOWNLOAD}" = "x" ] ; then
echo "" echo ""
echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)" echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)"
echo "" echo ""
echo "+ Error: You must install 'wget' or 'axel' or 'aria2'." echo "+ Error: You must install 'wget' or 'axel' or 'aria2'."
echo "" echo ""
exit exit
fi fi
} }
# Check all configs # Check all configs
@ -128,79 +128,79 @@ checkDownloader
# Sintax to install, update and uninstall FFmpeg. # Sintax to install, update and uninstall FFmpeg.
case ${1} in case ${1} in
--install|-install|--update|-update) --install|-install|--update|-update)
cd ${TMP_DIR} cd ${TMP_DIR}
rm -rf ffmpeg-* rm -rf ffmpeg-*
echo "" echo ""
echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)" echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)"
echo "" echo ""
if [ "${2}" == "release" ] ; then if [ "${2}" == "release" ] ; then
curl ${URL} | grep "${URL_RELEASES}" | cut -d '"' -f 2 | grep "${ARCH}" | head -1 > $TMP_DIR/ffmpeg-url curl ${URL} | grep "${URL_RELEASES}" | cut -d '"' -f 2 | grep "${ARCH}" | head -1 > $TMP_DIR/ffmpeg-url
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
echo "OK" > /dev/null echo "OK" > /dev/null
else else
echo "+ Connection problem!" echo "+ Connection problem!"
echo "* Exiting..." echo "* Exiting..."
exit exit
fi fi
else else
curl ${URL} | grep "${URL_BUILDS}" | cut -d '"' -f 2 | grep "${ARCH}" | head -1 > $TMP_DIR/ffmpeg-url curl ${URL} | grep "${URL_BUILDS}" | cut -d '"' -f 2 | grep "${ARCH}" | head -1 > $TMP_DIR/ffmpeg-url
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
echo "OK" > /dev/null echo "OK" > /dev/null
else else
echo "+ Connection problem!" echo "+ Connection problem!"
echo "* Exiting..." echo "* Exiting..."
exit exit
fi fi
fi fi
URL_PACKAGE=`cat $TMP_DIR/ffmpeg-url` URL_PACKAGE=`cat $TMP_DIR/ffmpeg-url`
NAME_PACKAGE=`cat /tmp/ffmpeg-url | cut -d "/" -f 6` NAME_PACKAGE=`cat /tmp/ffmpeg-url | cut -d "/" -f 6`
#clear #clear
echo "* Downloading ${NAME_PACKAGE} (${NAME_APP_DOWNLOAD})" echo "* Downloading ${NAME_PACKAGE} (${NAME_APP_DOWNLOAD})"
${APP_DOWNLOAD} ${URL_PACKAGE} ${APP_DOWNLOAD} ${URL_PACKAGE}
if [ "$?" -eq 0 ] ; then if [ "$?" -eq 0 ] ; then
echo "OK" > /dev/null echo "OK" > /dev/null
else else
echo "" echo ""
echo "+ Connection problem!" echo "+ Connection problem!"
echo "* Exiting..." echo "* Exiting..."
exit exit
fi fi
tar Jxvf ${NAME_PACKAGE} tar Jxvf ${NAME_PACKAGE}
rm -f ffmpeg-url ffmpeg*xz rm -f ffmpeg-url ffmpeg*xz
cd ffmpeg-* cd ffmpeg-*
cp -rfv ffmpeg ${PATH_INSTALL} cp -rfv ffmpeg ${PATH_INSTALL}
cp -rfv ffprobe ${PATH_INSTALL} cp -rfv ffprobe ${PATH_INSTALL}
cd .. cd ..
rm -rf ffmpeg-* rm -rf ffmpeg-*
echo "* Finished!" echo "* Finished!"
exit exit
;; ;;
--uninstall|-uninstall) --uninstall|-uninstall)
echo "" echo ""
echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)" echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)"
echo "" echo ""
echo "* Uninstalling FFmpeg..." echo "* Uninstalling FFmpeg..."
sleep 3 sleep 3
rm -rfv /usr/bin/ffmpeg rm -rfv /usr/bin/ffmpeg
rm -rfv /usr/bin/ffprobe rm -rfv /usr/bin/ffprobe
echo "* Finished!" echo "* Finished!"
;; ;;
--help|-help|-h|*) --help|-help|-h|*)
echo "" echo ""
echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)" echo "* ffmpeg-install ${VERSION} (${M_DATE}) (GPL v2.0)"
echo "" echo ""
echo "* Script: q3aql (q3aql@protonmail.ch)" echo "* Script: q3aql (q3aql@protonmail.ch)"
echo "* Builds: John Van Sickle (john.vansickle@gmail.com)" echo "* Builds: John Van Sickle (john.vansickle@gmail.com)"
echo "" echo ""
echo "+ Sintax:" echo "+ Sintax:"
echo "" echo ""
echo " $ ffmpeg-install --install --> Install FFmpeg (Git version)" echo " $ ffmpeg-install --install --> Install FFmpeg (Git version)"
echo " $ ffmpeg-install --install release --> Install FFmpeg (Stable version)" echo " $ ffmpeg-install --install release --> Install FFmpeg (Stable version)"
echo " $ ffmpeg-install --update --> Update FFmpeg (Git version)" echo " $ ffmpeg-install --update --> Update FFmpeg (Git version)"
echo " $ ffmpeg-install --update release --> Update FFmpeg (Stable version)" echo " $ ffmpeg-install --update release --> Update FFmpeg (Stable version)"
echo " $ ffmpeg-install --uninstall --> Uninstall FFmpeg previously installed" echo " $ ffmpeg-install --uninstall --> Uninstall FFmpeg previously installed"
echo " $ ffmpeg-install --help --> Show help" echo " $ ffmpeg-install --help --> Show help"
echo "" echo ""
exit exit
esac esac