Merge remote-tracking branch 'git.kebler.net/master' into giskard

# Conflicts:
#	all/modules/vscode.sh
giskard
Kebler Network System Administrator 2021-11-20 12:27:07 -08:00
commit 0c574294d4
4 changed files with 156 additions and 129 deletions

View File

@ -21,6 +21,7 @@ alias pipu="pipx upgrade"
alias pipua="pipx upgrade-all" alias pipua="pipx upgrade-all"
alias pipupip="pipx upgrade pipx" alias pipupip="pipx upgrade pipx"
alias pipi="pipx install" alias pipi="pipx install"
alias pipr="pipx uninstall"
alias pipl="pipx list" alias pipl="pipx list"
alias piplv="pipx list --verbose" alias piplv="pipx list --verbose"
@ -45,4 +46,3 @@ echo "$List"
confirm "ATTENTION: upgrade all these packages at once??" || return 0 confirm "ATTENTION: upgrade all these packages at once??" || return 0
echo "$List" | cut -d' ' -f1 | xargs -n1 sudo -H python$Ver -m pip install -U echo "$List" | cut -d' ' -f1 | xargs -n1 sudo -H python$Ver -m pip install -U
} }

View File

@ -6,31 +6,52 @@ chromium_ () {
local DEFAULT=/opt/chromium local DEFAULT=/opt/chromium
# local DEFAULT="$HOME/.local/share/chromium" # local DEFAULT="$HOME/.local/share/chromium"
local exe="/usr/bin/chromium" local exe="/usr/bin/chromium"
[[ ! $exe ]] && echo chromium not installed set && return 1
user=${CHROMIUM_USER} [[ $1 == -g ]] && exe=$(command -v google-chrome) && shift
[[ $1 && ( ! $1 == -* ) ]] && user=$1 && shift echo exe $exe
[[ $1 && ( ! $1 == -* ) ]] && url=$1 && shift if [[ ! -f $exe ]]; then
user=${user:-$USER} echo chromium/chrome not installed, checking for flatpak version
if [[ $user == "$USER" ]]; then flatpak=$(flatpak info com.github.Eloston.UngoogledChromium | grep error:)
unset CHROME_CONFIG_HOME if [[ $flatpak ]]; then
echo starting chromium for $USER in default directory within users home echo no flatpak version either - exiting && return 1
echo $exe "$@"
$exe "$@"
else else
[[ $user == "incognito" ]] && set -- "$@" "-incognito" flatpak=true
dir=${CHROMIUM_HOME:-$DEFAULT} exe="/usr/bin/flatpak run --branch=stable --arch=x86_64 --filesystem=<dir> --command=/app/bin/chromium --file-forwarding com.github.Eloston.UngoogledChromium @@u"
echo "$exe $@ --user-data-dir=$dir/$user"
"$exe" "$@" --user-data-dir="$dir"/"$user" $url
fi fi
fi
local instance=${CHROMIUM_INSTANCE}
[[ $1 && (! $1 == -*) ]] && instance=$1 && shift
[[ $1 && (! $1 == -*) ]] && url=$1 && shift
if [[ $instance =~ http[s]?:\/\/ ]]; then
url=$instance
instance=""
if [[ $url =~ ^-+ ]]; then
url=""
set -- "$@" $url
url=""
fi
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}"
# echo $exe "$@" $([[ $flatpak ]] && echo " @@")
# $exe "$@"
else
[[ $instance == "incognito" ]] && set -- "$@" "-incognito"
dir=${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 "@@")
} }
# # if script was executed then call the function # # if script was executed then call the function
(return 0 2>/dev/null) || chromium_ $@ (return 0 2>/dev/null) || chromium_ $@

View File

@ -16,7 +16,6 @@ hugo_install () {
FORCE=false FORCE=false
EFILE="" EFILE=""
# options # options
# e - download and install the extended version # e - download and install the extended version
# c - use 'hugoe' as the install command for extended version otherwise 'hugo' will launch extended version # c - use 'hugoe' as the install command for extended version otherwise 'hugo' will launch extended version
@ -61,41 +60,45 @@ hugo_install () {
exit 1 exit 1
fi fi
INSTALLED="$(hugo$EFILE version 2>/dev/null | cut -d'v' -f2 | cut -c 1-6)" INSTALLED="$(hugo$EFILE version 2>/dev/null | cut -d'v' -f2 | cut -c 1-6)"
CUR_VERSION=${INSTALLED:-"None"} CUR_VERSION=${INSTALLED:-"None"}
echo $(curl -u $GITHUB_USER:$GITHUB_TOKEN -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep tag_name) # echo $(curl -u $GITHUB_USER:$GITHUB_TOKEN -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep tag_name)
NEW_VERSION="$(curl -u $GITHUB_USER:$GITHUB_TOKEN -s https://api.github.com/repos/gohugoio/hugo/releases/latest \ # NEW_VERSION="$(curl -u $GITHUB_USER:$GITHUB_TOKEN -s https://api.github.com/repos/gohugoio/hugo/releases/latest \
| grep tag_name \ # | grep tag_name \
| cut -d'v' -f2 | cut -c 1-6)" # | cut -d'v' -f2 | cut -c 1-6)"
echo "Hugo `[ $EXTENDED == true ] && echo "Extended"`: Current Version : $CUR_VERSION => New Version: $NEW_VERSION" NEW_VERSION=$(lastversion hugo)
if [ -z "$NEW_VERSION" ]; then echo "Hugo $([ $EXTENDED == true ] && echo "Extended"): Current Version : $CUR_VERSION => New Version: $NEW_VERSION"
echo Unable to retrieve new version number - Likely you have reached github anonymous limit
echo set environment variable `$GITHUB_USER` and `$GITHUB_TOKEN` and try again # if [ -z "$NEW_VERSION" ]; then
exit 1 # echo Unable to retrieve new version number - Likely you have reached github anonymous limit
fi # echo set environment variable $($GITHUB_USER) and $($GITHUB_TOKEN) and try again
# exit 1
# fi
[[ $NEW_VERSION = $CUR_VERSION ]] && [[ $FORCE = false ]] && echo Latest version already installed at $BIN_PATH && return 0 [[ $NEW_VERSION = $CUR_VERSION ]] && [[ $FORCE = false ]] && echo Latest version already installed at $BIN_PATH && return 0
pushd /tmp/ >/dev/null pushd /tmp/ >/dev/null
URL=$(curl -u $GITHUB_USER:$GITHUB_TOKEN -s https://api.github.com/repos/gohugoio/hugo/releases/latest \ # curl -u $GITHUB_USER:$GITHUB_TOKEN -s https://api.github.com/repos/gohug#oio/hugo/releases/latest |
| grep "browser_download_url.*hugo.*._Linux-${ARCHES[$ARCH]}\.tar\.gz" \ # grep "browser_download_url.*hugo.*._Linux-${ARCHES[$ARCH]}\.tar\.gz" |
| \
URL=$(
lastversion hugo --format assets --filter Linux-${ARCHES[$ARCH]}\.tar\.gz |
if [ $EXTENDED = true ]; then if [ $EXTENDED = true ]; then
grep "_extended" grep "_extended"
else else
grep -v "_extended" grep -v "_extended"
fi \ fi
| cut -d ":" -f 2,3 \ # |
| tr -d \" \ # cut -d ":" -f 2,3 |
# tr -d \"
) )
echo $URL echo $URL
echo "Installing version $NEW_VERSION `[ $EXTENDED == true ] && echo "Extended"` " echo "Installing version $NEW_VERSION $([ $EXTENDED == true ] && echo "Extended") "
echo "This machine's architecture is $ARCH" echo "This machine's architecture is $ARCH"
echo "Downloading Tarball $URL" echo "Downloading Tarball $URL"
@ -120,7 +123,7 @@ hugo_install () {
popd >/dev/null popd >/dev/null
echo Installing hugo `[ $EXTENDED == true ] && echo "extended"` as hugo$EFILE echo Installing hugo $([ $EXTENDED == true ] && echo "extended") as hugo$EFILE
BIN_PATH="$(which hugo$EFILE)" BIN_PATH="$(which hugo$EFILE)"

View File

@ -2,7 +2,10 @@
VSCODE_BIN=$(command -v code) VSCODE_BIN=$(command -v code)
VSCODE_BIN=${VSCODE_BIN:-$(command -v codium)} VSCODE_BIN=${VSCODE_BIN:-$(command -v codium)}
[[ $VSCODE_BIN ]] || { echo "no vscode binary on machine";exit; } [[ $VSCODE_BIN ]] || {
echo "no vscode binary on machine"
exit
}
# set default home here # set default home here
# can pass # can pass
vscode() { vscode() {