-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtelegram-appimage.sh
More file actions
42 lines (34 loc) · 1.44 KB
/
telegram-appimage.sh
File metadata and controls
42 lines (34 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
set -ex
export ARCH=$(uname -m)
export APPIMAGE_EXTRACT_AND_RUN=1
REPO="https://api.github.com/repos/telegramdesktop/tdesktop/releases"
APPIMAGETOOL="https://github.com/pkgforge-dev/appimagetool-uruntime/releases/download/continuous/appimagetool-$ARCH.AppImage"
UPINFO="gh-releases-zsync|$(echo $GITHUB_REPOSITORY | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
DESKTOP="https://github.com/telegramdesktop/tdesktop/raw/refs/heads/dev/lib/xdg/org.telegram.desktop.desktop"
ICON="https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/Resources/art/icon256.png?raw=true"
export URUNTIME_PRELOAD=1 # really needed here
# the linux releases of telegram don't mention linuxi n the url wtf
tarball_url=$(wget "$REPO" -O - | sed 's/[()",{} ]/\n/g' | grep -oi "https.*.tar.xz$" | head -1)
export VERSION=$(echo "$tarball_url" | awk -F'/' '{print $(NF-1); exit}')
echo "$VERSION" > ~/version
wget "$tarball_url" -O ./package.tar.xz
tar xvf ./package.tar.xz
rm -f ./package.tar.xz
mv -v ./Telegram ./AppDir && (
cd ./AppDir
rm -f ./Updater
wget "$DESKTOP" -O ./org.telegram.desktop.desktop
wget "$ICON" -O ./org.telegram.desktop.png
wget "$ICON" -O ./.DirIcon
cat > ./AppRun <<- 'KEK'
#!/bin/sh
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
export DESKTOPINTEGRATION=0
exec "${CURRENTDIR}/Telegram" "$@"
KEK
chmod +x ./AppRun ./Telegram
)
wget "$APPIMAGETOOL" -O ./appimagetool
chmod +x ./appimagetool
./appimagetool -n -u "$UPINFO" ./AppDir