-
-
Save ruario/d3d4b899836396316f20ea24308abfc0 to your computer and use it in GitHub Desktop.
This script fetches the "teams-for-linux" package and extracts a suitable libffmpeg.so with proprietary media support for use in Vivaldi on older and unsupported distros.
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/sh -eu | |
available () { | |
command -v "$1" >/dev/null 2>&1 | |
} | |
# teams-for-linux version 1.0.29 (released 2022-08-19) contains: | |
# * Electron 20.0.0 (Chromium 104) / FFMpeg version 108069 | |
case "$(uname -m)" in | |
x86_64) TEAMS_IMG=IIAJhVGfBhm393UTagoW5awtZlPDGqHd_230.snap ;; | |
arm*) TEAMS_IMG=IIAJhVGfBhm393UTagoW5awtZlPDGqHd_231.snap ;; | |
aarch64) TEAMS_IMG=IIAJhVGfBhm393UTagoW5awtZlPDGqHd_234.snap ;; | |
esac | |
# Set Vivaldi variables | |
VIVALDI_STREAM="${VIVALDI_STREAM:-stable}" | |
if [ "$VIVALDI_STREAM" = "stable" ]; then | |
VIVALDI_MAJOR_VERSION=5.4 | |
VIVALDI_INSTALL_DIR="/opt/vivaldi/" | |
elif [ "$VIVALDI_STREAM" = "snapshot" ]; then | |
VIVALDI_MAJOR_VERSION=5.5 | |
VIVALDI_INSTALL_DIR="/opt/vivaldi-snapshot/" | |
else | |
echo "Unknown stream ($VIVALDI_STREAM); exiting" | |
exit 1 | |
fi | |
# Fetch the teams-for-linux image, if not present | |
if [ ! -e "$TEAMS_IMG" ]; then | |
# Make sure we have wget or curl | |
if available wget; then | |
DOWNLOAD="wget -O-" | |
elif available curl; then | |
DOWNLOAD="curl -L" | |
else | |
echo "Neither Wget nor cURL is installed; aborting" >&2 | |
exit 1 | |
fi | |
$DOWNLOAD https://api.snapcraft.io/api/v1/snaps/download/$TEAMS_IMG > $TEAMS_IMG | |
fi | |
# Try and use unsquashfs if possible, otherwise we can try mounting | |
if available unsquashfs; then | |
if ! unsquashfs -f -d teams-for-linux_root "$TEAMS_IMG" libffmpeg.so 2>&1 1>/dev/null; then | |
echo "Failed to extract: $TEAMS_IMG" >&2 | |
exit 1 | |
fi | |
mv teams-for-linux_root/libffmpeg.so "libffmpeg.so.$VIVALDI_MAJOR_VERSION" | |
rmdir teams-for-linux_root | |
else | |
# Note the next free loop device in a variable | |
LOOPD="$(losetup -f)" | |
# If root, we can mount silently (no popup windows after mount) | |
if [ "$USER" = "root" ]; then | |
MNTPNT="$(mktemp -d -t teams-for-linux.XXXXXX)" | |
losetup -f "$TEAMS_IMG" 2>/dev/null | |
mount -o ro "$LOOPD" "$MNTPNT" | |
else | |
# Associate disk image with a loop device | |
udisksctl loop-setup -rf "$TEAMS_IMG" | |
sleep 1 | |
# Mount the disk image if the previous did not do it automatically | |
if ! lsblk -lo MOUNTPOINT "$LOOPD" | tail -n1 | grep -q \.; then | |
udisksctl mount -b "$LOOPD" | |
fi | |
# Note the mount point in a variable | |
MNTPNT="$(lsblk -lo MOUNTPOINT "$LOOPD" | tail -n1)" | |
fi | |
# Copy out file | |
cp "$MNTPNT/libffmpeg.so" "libffmpeg.so.$VIVALDI_MAJOR_VERSION" | |
# Cleanup | |
if [ "$USER" = "root" ]; then | |
umount "$MNTPNT" | |
losetup -d "$LOOPD" | |
rmdir "$MNTPNT" | |
else | |
udisksctl unmount -b "$LOOPD" | |
if [ "$LOOPD" != "$(losetup -f)" ]; then | |
udisksctl loop-delete -b "$LOOPD" | |
fi | |
fi | |
fi | |
cat <<EOF | |
Successfully Extracted: libffmpeg.so.$VIVALDI_MAJOR_VERSION | |
To install for use with Vivaldi ($VIVALDI_STREAM, version $VIVALDI_MAJOR_VERSION) issue the following: | |
sudo install -m644 libffmpeg.so.$VIVALDI_MAJOR_VERSION $VIVALDI_INSTALL_DIR | |
[You will need to Restart Vivaldi ($VIVALDI_STREAM) for it to find the new library.] | |
EOF |
Vivaldi Snapshot users can run it as follows instead.
VIVALDI_STREAM=snapshot sh -e teams-for-linux.sh
Thank you for keeping this going, you rock. Working on Mint 18.3.
It took me a while to find another source but I got there in the end. If you are able though you should upgrade your distro as Mint does not support it anymore and hence no security updates 😔
I have updated this to use the "teams-for-linux" snap package instead of the Zulip AppImage, so that it works with Vivaldi stable 5.4.
@figlesias The new version might be useful to you if you have still not upgraded to a distro that is receiving active security updates. Though I recommend you do that instead. 😉
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Click on "Raw" (above, to the right), save it, make it executable, then run it.
Alternatively you can run it like so: