#!/usr/bin/env bash if grep "WSL" /proc/version > /dev/null; then # === Update Ubuntu == sudo sed -i "s/focal/impish/g" /etc/apt/sources.list sudo sed -i "s/focal/impish/g" /etc/apt/sources.list.d/*.list sudo apt update sudo apt upgrade -y # === Remove SU password == sudo sed -i "26s#.*#%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 # === Basic dev == sudo apt install build-essential valgrind -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 cd /usr/local/bin || exit curl https://getmic.ro | sudo GETMICRO_PLATFORM=linux64 bash cd - || exit # Remove motd fish -c "set -U fish_greeting" # Reversed search curl -sL https://git.io/fisher | fish -c "source && fisher install jorgebucaran/fisher" fish -c "fisher install jethrokuan/fzf" # SSH rm "$HOME"/.config/fish/functions/fish_ssh_agent.fish 2>/dev/null wget -q https://gitlab.com/kyb/fish_ssh_agent/raw/master/functions/fish_ssh_agent.fish -P "$HOME"/.config/fish/functions/ mkdir "$HOME"/.ssh # Custom config.fish rm "$HOME"/.config/fish/config.fish 2>/dev/null wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/.config/fish/config_wsl.fish -O "$HOME"/.config/fish/config.fish # Custom prompt shell (based on Base16 Eighties) rm "$HOME"/.config/fish/functions/fish_prompt.fish 2>/dev/null wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/.config/fish/functions/fish_prompt.fish -P "$HOME"/.config/fish/functions/ fish -c 'set -U fish_color_normal normal' fish -c 'set -U fish_color_command 99cc99' fish -c 'set -U fish_color_quote ffcc66' fish -c 'set -U fish_color_redirection d3d0c8' fish -c 'set -U fish_color_end cc99cc' fish -c 'set -U fish_color_error f2777a' fish -c 'set -U fish_color_param d3d0c8' fish -c 'set -U fish_color_comment ffcc66' fish -c 'set -U fish_color_match 6699cc' fish -c 'set -U fish_color_selection white --bold --background=brblack' fish -c 'set -U fish_color_search_match bryellow --background=brblack' fish -c 'set -U fish_color_history_current --bold' fish -c 'set -U fish_color_operator 6699cc' fish -c 'set -U fish_color_escape 66cccc' fish -c 'set -U fish_color_cwd green' fish -c 'set -U fish_color_cwd_root red' fish -c 'set -U fish_color_valid_path --underline' fish -c 'set -U fish_color_autosuggestion 747369' fish -c 'set -U fish_color_user brgreen' fish -c 'set -U fish_color_host normal' fish -c 'set -U fish_color_cancel -r' fish -c 'set -U fish_pager_color_completion normal' fish -c 'set -U fish_pager_color_description B3A06D yellow' fish -c 'set -U fish_pager_color_prefix normal --bold --underline' fish -c 'set -U fish_pager_color_progress brwhite --background=cyan' # Adding aliases fish -c "abbr ls 'exa -glh'" fish -c "abbr cp 'cp -rv'" fish -c "abbr rm 'rm -rf'" fish -c "abbr gcc 'clear; gcc -Wall -Wextra -fanalyzer -O3 main.c && ./a.out; rm a.out 2> /dev/null'" fish -c "abbr vgcc 'clear; gcc -Wall -Wextra -fanalyzer -O3 main.c && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./a.out; rm a.out 2> /dev/null'" fish -c "abbr g++ 'clear; g++ -Wall -Wextra -fanalyzer -O3 main.cpp && ./a.out; rm a.out 2> /dev/null'" fish -c "abbr vg++ 'clear; g++ -Wall -Wextra -fanalyzer -O3 main.cpp && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./a.out; rm a.out 2> /dev/null'" fish -c "abbr make 'clear; make && ./main; make clean 2> /dev/null'" fish -c "abbr vmake 'clear; make && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./main; make clean 2> /dev/null'" fish -c "abbr activate 'source bin/activate.fish'" fish -c "abbr c 'command'" fish -c "abbr vs 'code .'" fish -c "abbr untgz 'tar -xvzf'" fish -c "abbr - 'cd -'" fish -c "abbr cat 'batcat'" fish -c "abbr nano 'micro'" fish -c "abbr bigupdate 'sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && tldr --update'" fish -c "abbr d 'explorer.exe .'" fish -c "abbr tlmgr 'sudo \$(which tlmgr)'" # === GL4D == # Installing depedencies sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev pkg-config automake make autoconf libtool -y # libsdl2-ttf-dev # Download and build git clone https://github.com/noalien/GL4Dummies.git cd GL4Dummies || exit make -f Makefile.autotools ./configure make # Installing it sudo make install # Removing folder cd .. rm -rf GL4Dummies # Fix for shared libraries (https://stackoverflow.com/a/9395355) sudo 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 # === 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 cd .. rm -rf install-tl-* fish -c "fish_add_path /usr/local/texlive/*/bin/x86_64-linux" # === Python stuff == sudo apt install python3-virtualenv python3-tk -y # === Sign commits == git config --global commit.gpgsign true # === Rust == curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y source "$HOME"/.cargo/env fish -c "set -Up fish_user_paths ~/.cargo/bin" # Dev tools rustup component add rust-analysis rustup component add rls # === tldr == cargo install tealdeer tldr --update # Fish completion latest=$(wget -qO- https://api.github.com/repos/dbrgn/tealdeer/releases/latest) url=$(grep 'browser_download_url": ".*/completions_fish"' <<< "$latest" | awk '{ print substr ($0, 32 ) }' | awk '{ print substr( $0, 1, length($0)-1 ) }') 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 if [ -x "$HOME"/.config/fish ] ; then if [ ! -f "$HOME"/.config/fish/functions/fisher.fish ] ; then # install fisher if not already installed curl -sL https://git.io/fisher | fish -c 'source && fisher install jorgebucaran/fisher' fi 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 # === 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 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 :" echo "- Ligne de commande = wsl.exe -d Ubuntu fish" #printf "%s%s%s\n" "- Répertoire de démarrage = \\" "\wsl.localhost\Ubuntu\home\\" "$USER" echo "- Jeu de couleur = One Half Dark" else echo "Ce script ne fonctionne que sur WSL (Ubuntu)." fi