diff --git a/.config/fish/config_wsl.fish b/.config/fish/config_wsl.fish index 9eb0575..176ef70 100644 --- a/.config/fish/config_wsl.fish +++ b/.config/fish/config_wsl.fish @@ -2,8 +2,5 @@ sudo mount -t drvfs 'Y:' /mnt/y -o metadata,uid=1000,gid=1000 sudo mount -t drvfs 'Z:' /mnt/z -o metadata,uid=1000,gid=1000 2> /dev/null -# COLORED MANUALS -set -x MANPAGER "sh -c 'col -bx | batcat -l man -p'" - # SSH fish_ssh_agent diff --git a/wsl.sh b/wsl.sh index 52de63f..0c795ca 100644 --- a/wsl.sh +++ b/wsl.sh @@ -2,32 +2,32 @@ if grep "WSL" /proc/version > /dev/null; then + # === Add repositories == + apt-add-repository ppa:fish-shell/release-3 -y + # === Update Ubuntu == - sudo sed -i "s/focal/jammy/g" /etc/apt/sources.list - sudo sed -i "s/focal/jammy/g" /etc/apt/sources.list.d/*.list - sudo apt update - sudo apt dist-upgrade -y - sudo apt full-upgrade -y + sed -i "s/focal/jammy/g" /etc/apt/sources.list + sed -i "s/focal/jammy/g" /etc/apt/sources.list.d/*.list + apt update + apt dist-upgrade -y + apt full-upgrade -y # === Remove SU password == - sudo sed -i "26s#.*#%sudo ALL=(ALL:ALL) NOPASSWD: ALL#" /etc/sudoers - sudo sed -i "44s#.*#%sudo ALL=(ALL:ALL) NOPASSWD: ALL#" /etc/sudoers - sudo sed -i "50s#.*#%sudo ALL=(ALL:ALL) NOPASSWD: ALL#" /etc/sudoers + sed -i "26s#.*#%sudo ALL=(ALL:ALL) NOPASSWD: ALL#" /etc/sudoers + sed -i "44s#.*#%sudo ALL=(ALL:ALL) NOPASSWD: ALL#" /etc/sudoers + sed -i "50s#.*#%sudo ALL=(ALL:ALL) NOPASSWD: ALL#" /etc/sudoers - # === Requirements == - which git &> /dev/null || sudo apt install git -y # install git if not already installed - which curl &> /dev/null || sudo apt install apt-transport-https curl -y # install curl (along with apt-transport-https) if not already installed - which wget &> /dev/null || sudo apt install wget -y # install wget if not already installed + # === Install packages == + apt install -y git apt-transport-https curl wget build-essential valgrind fish fzf bat procps exa micro libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libassimp-dev libfftw3-dev pkg-config automake make autoconf libtool perl-tk python3-pygments python3-venv python3-tk git-lfs zip unzip sed - # === Basic dev == - sudo apt install build-essential valgrind -y + # === Remove useless packages + apt purge -y needrestart # remove kernel update message (https://github.com/microsoft/WSL/issues/7054#issuecomment-864271333) + apt autoremove -y # === Fish == - sudo apt-add-repository ppa:fish-shell/release-3 -y - sudo apt update - sudo apt install fish fzf bat procps exa micro -y + # Install micro cd /usr/local/bin || exit - curl https://getmic.ro | sudo GETMICRO_PLATFORM=linux64 bash + curl https://getmic.ro | GETMICRO_PLATFORM=linux64 bash cd - || exit # Remove motd fish -c "set -U fish_greeting" @@ -73,8 +73,10 @@ then fish -c "set -U fish_pager_color_selected_background --background=brblack" fish -c "set -U fish_color_option d3d0c8" fish -c "set -U fish_color_keyword 99cc99" + # EXA colors + fish -c "set -Ux EXA_COLORS 'di=1;36:da=35'" # Adding aliases - fish -c "abbr ls 'exa -glh'" + fish -c "abbr ls 'exa --git --icons -glh'" fish -c "abbr cp 'cp -rv'" fish -c "abbr rm 'rm -rf'" fish -c "abbr gcc 'clear; gcc -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes -fanalyzer -g main.c && ./a.out; rm a.out 2> /dev/null'" @@ -90,13 +92,17 @@ then fish -c "abbr - 'cd -'" fish -c "abbr cat 'batcat'" fish -c "abbr nano 'micro'" - fish -c "abbr bigupdate 'sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y && tldr --update && sdk update && echo \'y\' | sdk upgrade java'" + fish -c "abbr bigupdate 'sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y && tldr --update && sdk update && yes | sdk upgrade java'" fish -c "abbr d 'explorer.exe .'" + fish -c "abbr gc 'git clone'" fish -c "abbr tlmgr 'sudo \$(which tlmgr)'" + # === Micro configuration == + git config --global core.editor "micro" + wget -q --show-progress https://git.kennel.ml/Anri/confOS/raw/branch/main/.config/micro/settings.json -O "$HOME"/.config/micro/settings.json + micro -plugin install detectindent + # === GL4D == - # Installing depedencies - sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libassimp-dev libfftw3-dev pkg-config automake make autoconf libtool -y # Download and build git clone https://github.com/noalien/GL4Dummies.git cd GL4Dummies || exit @@ -104,34 +110,26 @@ then ./configure make # Installing it - sudo make install + make install # Removing folder cd .. rm -rf GL4Dummies # Fix for shared libraries (https://stackoverflow.com/a/9395355) - sudo ldconfig + ldconfig # Add to path - if [ -f "$HOME"/.bashrc ] ; then - echo -e "\n# GL4Dummies\nexport PATH=/usr/local/bin:\$PATH\nexport LD_LIBRARY_PATH=/usr/local/lib:\$LD_LIBRARY_PATH\n" >> "$HOME"/.bashrc - fi - if [ -f "$HOME"/.config/fish/config.fish ] ; then - echo -e "\n# GL4Dummies\nset -gx LD_LIBRARY_PATH /usr/local/lib \$LD_LIBRARY_PATH\n" >> "$HOME"/.config/fish/config.fish - fi + #echo -e "\n# GL4Dummies\nexport PATH=/usr/local/bin:\$PATH\nexport LD_LIBRARY_PATH=/usr/local/lib:\$LD_LIBRARY_PATH\n" >> "$HOME"/.bashrc + fish -c "set -Ux LD_LIBRARY_PATH /usr/local/lib \$LD_LIBRARY_PATH" # === Latex == - sudo apt install perl-tk python3-pygments -y wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz tar -xzf install-tl-unx.tar.gz rm ./*.tar.gz cd install-tl-* || exit - echo "I" | sudo ./install-tl + echo "I" | ./install-tl cd .. rm -rf install-tl-* fish -c "fish_add_path /usr/local/texlive/*/bin/x86_64-linux" - # === Python stuff == - sudo apt install python3-venv python3-tk -y - # === Sign commits == git config --global commit.gpgsign true @@ -152,11 +150,7 @@ then wget -q --show-progress "$url" -O completions_fish mv completions_fish ~/.config/fish/completions/tldr.fish - # === Git LFS == - sudo apt install git-lfs -y - # === Java == - sudo apt install zip unzip sed -y # sed probably installed but it doesn't cost anything to double-check curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" # Adding Fish support if fish is installed @@ -167,19 +161,13 @@ then fish -c 'fisher install reitzig/sdkman-for-fish' fi sdk install java 17.0.2-tem # https://whichjdk.com/#adoptium-eclipse-temurin - echo "y" | sdk upgrade java + yes | sdk upgrade java - # === NodeJS == - curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - - sudo apt-get install -y nodejs + # === Manual color == + fish -c "set -Ux MANPAGER \"sh -c 'col -bx | batcat -l man -p'\"" # === Shared folders == - sudo mkdir /mnt/z && sudo mkdir /mnt/y - - # === Remove useless packages - sudo apt purge needrestart -y # remove kernel update message (https://github.com/microsoft/WSL/issues/7054#issuecomment-864271333) - sudo apt autoremove -y - + mkdir /mnt/z && mkdir /mnt/y echo -e "\nInstallation terminée !\nIl faut redémarrer WSL (dans Powershell = wsl --shutdown)." echo -e "---\nPense bien à paramétrer ton terminal, exemple avec Windows Terminal :"