Skip to content

Instantly share code, notes, and snippets.

@sadiqsalau
Last active May 18, 2025 08:51
Show Gist options
  • Save sadiqsalau/8644e414379b0a9eee8a35d527e966b4 to your computer and use it in GitHub Desktop.
Save sadiqsalau/8644e414379b0a9eee8a35d527e966b4 to your computer and use it in GitHub Desktop.
Telegram Portable Updater and Backuper

This script will generate a .desktop file for multiple telegram accounts.

#!/usr/bin/bash
# Directory Structure
# _BACKUP
# _BASE
echo "Cleanup Previous Backup"
rm -rf _BACKUP telegram-accounts-backup.zip
echo "Setting Up Backup Directory"
mkdir _BACKUP
echo "Creating Backups..."
find . -mindepth 1 -maxdepth 1 -type d ! -name _BASE ! -name _BACKUP \
-exec cp --parents -t _BACKUP \
{}/TelegramForcePortable/tdata/key_datas \
{}/TelegramForcePortable/tdata/D877F783D5D3EF8Cs \
{}/TelegramForcePortable/tdata/D877F783D5D3EF8C/maps \;
echo "Zipping Backup..."
zip -qr telegram-accounts-backup.zip \
_BACKUP \
_BASE \
backup.sh \
updater.sh;
#!/bin/bash
echo "Generating Desktop Entries..."
find . -mindepth 1 -maxdepth 1 -type d ! -name _BASE ! -name _BACKUP | while read -r dir; do
# Create Desktop Entry
work_dir=$(realpath "$dir/TelegramForcePortable")
desktop_file=$(realpath "$dir/Telegram.desktop")
cat > "$desktop_file" <<EOF
[Desktop Entry]
Name=Telegram
Exec=telegram-desktop -noupdate -workdir $work_dir
Icon=telegram
Type=Application
Terminal=false
StartupWMClass=telegram-desktop
EOF
chmod +x "$desktop_file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment