Skip to content

Instantly share code, notes, and snippets.

@kobylyanets
Last active October 29, 2018 01:01
Show Gist options
  • Save kobylyanets/a06d7f3df8dc95fedfe0bd0ea98067dd to your computer and use it in GitHub Desktop.
Save kobylyanets/a06d7f3df8dc95fedfe0bd0ea98067dd to your computer and use it in GitHub Desktop.
telegram-installer.sh
#!/bin/bash
echo "============================================="
echo "== Telegram Script Installer =="
echo "== =="
echo "== for www.LinuxRussia.com =="
echo "============================================="
echo "Downloading necesary files..."
cd /tmp
wget -O - https://tdesktop.com/linux > tsetup.tar.xz
echo "Extracting files..."
tar -xJvf tsetup.tar.xz
echo "Checking destination folder..."
installdir="$HOME/.apps/telegram"
echo "Checking apps folder..."
appsfolder="$HOME/.apps"
if [ ! -d $appsfolder ]; then
mkdir $HOME/.apps
echo "Created ${appsfolder}"
elif [ -d $installdir ]; then
rm -r $installdir
echo "Removed old ${installdir}"
else
echo "${installdir} is not exists...moving on"
fi
mv Telegram $installdir
echo "Moved new files to ${installdir}"
echo "Checking duplicating shortcut files"
telegramdesktop="$HOME/.local/share/applications/telegramdesktop.desktop"
if [ -f $telegramdesktop ]; then
sudo rm $telegramdesktop
echo "Removed old shortcut: ${telegramdesktop}"
else
echo "${telegramdesktop} is not exists...moving on"
fi
echo "Checking old config"
old_data="$HOME/.local/share/TelegramDesktop"
if [ -d ${old_data} ]; then
sudo rm -r ${old_data}
echo "Removed old config data: ${old_data}"
else
echo "${old_data} is not exists...moving on"
fi
rm /tmp/tsetup.tar.xz
echo "Removed tmp files..."
echo "Checking old Telegram installation in /opt and removing it"
old_installdir="/opt/telegram"
if [ -d $old_installdir ];then
sudo rm -r $old_installdir
echo "Removed old installation ${old_installdir}"
else
echo "${old_installdir} is not exists...moving on"
fi
echo "Installation Complete! Launching Telegram for initial configuration"
$installdir/Updater > /dev/null 2>&1 &
@jumper423
Copy link

wget -O - https://github.com/telegramdesktop/tdesktop/releases/download/v1.3.8/tsetup.1.3.8.tar.xz > tsetup.tar.xz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment