improved ifinstalled and made noisereduce use it (#930)

* made noisereduce executable

* improved `ifinstalled` script

* made `noisereduce` use `ifinstalled` script

* quoting for quiet shellcheck
This commit is contained in:
Hekuran 2021-05-31 03:07:27 +02:00 committed by GitHub
parent f16713bcf7
commit 4231d6bd33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -6,6 +6,8 @@
# various other scripts for clarity's sake. # various other scripts for clarity's sake.
for x in "$@";do for x in "$@";do
pacman -Qq "$x" >/dev/null 2>&1 || notify() { notify-send "📦 $x" "must be installed for this function." && exit 1 ;}
{ notify-send "📦 $x" "must be installed for this function." && exit 1 ;} which_out="$( /usr/bin/which "$x" >/dev/null 2>&1 )" && exit 0 #you might have compiled the prog, and not install the repo pkg...
pkgname="$(pacman -Qqo "$which_out" >/dev/null 2>&1 )" #...thats why two variables.
pacman -Qq "$pkgname" >/dev/null 2>&1 || notify
done done

4
.local/bin/noisereduce Normal file → Executable file
View file

@ -7,8 +7,8 @@ usage ()
} }
# Tests for requirements # Tests for requirements
ffmpeg -version >/dev/null || { echo >&2 "We require 'ffmpeg' but it's not installed. Install it by 'sudo apt-get install ffmpeg' Aborting."; exit 1; } ifinstalled ffmpeg || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
sox --version >/dev/null || { echo >&2 "We require 'sox' but it's not installed. Install it by 'sudo apt-get install sox' Aborting."; exit 1; } ifinstalled sox || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
if [ "$#" -ne 2 ] if [ "$#" -ne 2 ]
then then