Skip to content

Instantly share code, notes, and snippets.

@WMP
Last active August 21, 2021 15:16
Show Gist options
  • Save WMP/8042f545ea1b6309a5c8d35a371a52c8 to your computer and use it in GitHub Desktop.
Save WMP/8042f545ea1b6309a5c8d35a371a52c8 to your computer and use it in GitHub Desktop.
Automatical fix ffmpeg in opera on ubuntu 20.04
This gist describe how to create apt hook. When you install or upgrade any package,
hook /etc/apt/apt.conf.d/80upgradehook is running.
Hook run script /usr/local/sbin/apt_after_upgrade_hook and this script check if
/usr/lib/x86_64-linux-gnu/opera/libffmpeg.so is symlink,and when not make symlink to newest
libffmpeg fromchromium-ffmpeg snap.
sudo snap install chromium-ffmpeg
sudo echo 'DPkg::Post-Invoke {"/usr/local/sbin/apt_after_upgrade_hook";};' > /etc/apt/apt.conf.d/80upgradehook
sudo cat <<EOF >>/usr/local/sbin/apt_after_upgrade_hook
#!/bin/bash
# Source: https://gist.github.com/WMP/8042f545ea1b6309a5c8d35a371a52c8
# Remember to make this file executable: chmod +x /usr/local/sbin/apt_after_upgrade_hook
set -e
if [ ! -L /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so ]; then
ffmpeg_path=$(ls -r /snap/chromium-ffmpeg/current/chromium-ffmpeg-*/chromium-ffmpeg/libffmpeg.so | head -n 1)
ln -fs $ffmpeg_path /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so
fi
EOF
sudo chmod +x /usr/local/sbin/apt_after_upgrade_hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment