mirror of
https://github.com/Ld-Hagen/fix-opera-linux-ffmpeg-widevine.git
synced 2026-07-11 23:37:27 +03:00
minor code style and runtime fixes to be more standard-compliant
This commit is contained in:
22
CHANGELOG.md
Normal file
22
CHANGELOG.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- universal shebang bash interpreter to safely find bash on `$PATH`
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- in the preflight check: Prefer our user-friendly error messages while avoiding double error message from the operating system by redirecting also `stderr` to `/dev/null`
|
||||||
|
- potential runtime error: prefer `command -v` over `which`-command, which can have different behaviour on different Linux distributions and always use the first result in `PATH` independently of multiple defined commands
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [[ $(whoami) != "root" ]]; then
|
if [[ $(whoami) != "root" ]]; then
|
||||||
printf 'Try to run it with sudo\n'
|
printf 'Try to run it with sudo\n'
|
||||||
exit 1
|
exit 1
|
||||||
@@ -9,17 +10,17 @@ if [[ $(uname -m) != "x86_64" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! which unzip > /dev/null; then
|
if ! command -v unzip 2>&1 /dev/null; then
|
||||||
printf '\033[1munzip\033[0m package must be installed to run this script\n'
|
printf '\033[1munzip\033[0m package must be installed to run this script\n'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! which curl > /dev/null; then
|
if ! command -v curl 2>&1 /dev/null; then
|
||||||
printf '\033[1mcurl\033[0m package must be installed to run this script\n'
|
printf '\033[1mcurl\033[0m package must be installed to run this script\n'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! which jq > /dev/null; then
|
if ! command -v jq 2>&1 /dev/null; then
|
||||||
printf '\033[1mjq\033[0m package must be installed to run this script\n'
|
printf '\033[1mjq\033[0m package must be installed to run this script\n'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
DPkg::Pre-Invoke {"stat -c %Z $(readlink -f $(which opera)) > /tmp/opera.timestamp 2> /dev/null || echo 0 > /tmp/opera.timestamp";};
|
DPkg::Pre-Invoke {"stat -c %Z $(readlink -f $(command -v opera)) > /tmp/opera.timestamp 2> /dev/null || echo 0 > /tmp/opera.timestamp";};
|
||||||
DPkg::Post-Invoke {"set NEW_OPERA=`stat -c %Z $(readlink -f $(which opera))` || exit 0; set OLD_OPERA=`cat /tmp/opera.timestamp` || exit 0; if [ "$NEW_OPERA" != "$OLD_OPERA" ]; then /root/.scripts/fix-opera.sh; fi; rm -f /tmp/opera.timestamp";};
|
DPkg::Post-Invoke {"set NEW_OPERA=`stat -c %Z $(readlink -f $(command -v opera))` || exit 0; set OLD_OPERA=`cat /tmp/opera.timestamp` || exit 0; if [ "$NEW_OPERA" != "$OLD_OPERA" ]; then /root/.scripts/fix-opera.sh; fi; rm -f /tmp/opera.timestamp";};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [[ $(whoami) != "root" ]]; then
|
if [[ $(whoami) != "root" ]]; then
|
||||||
printf 'Try to run it with sudo\n'
|
printf 'Try to run it with sudo\n'
|
||||||
@@ -10,22 +10,22 @@ if [[ $(uname -m) != "x86_64" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! which unzip > /dev/null; then
|
if ! command -v unzip 2>&1 /dev/null; then
|
||||||
printf '\033[1munzip\033[0m package must be installed to run this script\n'
|
printf '\033[1munzip\033[0m package must be installed to run this script\n'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! which curl > /dev/null; then
|
if ! command -v curl 2>&1 /dev/null; then
|
||||||
printf '\033[1mcurl\033[0m package must be installed to run this script\n'
|
printf '\033[1mcurl\033[0m package must be installed to run this script\n'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! which jq > /dev/null; then
|
if ! command -v jq 2>&1 /dev/null; then
|
||||||
printf '\033[1mjq\033[0m package must be installed to run this script\n'
|
printf '\033[1mjq\033[0m package must be installed to run this script\n'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if which pacman &> /dev/null; then
|
if command -v pacman &> /dev/null; then
|
||||||
ARCH_SYSTEM=true
|
ARCH_SYSTEM=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user