From 77b45743be43e5d138aadab18503465edbd5de9c Mon Sep 17 00:00:00 2001 From: Alexandre Tuleu Date: Tue, 14 Jun 2022 22:00:50 +0200 Subject: [PATCH] Updated install script --- install.sh | 88 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 81 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index 8245d58..bd4e774 100755 --- a/install.sh +++ b/install.sh @@ -2,6 +2,7 @@ set -e + files=".config/fish \ .config/git \ .config/omf \ @@ -16,18 +17,89 @@ function this_script_root_dir() { } function run() { - echo "$@" +# echo "$@" $@ } function load_gnome_terminal_profiles() { - if which dconf + if which dconf 1>/dev/null then run dconf load /org/gnome/terminal/legacy/profiles:/ < $(this_script_root_dir)/gnome-terminal-profiles.dconf fi } +function use_fish() { + if ! which fish 1>/dev/null + then + echo "Installing fish" + run sudo apt-get install -y fish + else + echo "Fish is installed" + fi + + fish=$(which fish) + current_shell=$(grep $USER /etc/passwd | cut -d ":" -f 7) + if [ $current_shell != $fish ] + then + echo "Changing shell to $fish (you will be prompted for passwd)" + run chsh -s $fish + else + echo "Default shell is $fish" + fi +} + +function use_direnv() { + if ! which direnv 1>/dev/null + then + echo "Installing direnv" + run sudo apt-get install -y direnv + else + echo "direnv is installed" + fi +} + +function use_starship() { + if ! which starship 1>/dev/null + then + echo "Installing starship" + run curl -sS https://starship.rs/install.sh | sh + else + echo "Starship is installed" + fi +} + +function install_ubuntu_mono_nerd() { + if ! fc-list | grep "UbuntuMono Nerd" 1>/dev/null + then + pushd /tmp + run wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/UbuntuMono.zip + run unzip UbuntuMono.zip + run mkdir -p ~/.local/share/fonts + run cp *.ttf ~/.local/share/fonts/ + run fc-cache -f + popd + else + echo "UbuntuMono Nerd font is installed" + fi + + if [ ! -e /usr/share/terminfo/x/xterm-direct ] + then + run sudo apt-get install -y ncurses-term + else + echo "xterm-direct is in terminfo database" + fi +} + +function install_deps() { + use_fish + use_direnv + use_starship + install_ubuntu_mono_nerd +} + + function install_home() { + install_deps for f in $files do run rm -Rf $HOME/$f @@ -43,9 +115,11 @@ function install_home() { } -pushd $(this_script_root_dir) -git pull -git submodule init -git submodule update -popd +pushd $(this_script_root_dir) 1>/dev/null +echo "Updating git.tuleu.science:atuleu/home.git" +git pull 1>/dev/null +git submodule init 1>/dev/null +git submodule update 1>/dev/null +popd 1>/dev/null install_home +echo "git.tuleu.science:atuleu/home.git updated and set"