xonsh cleanup

This commit is contained in:
Wouter Gordts 2022-09-29 18:03:07 +02:00
parent 969ca22b53
commit f62a712b3f
1 changed files with 11 additions and 12 deletions

View File

@ -3,7 +3,7 @@
NAME="waldek" NAME="waldek"
EMAIL="waldek@mailbox.org" EMAIL="waldek@mailbox.org"
DEFAULT_SHELL="xonsh" DEFAULT_SHELL="xonsh"
DEPENDENCIES_APT="zsh git tig tmux vim-nox htop python3 python3-pip python3-venv npm" DEPENDENCIES_APT="zsh git tig tmux vim-nox htop python3 python3-pip python3-venv"
DEPENDENCIES_PIP="xonsh[full] xontrib-sh" DEPENDENCIES_PIP="xonsh[full] xontrib-sh"
SOURCES_DIR=~/sources/gitea_irisib SOURCES_DIR=~/sources/gitea_irisib
@ -15,6 +15,7 @@ GITEA_HTTPS="https://gitea.86thumbs.net"
GITEA_SSH="ssh://gitea@86thumbs.net:3022" GITEA_SSH="ssh://gitea@86thumbs.net:3022"
GITEA_CLONE=$GITEA_HTTPS GITEA_CLONE=$GITEA_HTTPS
XONSH_VENV="~/.virtualenvs/base"
LOG=/dev/null LOG=/dev/null
if [[ -z $(groups | grep sudo) ]]; then if [[ -z $(groups | grep sudo) ]]; then
@ -131,9 +132,9 @@ function symlink_config_files () {
} }
function install_pip_dependencies () { function install_pip_dependencies () {
mkdir -p ~/virtual_envs mkdir -p $XONSH_VENV
python3 -m venv ~/virtual_envs/base python3 -m venv $XONSH_VENV
source ~/virtual_envs/base/bin/activate source $XONSH_VENV/bin/activate
for dep in $DEPENDENCIES_PIP; do for dep in $DEPENDENCIES_PIP; do
pip3 install --upgrade "$dep" > $LOG && echo "installed $dep" pip3 install --upgrade "$dep" > $LOG && echo "installed $dep"
done done
@ -141,15 +142,13 @@ function install_pip_dependencies () {
} }
function change_shell () { function change_shell () {
local path=$(which xonsh) if [[ "$1" == "xonsh" ]]; then
echo $path path=$XONSH_VENV/bin/xonsh
path=~/virtual_envs/base/bin/xonsh elif [[ -z "$(grep $1 /etc/shells)" ]]; then
if ! [[ -z $path ]]; then echo "$1 not a valid shell, falling back to $(which bash)"
if [[ -z "$(grep xonsh /etc/shells)" ]]; then path=$(which bash)
echo "$path" | sudo tee -a /etc/shells
fi
sudo chsh -s $path $USER && echo "set $1 as shell for $USER"
fi fi
sudo chsh -s $path $USER && echo "set $1 as shell for $USER"
echo "--- ${FUNCNAME[0]} done" echo "--- ${FUNCNAME[0]} done"
} }