Dependency check on install. Messages about hook creation.

This commit is contained in:
Ld-Hagen
2021-09-26 19:37:52 +03:00
parent a6d2682300
commit c9b8eb396e

View File

@@ -4,6 +4,21 @@ if [[ $(whoami) != "root" ]]; then
exit 1 exit 1
fi fi
if [[ $(uname -m) != "x86_64" ]]; then
printf 'This script is intended for 64-bit systems\n'
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 wget > /dev/null; then
printf '\033[1mwget\033[0m package must be installed to run this script\n'
exit 1
fi
readonly SCRIPT_PATH=$(dirname $(readlink -f $0)) readonly SCRIPT_PATH=$(dirname $(readlink -f $0))
readonly INSTALL_PATH="/root/.scripts" readonly INSTALL_PATH="/root/.scripts"
readonly USER_NAME="$(logname)" readonly USER_NAME="$(logname)"
@@ -20,10 +35,12 @@ create_hook ()
"1" ) "1" )
cp -f $SCRIPT_PATH/scripts/99fix-opera $INSTALL_PATH cp -f $SCRIPT_PATH/scripts/99fix-opera $INSTALL_PATH
ln -sf $INSTALL_PATH/99fix-opera /etc/apt/apt.conf.d/ 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;; break;;
"2" ) "2" )
cp -f $SCRIPT_PATH/scripts/fix-opera.hook $INSTALL_PATH /usr/share/libalpm/hooks cp -f $SCRIPT_PATH/scripts/fix-opera.hook $INSTALL_PATH /usr/share/libalpm/hooks
ln -sf $INSTALL_PATH/fix-opera.hook /usr/share/libalpm/hooks/ 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;; break;;
"0" ) "0" )
printf "Autostart for your Linux distro is currently unsupported\n" printf "Autostart for your Linux distro is currently unsupported\n"
@@ -34,6 +51,8 @@ create_hook ()
done done
} }
ptintf 'Installing script to ypur system...\n'
printf 'Would you like to apply Widevine CDM fix? [y/n]' printf 'Would you like to apply Widevine CDM fix? [y/n]'
while read FIX_WIDEVINE; do while read FIX_WIDEVINE; do
case $FIX_WIDEVINE in case $FIX_WIDEVINE in
@@ -82,4 +101,3 @@ while read CREATE_HOOK; do
continue;; continue;;
esac esac
done done