A fully automated Filezilla installer bash-script on Ubuntu Linux 20.042 min read

Almost five years ago, I wrote this blog post Making an installer/updater for Filezilla on Ubuntu Linux

Today in this blog post, I present a fully automated bash script based on my earlier script. This script automatically pulls the latest version of FileZilla tarball from Filezilla project website and installs it on your Ubuntu machine 🙂
Personally, I use this script on my laptop whenever a new version of FileZilla is released!

Copy the code below into a file and save it as filezilla-installer.sh, using the command line make it executable chmod +x filezilla-installer.sh.Finally, execute the file ./filezilla-installer.sh

#Get the download link of the file.
# Here we make the assumption that the provided link will be a link to a linux tarball because we provide a linux user-agent to WGET
DNLD_LINK=(wget -O - https://filezilla-project.org/download.php?type=client \     --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36"\     |   grep -io '<a id="quickdownloadbuttonlink" href=['"'"'"][^"'"'"']*['"'"'"]' \     |   sed -e 's/^<a id="quickdownloadbuttonlink" href=["'"'"']//i' -e 's/["'"'"']//i')

#Download using wget
wget -O filezilla "$DNLD_LINK"

#Uncompress the file 
tar xvf filezilla

#Check if the dir already exists
if [ -d "/opt/FileZilla3" ]
 then
 sudo rm -r /opt/FileZilla3
 fi

#Move the folder to /opt/
sudo mv -v FileZilla3/ /opt/

#Check if the symlink already exists
if [ -e /usr/local/bin/filezilla ]
 then
 sudo rm /usr/local/bin/filezilla
 fi

#Create a new symlink 
sudo ln -s /opt/FileZilla3/bin/filezilla /usr/local/bin/filezilla

#Copy the filezilla.desktop file to /usr/share/applications/ to enable us bookmark filezilla (add it to Ubuntu dock)
sudo cp /opt/FileZilla3/share/applications/filezilla.desktop /usr/share/applications/

#Copy all filezilla provided icons to the /usr/share/icons/
sudo cp -a /opt/FileZilla3/share/icons/hicolor/* /usr/share/icons/hicolor/

#Change the icon of filezilla to avoid missing icons 
if [ -f /usr/share/icons/hicolor/scalable/apps/filezilla.svg ]
 then
 sudo desktop-file-edit --set-icon="/usr/share/icons/hicolor/scalable/apps/filezilla.svg" /usr/share/applications/filezilla.desktop
 fi

#Make the filezilla.desktop executable
sudo chmod +x /usr/share/applications/filezilla.desktop


echo "Removing the downloaded file"
#Remove the downloaded file from 
# sudo rm -r filezilla*

echo "Finished installing"

#Run Filezilla
filezilla &

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.