Compare commits

..

5 Commits

Author SHA1 Message Date
Maksim Ivanov
dc5682f9a7 Merge branch 'EvilSupahFly-main' 2026-03-04 20:43:47 +03:00
Maksim Ivanov
62650fe1a8 Fixed errors from PR 2026-03-04 20:42:53 +03:00
EvilSupahFly
2a33d9ba9e Updated README, install.sh 2025-12-30 22:39:15 -05:00
EvilSupahFly
fe3ce4eba2 Reworked install / uninstall
Hardened scripts a little, made them more distro agnostic
2025-12-30 19:53:58 -05:00
Maksim Ivanov
5b767c8077 Getting link for latest Widevine from Mozilla Firefox sources 2025-09-14 19:21:07 +03:00
7 changed files with 178 additions and 129 deletions

View File

@@ -8,22 +8,17 @@
## Requirements
1. **curl** (Is needed for downloading the ffmpeg lib and widevine)
1. **curl** (is needed for downloading the ffmpeg lib and widevine)
**unzip** (Is needed for unpacking the downloaded file)
**unzip** (is needed for unpacking the downloaded file)
**git** (Is needed for fetching this script)
**git** (is needed for fetching this script)
**jq** (Is needed for parsing JSON from github)
**jq** (is needed for parsing JSON from github)
For Debian-based systems: `sudo apt install curl unzip git jq`
2. (*Optional*) **python3-dnf-plugin-post-transaction-actions** (is needed for autoupdate in RedHat-based systems)
For Arch-based systems: `sudo pacman -S curl unzip git jq`
For RedHat-based systems: `sudo dnf install curl unzip git jq`
3. (*Optional*) **python3-dnf-plugin-post-transaction-actions** (Is needed for autoupdate in RedHat-based systems)
`dnf install python3-dnf-plugin-post-transaction-actions`
The main installer - `install.sh` - auto-detects your distro and installs the both the appropriate and the optional requirements by itself, if they're missing.
## Usage
@@ -39,7 +34,11 @@
`sudo ./scripts/fix-opera.sh`
4. Run install script and answer few questions.
4. Make install.sh executable
`chmod +x ./install.sh`
5. Run install script and answer few questions.
`sudo ./install.sh`

161
install.sh Executable file → Normal file
View File

@@ -1,4 +1,79 @@
#!/bin/bash
set -euo pipefail
detect_pkg_manager() {
if command -v apt-get >/dev/null 2>&1; then
PKG_MGR="apt"
elif command -v dnf >/dev/null 2>&1; then
PKG_MGR="dnf"
elif command -v pacman >/dev/null 2>&1; then
PKG_MGR="pacman"
elif command -v zypper >/dev/null 2>&1; then
PKG_MGR="zypper"
elif command -v emerge >/dev/null 2>&1; then
PKG_MGR="portage"
else
PKG_MGR="unknown"
fi
if [[ "$PKG_MGR" == "unknown" ]]; then
echo "Unsupported package manager"
exit 1
fi
}
install_deps() {
DEPS=(curl unzip jq)
case "$PKG_MGR" in
apt)
apt-get update
apt-get install -y "${DEPS[@]}"
;;
dnf)
dnf install -y "${DEPS[@]} python3-dnf-plugin-post-transaction-actions"
;;
pacman)
pacman -Sy --needed --noconfirm "${DEPS[@]}"
;;
zypper)
zypper install -y "${DEPS[@]}"
;;
portage)
emerge --ask=n "${DEPS[@]}"
;;
*)
echo "Unsupported package manager. Install dependencies manually:"
echo " ${DEPS[*]}"
exit 1
;;
esac
}
install_hook () {
case "$PKG_MGR" in
apt)
cp -f "$SCRIPT_PATH/scripts/99fix-opera" "$INSTALL_PATH"
ln -sf "$INSTALL_PATH/99fix-opera" /etc/apt/apt.conf.d/99fix-opera
;;
pacman)
cp -f "$SCRIPT_PATH/scripts/fix-opera.hook" "$INSTALL_PATH"
ln -sf "$INSTALL_PATH/fix-opera.hook" /usr/share/libalpm/hooks/fix-opera.hook
;;
dnf)
dnf install -y python3-dnf-plugin-post-transaction-actions
cp -f "$SCRIPT_PATH/scripts/fix-opera.action" "$INSTALL_PATH"
ln -sf "$INSTALL_PATH/fix-opera.action" \
/etc/dnf/plugins/post-transaction-actions.d/fix-opera.action
;;
*)
echo "Automatic hook installation not supported for this system."
return 1
;;
esac
}
if [[ $(whoami) != "root" ]]; then
printf 'Try to run it with sudo\n'
exit 1
@@ -9,72 +84,34 @@ if [[ $(uname -m) != "x86_64" ]]; then
exit 1
fi
if ! which unzip > /dev/null; then
printf '\033[1munzip\033[0m package must be installed to run this script\n'
exit 1
fi
if ! which curl > /dev/null; then
printf '\033[1mcurl\033[0m package must be installed to run this script\n'
exit 1
fi
if ! which jq > /dev/null; then
printf '\033[1mjq\033[0m package must be installed to run this script\n'
exit 1
fi
readonly SCRIPT_PATH=$(dirname $(readlink -f $0))
readonly INSTALL_PATH="/root/.scripts"
readonly USER_NAME="$(logname)"
readonly USER_HOME=$(sudo -u $USER_NAME sh -c 'echo $HOME')
create_hook ()
{
printf 'Choose your Linux distro:\n'
printf ' 1. Debian-based (Debian/Ubuntu/Mint/etc.)\n'
printf ' 2. Arch-based (Arch/Manjaro/etc.)\n'
printf ' 3. RedHat-based (RedHat/Fedora/etc.)\n'
printf ' 0. Other\n'
while read -p "Your choice: " DISTRIB; do
case $DISTRIB in
"1" )
cp -f $SCRIPT_PATH/scripts/99fix-opera $INSTALL_PATH
ln -sf $INSTALL_PATH/99fix-opera /etc/apt/apt.conf.d/
printf 'Now the script will run automatically every time apt installs or updates Opera.\n'
break;;
"2" )
cp -f $SCRIPT_PATH/scripts/fix-opera.hook $INSTALL_PATH
ln -sf $INSTALL_PATH/fix-opera.hook /usr/share/libalpm/hooks/
printf 'Now the script will run automatically every time pacman installs or updates Opera.\n'
break;;
"3" )
dnf install python3-dnf-plugin-post-transaction-actions -y
cp -f $SCRIPT_PATH/scripts/fix-opera.action $INSTALL_PATH
ln -sf $INSTALL_PATH/fix-opera.action /etc/dnf/plugins/post-transaction-actions.d/
printf 'Now the script will run automatically every time dnf installs or updates Opera.\n'
break;;
"0" )
printf "Autostart for your Linux distro is currently unsupported\n"
break;;
* )
continue;;
esac
done
}
readonly USER_NAME="${SUDO_USER:-$(logname)}"
readonly USER_HOME=$(getent passwd "$USER_NAME" | cut -d: -f6)
mkdir -p $INSTALL_PATH
printf 'Installing script to your system...\n'
detect_pkg_manager
install_deps
read -p "Enable automatic execution after Opera updates? [y/N] " AUTO
[[ "$AUTO" =~ ^[Yy]$ ]] && install_hook
mkdir -p "$INSTALL_PATH"
cp -f "$SCRIPT_PATH/scripts/fix-opera.sh" "$INSTALL_PATH"
chmod +x "$INSTALL_PATH/fix-opera.sh"
printf 'Would you like to apply Widevine CDM fix? [y/n]'
while read FIX_WIDEVINE; do
case $FIX_WIDEVINE in
"y" | "Y")
printf 'Setting FIX_WIDEVINE to true...\n'
sed -i '/FIX_WIDEVINE=/s/false/true/g' $SCRIPT_PATH/scripts/fix-opera.sh
sed -i '/FIX_WIDEVINE=/s/false/true/g' $INSTALL_PATH/fix-opera.sh
break;;
"n" | "N")
printf 'Setting FIX_WIDEVINE to false...\n'
sed -i '/FIX_WIDEVINE=/s/true/false/g' $SCRIPT_PATH/scripts/fix-opera.sh
sed -i '/FIX_WIDEVINE=/s/true/false/g' $INSTALL_PATH/fix-opera.sh
break;;
* )
printf 'Would you like to apply Widevine CDM fix? [y/n]'
@@ -82,10 +119,6 @@ while read FIX_WIDEVINE; do
esac
done
mkdir -p $INSTALL_PATH
cp -f $SCRIPT_PATH/scripts/fix-opera.sh $INSTALL_PATH
chmod +x $INSTALL_PATH/fix-opera.sh
printf "Would you like to create an alias for user $USER_NAME? [y/n]"
while read CREATE_ALIAS; do
case $CREATE_ALIAS in
@@ -101,20 +134,6 @@ while read CREATE_ALIAS; do
esac
done
printf "Would you like to run it automatically after each Opera update? [y/n]"
while read CREATE_HOOK; do
case $CREATE_HOOK in
"y" | "Y")
create_hook
break;;
"n" | "N")
break;;
* )
printf "Would you like to run it automatically after each Opera update?? [y/n]"
continue;;
esac
done
printf "Would you like to run it now? [y/n]"
while read RUN_NOW; do
case $RUN_NOW in

49
scripts/fix-opera.sh Executable file → Normal file
View File

@@ -10,22 +10,22 @@ if [[ $(uname -m) != "x86_64" ]]; then
exit 1
fi
if ! which unzip > /dev/null; then
if ! command -v unzip > /dev/null; then
printf '\033[1munzip\033[0m package must be installed to run this script\n'
exit 1
fi
if ! which curl > /dev/null; then
if ! command -v curl > /dev/null; then
printf '\033[1mcurl\033[0m package must be installed to run this script\n'
exit 1
fi
if ! which jq > /dev/null; then
if ! command -v jq > /dev/null; then
printf '\033[1mjq\033[0m package must be installed to run this script\n'
exit 1
fi
if which pacman &> /dev/null; then
if command -v pacman &> /dev/null; then
ARCH_SYSTEM=true
fi
@@ -34,7 +34,7 @@ readonly FIX_WIDEVINE=true
readonly FIX_DIR='/tmp/opera-fix'
readonly FFMPEG_SRC_MAIN='https://api.github.com/repos/Ld-Hagen/nwjs-ffmpeg-prebuilt/releases'
readonly FFMPEG_SRC_ALT='https://api.github.com/repos/Ld-Hagen/fix-opera-linux-ffmpeg-widevine/releases'
readonly WIDEVINE_VERSIONS='https://dl.google.com/widevine-cdm/versions.txt'
readonly WIDEVINE_SRC='https://raw.githubusercontent.com/mozilla-firefox/firefox/refs/heads/main/toolkit/content/gmp-sources/widevinecdm.json'
readonly FFMPEG_SO_NAME='libffmpeg.so'
readonly WIDEVINE_SO_NAME='libwidevinecdm.so'
readonly WIDEVINE_MANIFEST_NAME='manifest.json'
@@ -62,10 +62,9 @@ if [[ -z $FFMPEG_URL ]]; then
fi
##Widevine
#if $FIX_WIDEVINE; then
# readonly WIDEVINE_LATEST=`curl -sL4 $WIDEVINE_VERSIONS | tail -n1`
# readonly WIDEVINE_URL="https://dl.google.com/widevine-cdm/$WIDEVINE_LATEST-linux-x64.zip"
#fi
if $FIX_WIDEVINE; then
readonly WIDEVINE_URL=$(curl -sL4 $WIDEVINE_SRC | jq -r '.vendors."gmp-widevinecdm".platforms."Linux_x86_64-gcc3".mirrorUrls[0]')
fi
#Downloading files
printf 'Downloading files...\n'
@@ -78,40 +77,22 @@ if [ $? -ne 0 ]; then
exit 1
fi
##Widevine
if $FIX_WIDEVINE; then
echo "Finding a working Widevine version..."
# Get all versions, newest last
versions=$(curl -sL4 "$WIDEVINE_VERSIONS")
# Loop through in reverse order (newest first)
for ver in $(echo "$versions" | tac); do
test_url="https://dl.google.com/widevine-cdm/${ver}-linux-x64.zip"
# Check if the URL exists (no 404)
if curl --progress-bar --fail "$test_url" -o "$FIX_DIR/widevine.zip"; then
WIDEVINE_LATEST="$ver"
WIDEVINE_URL="$test_url"
echo -e "Trying Widevine version $WIDEVINE_LATEST from $WIDEVINE_URL\n"
break
else
echo "Widevine version $ver not available, trying older..."
fi
done
if [[ -z "$WIDEVINE_URL" ]]; then
echo "Failed to find a working Widevine version. Exiting..."
if $FIX_WIDEVINE; then
curl -L4 --progress-bar "$WIDEVINE_URL" -o "$FIX_DIR/widevine.zip"
if [ $? -ne 0 ]; then
printf 'Failed to download Widevine CDM. Check your internet connection or try later\n'
exit 1
fi
#readonly WIDEVINE_LATEST
#readonly WIDEVINE_URL
fi
#Extracting files
printf 'Extracting files...\n'
##ffmpeg
echo "Extracting ffmpeg..."
unzip -o "$FIX_DIR/ffmpeg.zip" -d $FIX_DIR > /dev/null
##Widevine
if $FIX_WIDEVINE; then
echo "unzip -o \"$FIX_DIR/widevine.zip\" -d $FIX_DIR"
unzip -o "$FIX_DIR/widevine.zip" -d $FIX_DIR > /dev/null
echo "Extracting WidevineCDM..."
unzip -oj "$FIX_DIR/widevine.zip" -d $FIX_DIR > /dev/null 2>/dev/null
fi
for opera in ${OPERA_VERSIONS[@]}; do

View File

@@ -1,11 +1,61 @@
#!/bin/bash
set -euo pipefail
readonly INSTALL_PATH="/root/.scripts"
readonly USER_NAME="$(logname)"
readonly USER_HOME=$(sudo -u $USER_NAME sh -c 'echo $HOME')
#
# This uninstall does NOT remove system packages. It only removes the hooks, aliases and scripts implemented by fix-opera's 'install.sh'.
#
rm /etc/apt/apt.conf.d/99fix-opera
rm /usr/share/libalpm/hooks/fix-opera.hook
rm /etc/dnf/plugins/post-transaction-actions.d/fix-opera.action
sed -i '/alias fix-opera/d' $USER_HOME/.bashrc
rm -rf $INSTALL_PATH
INSTALL_PATH="/root/.scripts"
# --- privilege check ---
if [[ "$(id -u)" -ne 0 ]]; then
echo "Please run this script with sudo or as root"
exit 1
fi
# --- user resolution ---
USER_NAME="${SUDO_USER:-$(logname)}"
USER_HOME=$(getent passwd "$USER_NAME" | cut -d: -f6)
# --- package manager detection ---
detect_pkg_manager() {
if command -v apt-get >/dev/null 2>&1; then
PKG_MGR="apt"
elif command -v dnf >/dev/null 2>&1; then
PKG_MGR="dnf"
elif command -v pacman >/dev/null 2>&1; then
PKG_MGR="pacman"
else
PKG_MGR="unknown"
fi
}
remove_hook() {
case "$PKG_MGR" in
apt)
rm -f /etc/apt/apt.conf.d/99fix-opera
;;
pacman)
rm -f /usr/share/libalpm/hooks/fix-opera.hook
;;
dnf)
rm -f /etc/dnf/plugins/post-transaction-actions.d/fix-opera.action
;;
*)
echo "No supported package manager hook to remove"
;;
esac
}
detect_pkg_manager
remove_hook
# --- remove alias ---
if [[ -f "$USER_HOME/.bashrc" ]]; then
sed -i '/alias fix-opera=.*Opera fix HTML5 media/d' "$USER_HOME/.bashrc"
fi
# --- remove installed files ---
rm -rf "$INSTALL_PATH"
echo "Opera Widevine fix has been removed."