Initial release

Original message: https://t.me/TelegramDesktopTalk/95796
This commit is contained in:
Michael De Roover 2023-02-09 07:46:00 +01:00
commit b04d23dfcd
Signed by: vim
GPG Key ID: 075496E232CE04CB

31
tg-setup Normal file
View File

@ -0,0 +1,31 @@
#!/bin/sh
permerr(){
printf "This script has been executed as the root user.\n"
printf "Please run it as a regular user instead.\n"
exit 1
}
[ $(id -u) == "0" ] && permerr
# Environment variables
user_id=$(id -u)
user_name=$(whoami)
tmp="/tmp/tg-setup"
data="/home/${user_name}/.local/share/TelegramDesktop"
# Establish the tmpfs for Telegram
mkdir $tmp
cp -rv $data/* $tmp
sudo mount -t tmpfs -o size=256M,mode=1777 telegram $data
cp -rv $tmp/* $data/
telegram
read -p "Do you want to remove the cached application data? (y/n) " remove_app_data
f_remove_app_data(){
sudo umount telegram
rm -r $tmp
}
[ "$remove_app_data" != "n" ] && f_remove_app_data