Last active
January 30, 2024 00:04
-
-
Save Razuuu/ed09304c51a3cafe1568dee02ddeb6eb to your computer and use it in GitHub Desktop.
64gram-install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Install 64Gram" | |
cd /tmp | |
# Download 64Gram from GitHub Releases | |
ghfile=$(curl -s https://api.github.com/repos/TDesktop-x64/tdesktop/releases/latest \ | |
| grep "browser_download_url.*64Gram_.*_linux.zip" \ | |
| cut -d : -f 2,3 \ | |
| tr -d \",) | |
function download_file() { | |
file_destination=$1 | |
repo_file_path=$2 | |
sudo curl -o "${file_destination}" -J --location-trusted --max-redirs 10 "https://github.com/TDesktop-x64/tdesktop/blob/dev/${repo_file_path}?raw=true" | |
} | |
# download 64gram | |
curl -L -o 64Gram_latest_linux.zip ${ghfile} | |
# Unzip | |
unzip 64Gram_latest_linux.zip | |
# Copy files to /opt/64gram | |
sudo mkdir -p /opt/64gram | |
sudo cp -r Telegram /opt/64gram/64gram-desktop | |
sudo cp -r Updater /opt/64gram/64gram-updater | |
# Download service, desktop and icon file | |
download_file "/usr/share/dbus-1/services/io.github.tdesktop_x64.TDesktop.service" "lib/xdg/io.github.tdesktop_x64.TDesktop.service" | |
download_file "/usr/share/applications/io.github.tdesktop_x64.TDesktop.desktop" "lib/xdg/io.github.tdesktop_x64.TDesktop.desktop" | |
download_file "/opt/64gram/icon.png" "Telegram/Telegram/Images.xcassets/Icon.iconset/icon_512x512.png" | |
# Rename everything to 64gram | |
# service | |
sudo sed -i 's|Name=io.github.tdesktop_x64.TDesktop|Name=io.github.tdesktop_x64.TDesktop.desktop|' /usr/share/dbus-1/services/io.github.tdesktop_x64.TDesktop.service | |
sudo sed -i 's|Exec=@CMAKE_INSTALL_FULL_BINDIR@/telegram-desktop|Exec=/usr/bin/64gram-desktop|' /usr/share/dbus-1/services/io.github.tdesktop_x64.TDesktop.service | |
# desktop | |
sudo sed -i 's|TryExec=telegram-desktop|TryExec=64gram-desktop|' /usr/share/applications/io.github.tdesktop_x64.TDesktop.desktop | |
sudo sed -i 's|Exec=telegram-desktop -- %u|Exec=64gram-desktop -- %u|' /usr/share/applications/io.github.tdesktop_x64.TDesktop.desktop | |
sudo sed -i 's|Icon=telegram|Icon=/opt/64gram/icon.png|' /usr/share/applications/io.github.tdesktop_x64.TDesktop.desktop | |
sudo sed -i 's|Exec=telegram-desktop -quit|Exec=64gram-desktop -quit|' /usr/share/applications/io.github.tdesktop_x64.TDesktop.desktop | |
sudo sed -i 's|Name=Quit Telegram|Name=Quit 64Gram|' /usr/share/applications/io.github.tdesktop_x64.TDesktop.desktop | |
# set symlink | |
sudo ln -sf /opt/64gram/64gram-desktop /usr/bin/64gram-desktop | |
sudo ln -sf /opt/64gram/64gram-updater /usr/bin/64gram-updater | |
# Add execute permission and set root user | |
sudo chown root:root -R /opt/64gram/ | |
sudo chmod -R +x /opt/64gram/ | |
# Delete temp files | |
rm -rf Telegram Updater 64Gram_latest_linux.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment