Skip to content

Commit

Permalink
Merge pull request #787 from aris-py/main
Browse files Browse the repository at this point in the history
Fedora support for install FFmpeg
  • Loading branch information
blaisewf authored Oct 5, 2024
2 parents d7195d1 + 0fefa11 commit 74ad6b7
Showing 1 changed file with 33 additions and 20 deletions.
53 changes: 33 additions & 20 deletions run-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,50 @@ install_ffmpeg() {
if [ -x "$(command -v apt)" ]; then
echo "Installing FFmpeg using apt..."
sudo apt update && sudo apt install -y ffmpeg
if [ $? -ne 0 ]; then
if [ $? -ne 0 ];then
echo "Error installing FFmpeg. Check your system's package manager."
exit 1
fi
elif [ -x "$(command -v pacman)" ]; then
echo "Installing FFmpeg using pacman..."
sudo pacman -Syu --noconfirm ffmpeg
if [ $? -ne 0 ]; then
if [ $? -ne 0 ];then
echo "Error installing FFmpeg. Check your system's package manager."
exit 1
fi
elif [ -x "$(command -v dnf)" ]; then
echo "Installing FFmpeg using dnf..."
sudo dnf install -y ffmpeg --allowerasing
if [ $? -ne 0 ];then
echo "Error installing FFmpeg with dnf. Trying Flatpak..."
install_ffmpeg_flatpak
fi
else
echo "Unsupported distribution for FFmpeg installation."
echo "Unsupported distribution for FFmpeg installation. Trying Flatpak..."
install_ffmpeg_flatpak
fi
}

# Function to install FFmpeg using Flatpak
install_ffmpeg_flatpak() {
if [ -x "$(command -v flatpak)" ]; then
echo "Installing FFmpeg using Flatpak..."
flatpak install --user -y flathub org.freedesktop.Platform.ffmpeg
if [ $? -ne 0 ]; then
echo "Error installing FFmpeg with Flatpak. Please check your Flatpak setup."
exit 1
fi
else
echo "Flatpak is not installed. Please install Flatpak and try again."
exit 1
fi
}


# Function to create or activate a virtual environment
prepare_install() {
if [ -d ".venv" ]; then
echo "Venv found. This implies Applio has been already installed or this is a broken install"
echo "Venv found. This implies Applio has been already installed or this is a broken install."
printf "Do you want to execute run-applio.sh? (Y/N): " >&2
read -r r
r=$(echo "$r" | tr '[:upper:]' '[:lower:]')
Expand All @@ -39,13 +62,8 @@ prepare_install() {
echo "Ok! The installation will continue. Good luck!"
fi
if [ -f ".venv/bin/activate" ]; then
if [ "$(uname)" = "Linux" ] && [ -x "$(command -v pacman)" ]; then
echo "Activating venv with 'source'..."
source .venv/bin/activate
else
echo "Activating venv with '.'..."
. .venv/bin/activate
fi
echo "Activating venv..."
source .venv/bin/activate
else
echo "Venv exists but activation file not found, re-creating venv..."
rm -rf .venv
Expand Down Expand Up @@ -79,15 +97,10 @@ create_venv() {
echo "Error creating the virtual environment. Check Python installation or permissions."
exit 1
fi
if [ "$(uname)" = "Linux" ] && [ -x "$(command -v pacman)" ]; then
echo "Activating venv with 'source'..."
source .venv/bin/activate
else
echo "Activating venv with '.'..."
. .venv/bin/activate
fi
echo "Activating venv..."
source .venv/bin/activate

# Installs pip using ensurepip or get-pip.py
# Install pip using ensurepip or get-pip.py
echo "Installing pip..."
python -m ensurepip --upgrade
if [ $? -ne 0 ]; then
Expand All @@ -100,7 +113,6 @@ create_venv() {
fi
fi
python -m pip install --upgrade pip
echo

install_ffmpeg

Expand All @@ -111,6 +123,7 @@ create_venv() {
exit 1
fi


python -m pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --upgrade --index-url https://download.pytorch.org/whl/cu121
finish
}
Expand Down

0 comments on commit 74ad6b7

Please sign in to comment.