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