Replace libffmpeg.so of opera version 54.0.2952.71 by the bundled file from opera version 68.0.3618.173
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/bash | |
rm -fr opera-get-ffmpeg-from-68.sh.tmp | |
TAB=" " | |
cat <<EOF | |
This script safely replaces the file libffmpeg.so from opera version | |
${TAB}54.0.2952.71 | |
by the updated file from version | |
${TAB}68.0.3618.173 | |
The old file is renamed to libffmpeg.so-..., with ... being the md5sum of | |
it's content, so in case something goes wrong you can easily revert. | |
This script tries to replaces the file in these directories: | |
EOF | |
# Configure all directories to search for libffmpeg.so: | |
opera_dirs=( | |
"/usr/lib64/opera" | |
) | |
# Configure all md5sums of old libffmpeg.so files we're going to replace | |
md5sums=( | |
"19915d948247726293aa1cf8a0bc4a2d" # 54.0.2952.71 | |
) | |
# Leave this empty, it will be populated by the following loop | |
replace_dirs=( | |
) | |
for opera_dir in "${opera_dirs[@]}" | |
do | |
echo -n "${TAB}$opera_dir" | |
if test -f "$opera_dir/libffmpeg.so" | |
then | |
if echo "c8f82cf09326b47d03ee6b8c7e3f163c $opera_dir/libffmpeg.so" | md5sum -c - >/dev/null 2>&1 | |
then | |
echo " -> already version 68.0.3618.173" | |
else | |
ok=false | |
for md5sum in "${md5sums[@]}" | |
do | |
if echo "$md5sum $opera_dir/libffmpeg.so" | md5sum -c - >/dev/null 2>&1 | |
then | |
ok=true | |
fi | |
done | |
if $ok | |
then | |
echo " -> will be replaced" | |
replace_dirs+=("$opera_dir") | |
else | |
echo -n " -> checksum failure, " | |
ok=false | |
for arg in "$@" | |
do | |
if test "X$arg" == "X--force=$opera_dir" | |
then | |
echo "will be replaced anyways (forced by command line)" | |
ok=true | |
fi | |
done | |
if ! $ok | |
then | |
echo "will be skipped (force by command line --force=$opera_dir)" | |
fi | |
fi | |
fi | |
else | |
echo " -> no libffmpeg.so found" | |
fi | |
done | |
( | |
if ! test -d ../opera-get-ffmpeg-from-68.sh.tmp | |
then | |
mkdir opera-get-ffmpeg-from-68.sh.tmp || exit 2 | |
cd opera-get-ffmpeg-from-68.sh.tmp || exit 2 | |
fi | |
if test 0 -eq "${#replace_dirs[@]}" | |
then | |
echo | |
echo "I couldn't identify any libffmpeg.so file to replace." | |
exit 1 | |
fi | |
wget http://deb.opera.com/opera-stable/pool/non-free/o/opera-stable/opera-stable_68.0.3618.173_amd64.deb || exit 2 | |
ar x opera-stable_68.0.3618.173_amd64.deb || exit 2 | |
xz -cd data.tar.xz | tar x ./usr/lib/x86_64-linux-gnu/opera/libffmpeg.so || exit 2 | |
echo "c8f82cf09326b47d03ee6b8c7e3f163c usr/lib/x86_64-linux-gnu/opera/libffmpeg.so" | md5sum -c - || exit 2 | |
for replace in "${replace_dirs[@]}" | |
do | |
echo -n "Replacing $replace" | |
md5sum="$(md5sum "$replace/libffmpeg.so" | awk '{ print $1 }')" | |
if test -f "$replace/libffmpeg.so.$md5sum" | |
then | |
echo " -> old file *.$md5sum exists, " | |
if ! cmp "$replace/libffmpeg.so" "$replace/libffmpeg.so.$md5sum" >/dev/null | |
then | |
rm -i "$replace/libffmpeg.so" || continue | |
echo "same content, skipping backup" | |
else | |
echo "different content, can't save old version, skipping" | |
continue | |
fi | |
else | |
echo -n " -> backing up old file as *.$md5sum" | |
mv -i "$replace/libffmpeg.so" "$replace/libffmpeg.so.$md5sum" || continue | |
fi | |
if cp -ip usr/lib/x86_64-linux-gnu/opera/libffmpeg.so "$replace/libffmpeg.so" | |
then | |
echo " -> update done" | |
fi | |
done | |
) | |
rm -fr opera-get-ffmpeg-from-68.sh.tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment