#!/bin/bash #Wrapper for telegram #Adds info in the user's telegram.desktop #### TELEGRAM=${HOME}"/.local/bin/telegram/Telegram/Telegram" TDESKTOPPATH=${HOME}"/.local/share/applications" TDESKTOP=${TDESKTOPPATH}"/zero-lliurex-telegram.desktop" OLD_TDESKTOP=${TDESKTOPPATH}"/telegramdesktop.desktop" RS=0 USER=$(id -un $PKEXEC_UID) CHECK_GROUP=$(id -nG $USER ) AUTH_GROUP=0 AUTH_GROUP_LIST=("students" "alu") eval "CHECK_GROUP_LIST=($CHECK_GROUP)" for item in "${CHECK_GROUP_LIST[@]}";do gr=$(echo "$item" |awk '{print tolower($0)}') for i in "${AUTH_GROUP_LIST[@]}";do if [[ "$gr" == *"$i"* ]]; then AUTH_GROUP=1 break fi done if [ $AUTH_GROUP -eq 1 ];then break fi done if [ $AUTH_GROUP -eq 0 ];then if [ ! -x $TELEGRAM ] then pkexec /usr/share/zero-center/zmds/zero-lliurex-telegram.zmd else LANG=es_ES.UTF-8 $TELEGRAM #When finished regenerates the .desktop [ -a $TDESKTOPPATH ] || mkdir $TDESKTOPPATH -p echo "[Desktop Entry] Encoding=UTF-8 Version=1.0 Name=Telegram Desktop Comment=Official desktop version of Telegram messaging app Comment[es]=Versión oficial de Telegram Desktop Comment[ca]=Versió oficial del Telegram Desktop Comment[ca_ES@valencia]=Versió oficial del Telegram Desktop Exec=telegram Icon=telegram Terminal=false StartupWMClass=Telegram Type=Application Categories=Network; MimeType=x-scheme-handler/tg; X-Desktop-File-Install-Version=0.22 ">$TDESKTOP if [ -e $OLD_TDESKTOP ] then rm $OLD_TDESKTOP fi fi fi exit $RS