2022-03-30 19:30:07 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
if grep "WSL" /proc/version > /dev/null;
|
|
|
|
then
|
2022-08-03 10:32:10 +02:00
|
|
|
# === Add repositories ==
|
|
|
|
apt-add-repository ppa:fish-shell/release-3 -y
|
|
|
|
|
2022-04-09 01:17:44 +02:00
|
|
|
# === Update Ubuntu ==
|
2022-08-03 10:32:10 +02:00
|
|
|
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
|
2022-03-30 23:24:19 +02:00
|
|
|
|
2022-04-11 17:55:26 +02:00
|
|
|
# === Remove SU password ==
|
2022-08-03 10:32:10 +02:00
|
|
|
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
|
2022-04-11 17:55:26 +02:00
|
|
|
|
2022-08-03 10:32:10 +02:00
|
|
|
# === Install packages ==
|
2022-08-18 00:53:34 +02:00
|
|
|
apt install -y git apt-transport-https curl wget build-essential valgrind fish fzf bat procps 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 libssl-dev
|
2022-03-30 19:30:07 +02:00
|
|
|
|
2022-08-03 10:32:10 +02:00
|
|
|
# === Remove useless packages
|
|
|
|
apt purge -y needrestart # remove kernel update message (https://github.com/microsoft/WSL/issues/7054#issuecomment-864271333)
|
|
|
|
apt autoremove -y
|
2022-03-30 19:30:07 +02:00
|
|
|
|
2022-09-29 17:03:11 +02:00
|
|
|
# == Locales ==
|
|
|
|
# !TODO!
|
|
|
|
|
2022-04-04 00:28:40 +02:00
|
|
|
# === Fish ==
|
2022-03-30 19:30:07 +02:00
|
|
|
# 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
|
2022-03-30 23:24:19 +02:00
|
|
|
wget -q https://gitlab.com/kyb/fish_ssh_agent/raw/master/functions/fish_ssh_agent.fish -P "$HOME"/.config/fish/functions/
|
2022-03-30 19:30:07 +02:00
|
|
|
mkdir "$HOME"/.ssh
|
|
|
|
# Custom config.fish
|
|
|
|
rm "$HOME"/.config/fish/config.fish 2>/dev/null
|
2022-03-31 00:47:03 +02:00
|
|
|
wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/.config/fish/config_wsl.fish -O "$HOME"/.config/fish/config.fish
|
2022-07-19 01:00:02 +02:00
|
|
|
# Custom prompt shell (based on https://github.com/fish-shell/fish-shell/blob/master/share/tools/web_config/themes/Base16%20Eighties.theme)
|
|
|
|
# Modifications: Changed comment color
|
|
|
|
rm "$HOME"/.config/fish/functions/fish_prompt.fish 2> /dev/null
|
2022-03-30 23:24:19 +02:00
|
|
|
wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/.config/fish/functions/fish_prompt.fish -P "$HOME"/.config/fish/functions/
|
2022-07-19 01:00:02 +02:00
|
|
|
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 5c6773"
|
|
|
|
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"
|
|
|
|
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"
|
2022-03-30 19:30:07 +02:00
|
|
|
# Adding aliases
|
2022-08-12 18:26:03 +02:00
|
|
|
fish -c "abbr ls 'exa --git --icons -gl'"
|
2022-03-30 19:30:07 +02:00
|
|
|
fish -c "abbr cp 'cp -rv'"
|
|
|
|
fish -c "abbr rm 'rm -rf'"
|
2022-09-29 17:03:11 +02:00
|
|
|
fish -c "abbr gcc 'clear; gcc -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes -fanalyzer -fsanitize=undefined -g main.c && ./a.out; rm a.out 2> /dev/null'"
|
|
|
|
fish -c "abbr vgcc 'clear; gcc -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes -fanalyzer -fsanitize=undefined -g main.c && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./a.out; rm a.out 2> /dev/null'"
|
2022-04-18 20:08:25 +02:00
|
|
|
fish -c "abbr g++ 'clear; g++ -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -g -Wold-style-cast -Wsign-conversion main.cpp && ./a.out; rm a.out 2> /dev/null'"
|
|
|
|
fish -c "abbr vg++ 'clear; g++ -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -g -Wold-style-cast -Wsign-conversion main.cpp && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./a.out; rm a.out 2> /dev/null'"
|
2022-03-30 19:30:07 +02:00
|
|
|
fish -c "abbr make 'clear; make && ./main; make clean 2> /dev/null'"
|
2022-04-04 00:04:07 +02:00
|
|
|
fish -c "abbr vmake 'clear; make && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./main; make clean 2> /dev/null'"
|
2022-03-30 19:30:07 +02:00
|
|
|
fish -c "abbr activate 'source bin/activate.fish'"
|
|
|
|
fish -c "abbr c 'command'"
|
|
|
|
fish -c "abbr vs 'code .'"
|
|
|
|
fish -c "abbr untgz 'tar -xvzf'"
|
2022-09-29 17:03:11 +02:00
|
|
|
fish -c "abbr tgz 'tar czf \"Archive.tar.gz\"'"
|
2022-03-30 19:30:07 +02:00
|
|
|
fish -c "abbr - 'cd -'"
|
2022-09-29 17:03:11 +02:00
|
|
|
fish -c "abbr cd.. 'cd ..'"
|
2022-03-30 19:30:07 +02:00
|
|
|
fish -c "abbr cat 'batcat'"
|
|
|
|
fish -c "abbr nano 'micro'"
|
2022-08-09 22:07:01 +02:00
|
|
|
fish -c "abbr bigupdate 'sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y && tldr --update && yes | sdk update && yes | sdk upgrade java'"
|
2022-03-31 00:51:18 +02:00
|
|
|
fish -c "abbr d 'explorer.exe .'"
|
2022-08-03 10:32:10 +02:00
|
|
|
fish -c "abbr gc 'git clone'"
|
2022-04-09 17:44:00 +02:00
|
|
|
fish -c "abbr tlmgr 'sudo \$(which tlmgr)'"
|
2022-08-16 11:59:44 +02:00
|
|
|
fish -c "abbr cl 'cat src/**.* | sed \'/^\s*$/d\' | wc -l'"
|
2022-03-30 19:30:07 +02:00
|
|
|
|
2022-08-04 01:17:56 +02:00
|
|
|
# === Micro ==
|
|
|
|
cd /usr/local/bin || exit
|
|
|
|
curl https://getmic.ro | GETMICRO_PLATFORM=linux64 bash
|
|
|
|
cd - || exit
|
2022-08-03 10:32:10 +02:00
|
|
|
git config --global core.editor "micro"
|
2022-08-04 19:18:43 +02:00
|
|
|
set -Ux EDITOR micro
|
2022-08-03 10:32:10 +02:00
|
|
|
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
|
|
|
|
|
2022-04-04 00:28:40 +02:00
|
|
|
# === GL4D ==
|
2022-08-04 01:17:56 +02:00
|
|
|
# Download, build and installation
|
2022-03-30 19:30:07 +02:00
|
|
|
git clone https://github.com/noalien/GL4Dummies.git
|
|
|
|
cd GL4Dummies || exit
|
|
|
|
make -f Makefile.autotools
|
|
|
|
./configure
|
|
|
|
make
|
2022-08-03 10:32:10 +02:00
|
|
|
make install
|
2022-03-30 19:30:07 +02:00
|
|
|
cd ..
|
|
|
|
rm -rf GL4Dummies
|
|
|
|
# Fix for shared libraries (https://stackoverflow.com/a/9395355)
|
2022-08-03 10:32:10 +02:00
|
|
|
ldconfig
|
2022-03-30 19:30:07 +02:00
|
|
|
# Add to path
|
2022-08-04 01:17:56 +02:00
|
|
|
fish -c "set -Ua LD_LIBRARY_PATH /usr/local/lib"
|
2022-03-30 19:30:07 +02:00
|
|
|
|
2022-04-04 00:28:40 +02:00
|
|
|
# === Latex ==
|
2022-04-09 02:38:09 +02:00
|
|
|
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
|
|
|
|
tar -xzf install-tl-unx.tar.gz
|
2022-04-09 12:28:24 +02:00
|
|
|
rm ./*.tar.gz
|
2022-04-09 02:38:09 +02:00
|
|
|
cd install-tl-* || exit
|
2022-08-03 10:32:10 +02:00
|
|
|
echo "I" | ./install-tl
|
2022-04-09 02:38:09 +02:00
|
|
|
cd ..
|
|
|
|
rm -rf install-tl-*
|
2022-04-09 13:59:12 +02:00
|
|
|
fish -c "fish_add_path /usr/local/texlive/*/bin/x86_64-linux"
|
2022-08-04 01:03:17 +02:00
|
|
|
fish -c "set -Ua MANPATH /usr/local/texlive/*/texmf-dist/doc/man"
|
|
|
|
fish -c "set -Ua INFOPATH /usr/local/texlive/*/texmf-dist/doc/info"
|
2022-03-30 19:30:07 +02:00
|
|
|
|
2022-04-04 00:28:40 +02:00
|
|
|
# === Sign commits ==
|
2022-03-30 19:30:07 +02:00
|
|
|
git config --global commit.gpgsign true
|
|
|
|
|
2022-04-04 00:28:40 +02:00
|
|
|
# === Rust ==
|
2022-03-31 00:10:58 +02:00
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
2022-03-30 19:30:07 +02:00
|
|
|
source "$HOME"/.cargo/env
|
2022-03-31 00:20:02 +02:00
|
|
|
fish -c "set -Up fish_user_paths ~/.cargo/bin"
|
2022-03-30 19:30:07 +02:00
|
|
|
# Dev tools
|
|
|
|
rustup component add rust-analysis
|
|
|
|
rustup component add rls
|
|
|
|
|
2022-08-03 10:39:32 +02:00
|
|
|
# === Exa ==
|
|
|
|
cargo install exa
|
2022-08-04 01:17:56 +02:00
|
|
|
# EXA colors
|
|
|
|
fish -c "set -Ux EXA_COLORS 'di=1;36:da=35'"
|
2022-08-03 10:39:32 +02:00
|
|
|
|
2022-04-04 00:28:40 +02:00
|
|
|
# === tldr ==
|
2022-03-30 19:30:07 +02:00
|
|
|
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
|
|
|
|
|
2022-04-04 00:28:40 +02:00
|
|
|
# === Java ==
|
2022-03-30 19:30:07 +02:00
|
|
|
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
|
2022-08-04 19:29:05 +02:00
|
|
|
sdk install java 17.0.4-tem # https://whichjdk.com/#adoptium-eclipse-temurin
|
2022-08-03 10:32:10 +02:00
|
|
|
yes | sdk upgrade java
|
2022-03-30 19:30:07 +02:00
|
|
|
|
2022-08-03 10:32:10 +02:00
|
|
|
# === Manual color ==
|
|
|
|
fish -c "set -Ux MANPAGER \"sh -c 'col -bx | batcat -l man -p'\""
|
2022-04-18 14:37:13 +02:00
|
|
|
|
2022-04-04 00:28:40 +02:00
|
|
|
# === Shared folders ==
|
2022-08-03 10:32:10 +02:00
|
|
|
mkdir /mnt/z && mkdir /mnt/y
|
2022-04-09 01:49:39 +02:00
|
|
|
|
2022-08-18 12:50:20 +02:00
|
|
|
# === Git ==
|
|
|
|
git config --global pull.rebase true
|
2022-08-21 16:40:20 +02:00
|
|
|
git config --global init.defaultBranch main
|
2022-08-18 12:50:20 +02:00
|
|
|
|
2022-09-29 17:03:11 +02:00
|
|
|
# === Path ==
|
|
|
|
# Add PIP packages from Python to the path
|
|
|
|
fish_add_path /home/anri/.local/bin
|
|
|
|
|
2022-04-11 17:55:26 +02:00
|
|
|
echo -e "\nInstallation terminée !\nIl faut redémarrer WSL (dans Powershell = wsl --shutdown)."
|
2022-03-31 11:10:40 +02:00
|
|
|
echo -e "---\nPense bien à paramétrer ton terminal, exemple avec Windows Terminal :"
|
2022-04-09 17:49:24 +02:00
|
|
|
echo "- Ligne de commande = wsl.exe -d Ubuntu fish"
|
2022-08-03 10:44:25 +02:00
|
|
|
echo "- Profils par défaut => Apparence :"
|
|
|
|
echo " - Jeu de couleur = One Half Dark"
|
|
|
|
echo " - Type de police = CaskaydiaCove Nerd Font (à télécharger ici : https://www.nerdfonts.com/font-downloads)"
|
2022-03-30 19:30:07 +02:00
|
|
|
else
|
2022-04-09 17:49:24 +02:00
|
|
|
echo "Ce script ne fonctionne que sur WSL (Ubuntu)."
|
2022-03-30 19:30:07 +02:00
|
|
|
fi
|