This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
bash-shell-host/all/modules/chromium.sh

44 lines
968 B
Bash
Executable File

#!/bin/bash
function mv_chromium () {
local _ch
local ch
_ch=$(command -v _chromium)
if [[ $_ch ]]; then
ch=$(dirname "$_ch")/chromium
## if chromium exits probably an update to so move again
[[ -f $ch ]] && sudo mv "${ch}" "$_ch" && echo chromium updated: $($_ch --version)
else
# echo no _chromium
ch=$(command -v chromium)
[[ $ch ]] && sudo mv "${ch}" "$(dirname "$ch")/_chromium" || return 1
fi
return 0
}
function chromium_ () {
local user
local dir
mv_chromium
[[ $? -ne 0 ]] && echo chromium not installed && return 1
# echo chromium executable available and moved to $(command -v _chromium)
user=${CHROME_USER:-$1}
user=${user:-$USER}
dir=${CHROME_CONFIG_HOME:-"$HOME/.config/chromium"}
[[ $user == "$USER" ]] && dir="$HOME/.config/chromium"
exe=$(command -v _chromium)
echo "$exe --user-data-dir=$dir/$user"
$exe --user-data-dir=$dir/$user
}
# # if script was executed then call the function
(return 0 2>/dev/null) || chromium_ $@