updated chromium script to handle multiple binarys

master
Kebler Network System Administrator 2022-04-26 14:07:20 -07:00
parent b71f8b9364
commit 19dee68ea5
3 changed files with 31 additions and 28 deletions

View File

@ -5,26 +5,26 @@
chromium_() {
local DEFAULT=/opt/chromium
local DEFAULT_USER=$HOME/.browsers
# local DEFAULT="$HOME/.local/share/chromium"
local DEFAULT_SNAP=$HOME/snap/chromium/common
# set default exe here (no flag)
local exe="/usr/bin/chromium"
local snap
if [[ $1 == "-version" ]]; then
$exe -version
return
fi
[[ $1 == -d ]] && exe=/usr/bin/chromiium && shift
[[ $1 == -g ]] && exe=$(command -v google-chrome) && shift
[[ $1 == -s ]] && snap=true && exe=/snap/bin/chromium && shift
[[ $1 == -u ]] && exe=/opt/bin/ungoogled-chromium && shift
[[ $1 == -v ]] && exe=/opt/vivaldi/vivaldi && shift
[[ $1 == -c ]] && exe=/usr/bin/chromium && shift
echo execuatble to be used: $exe
if [[ ! -f $exe ]]; then
echo chromium/chrome not installed, checking for flatpak version
flatpak=$(flatpak info com.github.Eloston.UngoogledChromium | grep error:)
if [[ $flatpak ]]; then
echo no flatpak version either - exiting
return 1
else
flatpak=true
exe="/usr/bin/flatpak run --branch=stable --arch=x86_64 --filesystem=<dir> --command=/app/bin/chromium --file-forwarding com.github.Eloston.UngoogledChromium @@u"
fi
echo chromium/chrome not installed at $exe
return 2
fi
local instance=${CHROMIUM_INSTANCE}
@ -41,22 +41,23 @@ chromium_() {
fi
local dir
if [[ ! $instance ]]; then
unset CHROME_CONFIG_HOME
$HOME/.config/chromium
echo starting chromium for $USER in
dir=$HOME/.config/chromium
exe="${exe/<dir>/$dir}"
else
[[ $instance == "incognito" ]] && set -- "$@" "-incognito"
dir=${DEFAULT_USER}/$instance
dir=$([[ -d "$dir" ]] && echo $dir || echo "${CHROMIUM_HOME:-$DEFAULT}/$instance")
exe="${exe/<dir>/$dir}"
fi
mkdir -p $dir
echo $exe $@ --user-data-dir=$dir $url $([[ $flatpak ]] && echo "@@")
$exe $@ --user-data-dir=$dir $url $([[ $flatpak ]] && echo "@@")
[[ ! $instance ]] && instance=chromium && unset CHROME_CONFIG_HOME
[[ $instance == "incognito" ]] && set -- "$@" "-incognito"
dir=${DEFAULT_USER}/$instance
dir=$([[ -d "$dir" ]] && echo $dir || echo "${CHROMIUM_HOME:-$DEFAULT}/$instance")
# exe="${exe/<dir>/$dir}"
if [[ $snap ]]; then
sdir=${DEFAULT_SNAP}/$instance
mkdir -p $sdir
fusermount -u $sdir
/usr/bin/bindfs $dir $sdir
dir=$sdir
fi
mkdir -p $dir
echo $exe $@ --user-data-dir=$dir $url
$exe $@ --user-data-dir=$dir $url
}
# # if script was executed then call the function

View File

@ -55,7 +55,7 @@ if [[ ! -f $path ]];then
return 0
fi
fi
path=$(abs-path $path)
path=$(abs_path $path)
echo compose: $path file exits, command to run $1
cmd="docker-compose -f $path"
case $1 in

View File

@ -26,7 +26,9 @@ alias dkcrm="docker rm $(docker ps -a -q)"
# stop and remove
alias dkcsrm="docker rm -f $(docker ps -a -q)"
# cleans out unused/dangling aufs volumes - run this occasionally
alias dkclean="docker volume ls -qf dangling=true | xargs -r docker volume rm"
# TODO make a function for cleaning docker so that confirm can be used
alias dkvd="docker volume ls -qf dangling=true
# | xargs -r docker volume rm"
alias dkde="gksudo gedit /etc/default/docker"
alias dkclean="docker system prune"
alias dkterm="docker_terminal"