169 lines
7.6 KiB
Bash
169 lines
7.6 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
if grep "WSL" /proc/version > /dev/null;
|
|
then
|
|
sudo apt update
|
|
|
|
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
|
|
|
|
# === Upgrade and clean already installed packages ==
|
|
sudo apt full-upgrade -y
|
|
|
|
# === Basic dev ==
|
|
sudo apt install build-essential valgrind -y
|
|
|
|
# === Fish ==
|
|
sudo apt-add-repository ppa:fish-shell/release-3 -y
|
|
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 full-upgrade -y && tldr --update'"
|
|
fish -c "abbr d 'explorer.exe .'"
|
|
|
|
# === 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 texlive-full python3-pygments -y
|
|
|
|
# === 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 SU password ==
|
|
sudo sed -i "26s#.*#%sudo ALL=(ALL:ALL) NOPASSWD: ALL#" /etc/sudoers
|
|
|
|
# === Update Debian ==
|
|
# sudo sed -i "s/bullseye/bullseye/g" /etc/apt/sources.list
|
|
# sudo sed -i "s/bullseye/bullseye/g" /etc/apt/sources.list.d/*.list
|
|
# Make the update
|
|
# sudo apt update
|
|
# sudo apt full-upgrade -y
|
|
|
|
echo -e "\nInstallation terminée.\nIl faut redémarrer WSL (dans Powershell : wsl -t Debian)."
|
|
echo -e "---\nPense bien à paramétrer ton terminal, exemple avec Windows Terminal :"
|
|
printf "%s\n%s%s%s\n" "Ligne de commande : wsl.exe -d Debian fish" "Répertoire de démarrage : \\" "\wsl.localhost\Debian\home\\" "$USER"
|
|
echo "Jeu de couleur : One Half Dark"
|
|
else
|
|
echo "Ce script ne fonctionne que sur WSL (Debian)."
|
|
fi
|