feat: added chromium install scripts, installs ungoogled from releases, widevine and uci chromium launcher script.

master
david 2021-12-29 22:22:38 -08:00
parent 750afe574a
commit c0df5a2e1c
5 changed files with 152 additions and 9 deletions

View File

@ -0,0 +1,20 @@
#!/bin/bash
function chromium_install {
source $BASH_SHELL_BASE/module.lib
module_load helpers
NAME="chromium"
DIR=$(adirname "$0")
BIN=${1:-/opt/bin/$NAME}
# [[ $(chown :users $DIR/$NAME.sh) ]] || sudo chown :users $DIR/$NAME.sh
[[ $(chmod 755 $DIR/$NAME.sh) ]] || sudo chmod 755 $DIR/$NAME.sh
ln -sf $DIR/$NAME.sh $BIN
echo link created
ls -la /opt/bin | grep chromium
echo with permissions
ls -la $DIR | grep chromium.sh
}
# if script was executed then call the function
(return 0 2>/dev/null) || chromium_install $@

View File

@ -1,9 +0,0 @@
#!/bin/bash
source $BASH_SHELL_BASE/module.lib
module_load helpers
NAME=${1:-$(filename $0)}
DIR=$(adirname "$0")
BIN=${1:-/opt/bin/$NAME}
chown :users $DIR/$NAME.sh
chmod 755 $DIR/$NAME.sh
ln -sf $DIR/$NAME.sh $BIN

View File

@ -8,6 +8,8 @@ chromium_() {
# local DEFAULT="$HOME/.local/share/chromium" # local DEFAULT="$HOME/.local/share/chromium"
local exe="/usr/bin/chromium" local exe="/usr/bin/chromium"
[[ $1 == "-version" ]] && $exe -version && return
[[ $1 == -g ]] && exe=$(command -v google-chrome) && shift [[ $1 == -g ]] && exe=$(command -v google-chrome) && shift
echo execuatble to be used: $exe echo execuatble to be used: $exe
if [[ ! -f $exe ]]; then if [[ ! -f $exe ]]; then

View File

@ -0,0 +1,59 @@
#!/bin/bash
ungoogled_install() {
module_load confirm
module_load helpers
SDIR=$(adirname ${1:-$(dirname ${BASH_SOURCE[0]})})
if [[ ! $(which lastversion) ]]; then
echo lastversion is not installed
echo it is a required dependency for this script
echo see https://github.com/dvershinin/lastversion
return
fi
CUR_VERSION=$( /usr/bin/chromium -version | grep -oP '(?<=Chromium )[^ ]*')
_repo="Eloston/ungoogled-chromium-binaries"
NEW_VERSION=$(lastversion ${_repo})
echo "Ungoogled: Current Version : $CUR_VERSION => New Version: $NEW_VERSION"
[[ $NEW_VERSION = $CUR_VERSION ]] && [[ ! ${1} == "-f" ]] && echo Latest version is already installed
_temp=/tmp/ungoogled_chromium
echo $_temp to download deb and install
mkdir -p $_temp || exit &> /dev/null
pushd $_temp &> /dev/null || exit
# echo downloading common deb
# lastversion ${_repo} --format assets --filter common_ -d common.deb
# lastversion ${_repo} --format assets --filter mium_.+amd64.deb -d chromium.
# echo installing common libraries
# sudo dpkg -i common.deb
# echo installing ungoogled-chromium
# sudo dpkg -i chromium.deb
echo done installing, removing $_temp
rm -r $_temp &> /dev/null || true
popd >/dev/null
confirm "do you want to install WidevineCDM for digital streaming rights?"
if [ $? -eq 0 ]; then
module_load widevine-install
widevine_install
fi
confirm "do you want to install the uci chromium start script in /opt/bin ?"
if [ $? -eq 0 ]; then
module_load chromium-install
chromium_install
fi
}
# # if script was executed then call the function
(return 0 2>/dev/null) || ungoogled_install $@

View File

@ -0,0 +1,71 @@
#!/bin/bash
# -eux
function confirm()
{
echo -n "$@ "
read -e answer
for response in y Y yes YES Yes Sure sure SURE OK ok Ok
do
if [ "_$answer" == "_$response" ]
then
return 0
fi
done
# Any answer other than the list above is considered a "no" answer
return 1
}
function widevine_install {
_chrome_ver=$( /usr/bin/chromium -version | grep -oP '(?<=Chromium )[^ ]*')
_l_target_dir=~/.local/lib/WidevineCdm
_target_dir=/usr/lib/chromium/WidevineCdm
_sudo="sudo"
if [[ "${1}" == "-l" ]]; then
_sudo=""
_target_dir=$_l_target_dir
shift
fi
echo "install widevineCDM for chromium version $_chrome_ver"
echo "into $_target_dir"
confirm "confirm (y/n)" || exit
_temp=/tmp/chromium_widevine
echo using $_temp to download deb and extract widevine
mkdir -p $_temp || exit &> /dev/null
pushd $_temp &> /dev/null || exit
# Download deb, which has corresponding Widevine version
# Support resuming partially downloaded (or skipping re-download) with -c flag
if [[ "${1}" == "-u" ]]; then
_un="un"
fi
_url=https://dl.google.com/linux/deb/pool/main/g/google-chrome-${_un}stable/google-chrome-${_un}stable_${_chrome_ver}-1_amd64.deb
echo downloading $_url
wget -c $_url || exit
# Unpack deb
rm -r unpack_deb &> /dev/null || true
mkdir -p unpack_deb
echo extracting package...
dpkg-deb -R google-chrome-stable_${_chrome_ver}-1_amd64.deb unpack_deb || exit
echo removing any old WidevineCDM installs at $_target_dir
$_sudo rm -r $_target_dir &> /dev/null || true
echo moving WidevineCDM to target $_target_dir
$_sudo mv unpack_deb/opt/google/chrome/WidevineCdm $_target_dir &> /dev/null || exit
[[ $_sudo ]] && $_sudo chown -R root:root $_target_dir
echo done, removing $_temp
rm -r $_temp &> /dev/null || true
popd &> /dev/null
}
# if script was executed then call the function
(return 0 2>/dev/null) || widevine_install $@