Commit 2532130e authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm play: add Telegram Desktop

parent 87941f12
#!/bin/sh -x
# TODO: common place
fatal()
{
echo "FATAL: $*" >&2
exit 1
}
PKGNAME=Telegram
if [ "$1" = "--remove" ] ; then
# $PKGNAME-stable really
epm remove $(epmqp $PKGNAME)
exit
fi
[ "$1" != "--run" ] && echo "Install Telegram client from the official site" && exit
[ "$($DISTRVENDOR -a)" != "x86_64" ] && echo "Only x86_64 is supported" && exit 1
PKGURL=$($EGET --list --latest https://github.com/telegramdesktop/tdesktop/releases "tsetup.*.tar.xz") || fatal "Can't get package URL"
PKGFILE=$(echo /tmp/$(basename $PKGURL) | sed -e "s|/tsetup|/$PKGNAME|")
$EGET -O $PKGFILE $PKGURL || exit
epm install --repack "$PKGFILE" || exit
rm -fv $PKGFILE
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
PRODUCT=Telegram
# /usr/bin/Telegram
#subst '1iConflicts:telegram-desktop' $SPEC
# move package to /opt
ROOTDIR=$(basename $(find $BUILDROOT -mindepth 1 -maxdepth 1 -type d))
subst "s|^License: unknown$|License: GPLv2|" $SPEC
subst "s|^URL:.*|URL: https://desktop.telegram.org/|" $SPEC
subst "s|^Summary:.*|Summary: Telegram Desktop messaging app|" $SPEC
mkdir $BUILDROOT/opt
mv $BUILDROOT/$ROOTDIR $BUILDROOT/opt/$PRODUCT
subst "s|\"/$ROOTDIR/|\"/opt/$PRODUCT/|" $SPEC
# add binary in standart path
#mkdir -p $BUILDROOT/usr/bin/
#ln -s /opt/$PRODUCT/Telegram $BUILDROOT/usr/bin/$PRODUCT
#subst "s|%files|%files\n/usr/bin/$PRODUCT|" $SPEC
# create desktop file
mkdir -p $BUILDROOT/usr/share/applications/
cat <<EOF >$BUILDROOT/usr/share/applications/$PRODUCT.desktop
[Desktop Entry]
Version=1.0
Name=Telegram Desktop
Comment=Official desktop version of Telegram messaging app
TryExec=/opt/$PRODUCT/Telegram
Exec=/opt/$PRODUCT/Telegram -- %u
Icon=$PRODUCT
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
Categories=Chat;Network;InstantMessaging;Qt;
MimeType=x-scheme-handler/tg;
Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;
X-GNOME-UsesNotifications=true
EOF
subst "s|%files|%files\n/usr/share/applications/$PRODUCT.desktop|" $SPEC
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment