File-To-Video-Encoder/install.sh
2022-09-02 12:09:27 -04:00

108 lines
No EOL
3.1 KiB
Bash
Executable file

#!/bin/sh
function getManager {
if command -v pacman >/dev/null; then
echo "pacman"
elif command -v apt >/dev/null; then
echo "apt"
elif command -v yum >/dev/null; then
echo "yum"
else
echo "none"
fi
}
function hasCommand {
if ! command -v $1 >/dev/null;
then
read -s -p $"$2 [N/y]" response
case "$response" in
[yY])
return 1
;;
*)
echo $"cannot proceede without $1"
exit 1
;;
esac
fi
return 0
}
packageManager=$(getManager)
if ! hasCommand "nimble" "Nimble was not found on this computer, would you like to install nim from Choosenim?"
then
echo "Installing choosenim via curl + bash"
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
fi
if ! hasCommand "ffmpeg" "FFMPEG not found, would you like to try and install it?"; then
case $packageManager in
pacman)
echo 'install ffmpeg via pacman core repo'
sudo pacman -S ffmpeg
;;
yum)
echo "FFMPEG is not avalible in the yum core repo"
echo 'sudo yum install epel-release'
echo 'sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm'
echo 'sudo yum install ffmpeg ffmpeg-devel'
read -s -p $'are you ok with the following install commands? [N/y]\n' response
case "$response" in
[yY])
sudo yum install epel-release
sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
sudo yum install ffmpeg ffmpeg-devel
;;
*)
echo "cannot proceede without ffmpeg"
exit 1
;;
esac
;;
apt)
echo 'install ffmpeg via apt core repo'
sudo apt update
sudo apt install ffmpeg
;;
none)
echo "'other' package manager. Please install it yourself before continuing!"
exit 1
;;
esac
fi
if ! hasCommand "pip" "pip not found, would you like to try and install it?"; then
case $packageManager in
pacman)
sudo pacman -S python
;;
yum)
sudo yum install -y python3
;;
apt)
sudo apt install python
;;
none)
echo "please install python on your own"
exit 1
;;
esac
fi
if ! python -c 'import pkgutil; print(1 if pkgutil.find_loader("matplotlib") else 0)' > /dev/null; then
echo "installing matplotlib!"
pip3 install "matplotlib"
fi
if ! [ -d "ldpc" ]; then
mkdir ldpc
echo "Installing LDPC"
git clone https://github.com/radfordneal/LDPC-codes
cd LDPC-codes
make
./LDPC-install ../ldpc/
cd ..
rm -rf LDPC-codes
fi
nimble install nimpy simplepng nimpng 'arraymancer@#head' itertools -n illwill > /dev/null