Skip to content

Instantly share code, notes, and snippets.

@peshmerge
Last active June 22, 2024 11:29
Show Gist options
  • Save peshmerge/fb04bfd1ecb6a7aad3b25440071530ba to your computer and use it in GitHub Desktop.
Save peshmerge/fb04bfd1ecb6a7aad3b25440071530ba to your computer and use it in GitHub Desktop.
Ubuntu FileZilla Installer & updates
#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 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment