Merge remote-tracking branch 'git.kebler.net/master' into giskard
# Conflicts: # all/modules/vscode.shgiskard
commit
0c574294d4
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
use_pyenv () {
|
use_pyenv() {
|
||||||
if command -v pyenv >/dev/null 2>&1; then
|
if command -v pyenv >/dev/null 2>&1; then
|
||||||
export PYENV_ROOT="/opt/python/pyenv"
|
export PYENV_ROOT="/opt/python/pyenv"
|
||||||
export PYENV_VERSION=${PYENV_VERSION:-3.8.7}
|
export PYENV_VERSION=${PYENV_VERSION:-3.8.7}
|
||||||
eval "$(pyenv init -)"
|
eval "$(pyenv init -)"
|
||||||
eval "$(pyenv virtualenv-init -)"
|
eval "$(pyenv virtualenv-init -)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,28 +21,28 @@ 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"
|
||||||
|
|
||||||
path_append "/opt/python/bin"
|
path_append "/opt/python/bin"
|
||||||
|
|
||||||
if command -v pipx >/dev/null 2>&1; then
|
if command -v pipx >/dev/null 2>&1; then
|
||||||
path_append "/opt/python/apps/bin"
|
path_append "/opt/python/apps/bin"
|
||||||
export PIPX_HOME=/opt/python/apps
|
export PIPX_HOME=/opt/python/apps
|
||||||
export PIPX_BIN_DIR=$PIPX_HOME/bin
|
export PIPX_BIN_DIR=$PIPX_HOME/bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ $USE_PYENV ]] && use_pyenv
|
[[ $USE_PYENV ]] && use_pyenv
|
||||||
|
|
||||||
spipua () {
|
spipua() {
|
||||||
module_load confirm
|
module_load confirm
|
||||||
echo upgrading all base python packages - requires sudo access
|
echo upgrading all base python packages - requires sudo access
|
||||||
# sudo -H python3.8 -m pip list --outdated
|
# sudo -H python3.8 -m pip list --outdated
|
||||||
local List
|
local List
|
||||||
local Ver=${1:-3.8}
|
local Ver=${1:-3.8}
|
||||||
List="$(sudo -H python$Ver -m pip list -o --format columns)"
|
List="$(sudo -H python$Ver -m pip list -o --format columns)"
|
||||||
echo "$List"
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,36 +1,57 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# user to start MUST be first in arguments
|
# user to start MUST be first in arguments
|
||||||
# if not supplied then will use default
|
# if not supplied then will use default
|
||||||
chromium_ () {
|
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 "$@"
|
else
|
||||||
$exe "$@"
|
flatpak=true
|
||||||
else
|
exe="/usr/bin/flatpak run --branch=stable --arch=x86_64 --filesystem=<dir> --command=/app/bin/chromium --file-forwarding com.github.Eloston.UngoogledChromium @@u"
|
||||||
[[ $user == "incognito" ]] && set -- "$@" "-incognito"
|
fi
|
||||||
dir=${CHROMIUM_HOME:-$DEFAULT}
|
|
||||||
echo "$exe $@ --user-data-dir=$dir/$user"
|
|
||||||
"$exe" "$@" --user-data-dir="$dir"/"$user" $url
|
|
||||||
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_ $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,113 +1,116 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
hugo_install () {
|
hugo_install() {
|
||||||
# inspried from this forum post https://discourse.gohugo.io/t/script-to-install-latest-hugo-release-on-macos-and-ubuntu/14774/10
|
# inspried from this forum post https://discourse.gohugo.io/t/script-to-install-latest-hugo-release-on-macos-and-ubuntu/14774/10
|
||||||
# if you have run into github api anonymous access limits which happens during debugging/dev then add user and token here or sourced from a separate file
|
# if you have run into github api anonymous access limits which happens during debugging/dev then add user and token here or sourced from a separate file
|
||||||
# . ~/githubapitoken
|
# . ~/githubapitoken
|
||||||
#GITHUB_USER=""
|
#GITHUB_USER=""
|
||||||
#GITHUB_TOKEN=""
|
#GITHUB_TOKEN=""
|
||||||
|
|
||||||
if [ "$GITHUB_TOKEN" != "" ]; then
|
if [ "$GITHUB_TOKEN" != "" ]; then
|
||||||
echo using access token with script
|
echo using access token with script
|
||||||
echo $GITHUB_USER $GITHUB_TOKEN
|
echo $GITHUB_USER $GITHUB_TOKEN
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EXTENDED=false
|
EXTENDED=false
|
||||||
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
|
||||||
# f - force download/overwrite of same version
|
# f - force download/overwrite of same version
|
||||||
|
|
||||||
declare OPTION
|
declare OPTION
|
||||||
declare OPTARG
|
declare OPTARG
|
||||||
declare OPTIND
|
declare OPTIND
|
||||||
|
|
||||||
while getopts 'ecf' OPTION; do
|
while getopts 'ecf' OPTION; do
|
||||||
case "$OPTION" in
|
case "$OPTION" in
|
||||||
e)
|
e)
|
||||||
echo "installing extended hugo"
|
echo "installing extended hugo"
|
||||||
EXTENDED=true
|
EXTENDED=true
|
||||||
;;
|
;;
|
||||||
c)
|
c)
|
||||||
if [ $EXTENDED = true ]; then
|
if [ $EXTENDED = true ]; then
|
||||||
EFILE="e"
|
EFILE="e"
|
||||||
echo using hugoe for extended command
|
echo using hugoe for extended command
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
f)
|
f)
|
||||||
echo "FORCING download/overwrite"
|
echo "FORCING download/overwrite"
|
||||||
FORCE=true
|
FORCE=true
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
shift $(( OPTIND - 1 ))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
DEFAULT_BIN_DIR="/usr/local/bin"
|
DEFAULT_BIN_DIR="/usr/local/bin"
|
||||||
# Single optional argument is directory in which to install hugo
|
# Single optional argument is directory in which to install hugo
|
||||||
BIN_DIR=${1:-"$DEFAULT_BIN_DIR"}
|
BIN_DIR=${1:-"$DEFAULT_BIN_DIR"}
|
||||||
|
|
||||||
BIN_PATH="$(which hugo$EFILE)"
|
BIN_PATH="$(which hugo$EFILE)"
|
||||||
declare -A ARCHES
|
declare -A ARCHES
|
||||||
ARCHES=( ["arm64"]="ARM64" ["aarch64"]="ARM64" ["x86_64"]="64bit" ["arm32"]="ARM" ["armhf"]="ARM" )
|
ARCHES=(["arm64"]="ARM64" ["aarch64"]="ARM64" ["x86_64"]="64bit" ["arm32"]="ARM" ["armhf"]="ARM")
|
||||||
ARCH=$(arch)
|
ARCH=$(arch)
|
||||||
|
|
||||||
if [ -z "${ARCHES[$ARCH]}" ]; then
|
if [ -z "${ARCHES[$ARCH]}" ]; then
|
||||||
echo Your machine kernel architecture $ARCH is not supported by this script, aborting
|
echo Your machine kernel architecture $ARCH is not supported by this script, aborting
|
||||||
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
|
||||||
[[ $NEW_VERSION = $CUR_VERSION ]] && [[ $FORCE = false ]] && echo Latest version already installed at $BIN_PATH && return 0
|
# fi
|
||||||
|
|
||||||
pushd /tmp/ > /dev/null
|
[[ $NEW_VERSION = $CUR_VERSION ]] && [[ $FORCE = false ]] && echo Latest version already installed at $BIN_PATH && return 0
|
||||||
|
|
||||||
URL=$(curl -u $GITHUB_USER:$GITHUB_TOKEN -s https://api.github.com/repos/gohugoio/hugo/releases/latest \
|
pushd /tmp/ >/dev/null
|
||||||
| grep "browser_download_url.*hugo.*._Linux-${ARCHES[$ARCH]}\.tar\.gz" \
|
|
||||||
| \
|
# curl -u $GITHUB_USER:$GITHUB_TOKEN -s https://api.github.com/repos/gohug#oio/hugo/releases/latest |
|
||||||
if [ $EXTENDED = true ]; then
|
# grep "browser_download_url.*hugo.*._Linux-${ARCHES[$ARCH]}\.tar\.gz" |
|
||||||
grep "_extended"
|
|
||||||
else
|
URL=$(
|
||||||
grep -v "_extended"
|
lastversion hugo --format assets --filter Linux-${ARCHES[$ARCH]}\.tar\.gz |
|
||||||
fi \
|
if [ $EXTENDED = true ]; then
|
||||||
| cut -d ":" -f 2,3 \
|
grep "_extended"
|
||||||
| tr -d \" \
|
else
|
||||||
|
grep -v "_extended"
|
||||||
|
fi
|
||||||
|
# |
|
||||||
|
# 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"
|
||||||
|
|
||||||
wget --user=-u $GITHUB_USER --password=$GITHUB_TOKEN -q $URL
|
wget --user=-u $GITHUB_USER --password=$GITHUB_TOKEN -q $URL
|
||||||
|
|
||||||
TARBALL=$(basename $URL)
|
TARBALL=$(basename $URL)
|
||||||
# TARBALL="$(find . -name "*Linux-${ARCHES[$ARCH]}.tar.gz" 2>/dev/null)"
|
# TARBALL="$(find . -name "*Linux-${ARCHES[$ARCH]}.tar.gz" 2>/dev/null)"
|
||||||
echo Expanding Tarball, $TARBALL
|
echo Expanding Tarball, $TARBALL
|
||||||
tar -xzf $TARBALL hugo
|
tar -xzf $TARBALL hugo
|
||||||
|
|
||||||
chmod +x hugo
|
chmod +x hugo
|
||||||
|
|
||||||
if [ -w $BIN_DIR ]; then
|
if [ -w $BIN_DIR ]; then
|
||||||
echo "Installing hugo to $BIN_DIR"
|
echo "Installing hugo to $BIN_DIR"
|
||||||
mv hugo -f $BIN_DIR/hugo$EFILE
|
mv hugo -f $BIN_DIR/hugo$EFILE
|
||||||
|
@ -115,15 +118,15 @@ hugo_install () {
|
||||||
echo "installing hugo to $BIN_DIR (sudo)"
|
echo "installing hugo to $BIN_DIR (sudo)"
|
||||||
sudo mv -f hugo $BIN_DIR/hugo$EFILE
|
sudo mv -f hugo $BIN_DIR/hugo$EFILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm $TARBALL
|
rm $TARBALL
|
||||||
|
|
||||||
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)"
|
||||||
|
|
||||||
if [ -z "$BIN_PATH" ]; then
|
if [ -z "$BIN_PATH" ]; then
|
||||||
printf "WARNING: Installed Hugo Binary in $BIN_DIR is not in your environment path\nPATH=$PATH\n"
|
printf "WARNING: Installed Hugo Binary in $BIN_DIR is not in your environment path\nPATH=$PATH\n"
|
||||||
else
|
else
|
||||||
|
@ -135,5 +138,5 @@ hugo_install () {
|
||||||
printf "New Hugo binary version at $BIN_PATH is\n $($BIN_PATH version)\n"
|
printf "New Hugo binary version at $BIN_PATH is\n $($BIN_PATH version)\n"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,20 +2,23 @@
|
||||||
|
|
||||||
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() {
|
||||||
#local home=$HOME
|
#local home=$HOME
|
||||||
local home=/opt/vscode
|
local home=/opt/vscode
|
||||||
home=${VSCODE_HOME:-$home}
|
home=${VSCODE_HOME:-$home}
|
||||||
[[ $1 == "-h" ]] && home=$2 && shift 2
|
[[ $1 == "-h" ]] && home=$2 && shift 2
|
||||||
mkdir -p ${home}/${USER}
|
mkdir -p ${home}/${USER}
|
||||||
[[ $? -ne 0 ]] && echo "unable to set vscode home at $home/$USER, aborting" && return 1
|
[[ $? -ne 0 ]] && echo "unable to set vscode home at $home/$USER, aborting" && return 1
|
||||||
exts=${home}/${USER}/extensions
|
exts=${home}/${USER}/extensions
|
||||||
user=${home}/${USER}/data
|
user=${home}/${USER}/data
|
||||||
echo $VSCODE_BIN --user-data-dir=$user --extensions-dir=$exts "$@"
|
echo $VSCODE_BIN --user-data-dir=$user --extensions-dir=$exts "$@"
|
||||||
$VSCODE_BIN --user-data-dir=$user --extensions-dir=$exts "$@"
|
$VSCODE_BIN --user-data-dir=$user --extensions-dir=$exts "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# # if script was executed then call the function
|
# # if script was executed then call the function
|
||||||
|
|
Reference in New Issue