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_() { chromium_() {
local DEFAULT=/opt/chromium local DEFAULT=/opt/chromium
local DEFAULT_USER=$HOME/.browsers 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 exe="/usr/bin/chromium"
local snap
if [[ $1 == "-version" ]]; then if [[ $1 == "-version" ]]; then
$exe -version $exe -version
return return
fi fi
[[ $1 == -d ]] && exe=/usr/bin/chromiium && shift
[[ $1 == -g ]] && exe=$(command -v google-chrome) && 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 echo execuatble to be used: $exe
if [[ ! -f $exe ]]; then if [[ ! -f $exe ]]; then
echo chromium/chrome not installed, checking for flatpak version echo chromium/chrome not installed at $exe
flatpak=$(flatpak info com.github.Eloston.UngoogledChromium | grep error:) return 2
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
fi fi
local instance=${CHROMIUM_INSTANCE} local instance=${CHROMIUM_INSTANCE}
@ -41,22 +41,23 @@ chromium_() {
fi fi
local dir local dir
if [[ ! $instance ]]; then [[ ! $instance ]] && instance=chromium && unset CHROME_CONFIG_HOME
unset CHROME_CONFIG_HOME [[ $instance == "incognito" ]] && set -- "$@" "-incognito"
$HOME/.config/chromium dir=${DEFAULT_USER}/$instance
echo starting chromium for $USER in dir=$([[ -d "$dir" ]] && echo $dir || echo "${CHROMIUM_HOME:-$DEFAULT}/$instance")
dir=$HOME/.config/chromium # exe="${exe/<dir>/$dir}"
exe="${exe/<dir>/$dir}" if [[ $snap ]]; then
else sdir=${DEFAULT_SNAP}/$instance
[[ $instance == "incognito" ]] && set -- "$@" "-incognito" mkdir -p $sdir
dir=${DEFAULT_USER}/$instance fusermount -u $sdir
dir=$([[ -d "$dir" ]] && echo $dir || echo "${CHROMIUM_HOME:-$DEFAULT}/$instance") /usr/bin/bindfs $dir $sdir
exe="${exe/<dir>/$dir}" dir=$sdir
fi fi
mkdir -p $dir
echo $exe $@ --user-data-dir=$dir $url $([[ $flatpak ]] && echo "@@")
$exe $@ --user-data-dir=$dir $url $([[ $flatpak ]] && echo "@@")
mkdir -p $dir
echo $exe $@ --user-data-dir=$dir $url
$exe $@ --user-data-dir=$dir $url
} }
# # if script was executed then call the function # # if script was executed then call the function

View File

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

View File

@ -26,7 +26,9 @@ alias dkcrm="docker rm $(docker ps -a -q)"
# stop and remove # stop and remove
alias dkcsrm="docker rm -f $(docker ps -a -q)" alias dkcsrm="docker rm -f $(docker ps -a -q)"
# cleans out unused/dangling aufs volumes - run this occasionally # 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 dkde="gksudo gedit /etc/default/docker"
alias dkclean="docker system prune"
alias dkterm="docker_terminal" alias dkterm="docker_terminal"