#!/bin/bash
echo "Update :"
sudo apt install flatpak -y
echo "Install pack:"
sudo apt install gnome-software-plugin-flatpak -y
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install flathub fr.handbrake.ghb

echo "Start link:"
if [ ! -f /usr/local/bin/handbrake.sh ]
then
cat <<'EOF'>> /tmp/handbrake.sh
#!/bin/bash
flatpak run fr.handbrake.ghb
EOF
chmod +x /tmp/handbrake.sh
sudo cp /tmp/handbrake.sh /usr/local/bin/
fi

echo "Done"
