2022-09-30 03:23:30 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2022-11-06 15:57:25 +01:00
|
|
|
set -o errexit # crash the script when a command crash
|
|
|
|
set -o pipefail # same as above
|
|
|
|
set -o nounset # crash when a variable doesnt exist
|
|
|
|
|
|
|
|
# TRACE=1 for debug
|
|
|
|
if [[ "${TRACE-0}" == "1" ]]; then
|
|
|
|
set -o xtrace
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$(dirname "$0")" # change script directory
|
|
|
|
|
|
|
|
main() {
|
2022-09-30 03:23:30 +02:00
|
|
|
# === Init pacman ==
|
|
|
|
pacman-key --init
|
|
|
|
pacman-key --populate
|
|
|
|
pacman -S archlinux-keyring --noconfirm
|
|
|
|
|
|
|
|
# === Update Arch ==
|
|
|
|
pacman -Syu --noconfirm
|
|
|
|
|
|
|
|
# === Remove packages ==
|
|
|
|
pacman -R --noconfirm fakeroot-tcp
|
|
|
|
|
|
|
|
# === Install packages ==
|
2022-11-15 20:05:20 +01:00
|
|
|
pacman -S --noconfirm git wget zip openssh bat base-devel make \
|
|
|
|
python-pygments micro git-lfs npm sdl2_image nodejs \
|
|
|
|
fish autoconf valgrind automake python-virtualenv gdb \
|
|
|
|
tk sdl2_mixer exa texlive-most fzf glu man-pages-fr \
|
|
|
|
neofetch python-pip opam pacman-contrib cpanminus \
|
2022-11-15 20:58:16 +01:00
|
|
|
unison rebuild-detector git-delta sdl2_ttf
|
2022-09-30 03:23:30 +02:00
|
|
|
|
|
|
|
# === Colors package manager ==
|
2022-10-18 13:57:36 +02:00
|
|
|
sed -i "s/#Color/Color/g" /etc/pacman.conf
|
2022-09-30 03:23:30 +02:00
|
|
|
|
|
|
|
# === Remove SU password ==
|
|
|
|
echo -e "# Disable password for specific user\nanri ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
|
|
|
|
|
|
|
# === Yay ==
|
|
|
|
git clone https://aur.archlinux.org/yay.git
|
|
|
|
cd yay || exit
|
|
|
|
makepkg -si --noconfirm
|
|
|
|
# Remove folder
|
|
|
|
cd ..
|
|
|
|
rm -rf yay
|
|
|
|
# Enable *-git package updates
|
|
|
|
yay -Y --devel --save
|
|
|
|
|
|
|
|
# === AUR packages ==
|
|
|
|
yay -S --noconfirm spim-svn
|
|
|
|
|
|
|
|
# === Rust ==
|
2022-10-18 13:57:36 +02:00
|
|
|
curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
2022-09-30 03:23:30 +02:00
|
|
|
source "$HOME"/.cargo/env
|
|
|
|
# Dev tools
|
|
|
|
rustup component add rust-analysis rls
|
2022-10-18 19:28:31 +02:00
|
|
|
# Add Cargo packages from Rust
|
|
|
|
fish -c "fish_add_path $HOME/.cargo/bin"
|
2022-09-30 03:23:30 +02:00
|
|
|
|
|
|
|
# === Set-up systemd
|
|
|
|
mkdir subsystemctl
|
|
|
|
cd subsystemctl || exit
|
|
|
|
curl -so PKGBUILD https://raw.githubusercontent.com/sorah/arch.sorah.jp/master/aur-sorah/PKGBUILDs/subsystemctl/PKGBUILD
|
|
|
|
makepkg -si --noconfirm
|
|
|
|
cd ..
|
|
|
|
rm -rf tmsubsystemctlp
|
|
|
|
subsystemctl start
|
|
|
|
|
|
|
|
# === Locales ==
|
2022-10-18 13:57:36 +02:00
|
|
|
sed -i "s/#fr_FR.UTF-8 UTF-8/fr_FR.UTF8 UTF-8/g" /etc/locale.gen
|
2022-09-30 03:23:30 +02:00
|
|
|
locale-gen
|
|
|
|
subsystemctl exec sudo localectl set-locale fr_FR.UTF-8
|
|
|
|
|
|
|
|
# === Fish ==
|
|
|
|
# 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"
|
2022-10-18 13:52:10 +02:00
|
|
|
fish -c "fisher install jorgebucaran/autopair.fish"
|
2022-09-30 03:23:30 +02:00
|
|
|
# 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 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
|
|
|
|
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 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"
|
|
|
|
# EXA colors
|
|
|
|
fish -c "set -Ux EXA_COLORS 'di=1;36:da=35'"
|
|
|
|
# Add aliases
|
|
|
|
fish -c "abbr ls 'exa --git --icons -gl'"
|
|
|
|
fish -c "abbr cp 'cp -rv'"
|
|
|
|
fish -c "abbr rm 'rm -rf'"
|
2022-11-13 17:40:41 +01:00
|
|
|
fish -c "abbr mgcc 'clear; gcc -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes -fanalyzer -fsanitize=undefined -g main.c && ./a.out; rm a.out 2> /dev/null'"
|
2022-09-30 03:23:30 +02:00
|
|
|
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-11-13 17:40:41 +01:00
|
|
|
fish -c "abbr mg++ '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'"
|
2022-09-30 03:23:30 +02:00
|
|
|
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-11-13 17:40:41 +01:00
|
|
|
fish -c "abbr mmake 'clear; make && ./main; make clean 2> /dev/null'"
|
2022-09-30 03:23:30 +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'"
|
|
|
|
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 tgz 'tar czf \"Archive.tar.gz\"'"
|
|
|
|
fish -c "abbr - 'cd -'"
|
|
|
|
fish -c "abbr cd.. 'cd ..'"
|
|
|
|
fish -c "abbr cat 'bat'"
|
|
|
|
fish -c "abbr nano 'micro'"
|
2022-10-09 19:13:53 +02:00
|
|
|
fish -c "abbr bigupdate 'yay -Syu --noconfirm && tldr --update && yes | sdk update && yes | sdk upgrade java'"
|
2022-09-30 03:23:30 +02:00
|
|
|
fish -c "abbr d 'explorer.exe .'"
|
|
|
|
fish -c "abbr gc 'git clone'"
|
|
|
|
fish -c "abbr cl 'cat src/**.* | sed \'/^\s*$/d\' | wc -l'"
|
2022-10-01 00:54:28 +02:00
|
|
|
fish -c "abbr mirrors_update \"curl -s 'https://archlinux.org/mirrorlist/?country=FR&country=GB&protocol=https&use_mirror_status=on' | sed -e 's/^#Server/Server/' -e '/^#/d' | sudo bash -c 'rankmirrors -n 7 - > /etc/pacman.d/mirrorlist' && sudo pacman -Syy\""
|
2022-10-11 15:30:37 +02:00
|
|
|
fish -c "abbr ocamlbuild 'ocamlbuild -no-hygiene'"
|
2022-11-04 20:21:49 +01:00
|
|
|
fish -c "abbr opamupdate 'opam update && opam upgrade -y'"
|
2022-11-06 15:12:38 +01:00
|
|
|
fish -c "abbr yay-rebuild 'checkrebuild | awk \'{print \$2}\' | xargs -r yay -S --rebuildtree --noconfirm'"
|
2022-11-06 15:20:42 +01:00
|
|
|
fish -c "abbr pacman-clean 'sudo pacman -Rsn \$(pacman -Qqtd) --noconfirm'"
|
2022-11-15 20:58:16 +01:00
|
|
|
fish -c "abbr diff 'delta'"
|
|
|
|
fish -c "abbr grep 'grep -Irni \'txt\' .'"
|
2022-09-30 03:23:30 +02:00
|
|
|
|
|
|
|
# === Micro configuration ==
|
|
|
|
git config --global core.editor "micro"
|
|
|
|
fish -c "set -Ux EDITOR micro"
|
|
|
|
mkdir "$HOME"/.config/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 ==
|
|
|
|
# Download, build and installation
|
|
|
|
git clone https://github.com/noalien/GL4Dummies.git
|
|
|
|
cd GL4Dummies || exit
|
|
|
|
make -f Makefile.autotools
|
|
|
|
./configure
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
rm -rf GL4Dummies
|
|
|
|
# Fix for shared libraries (https://stackoverflow.com/a/9395355)
|
|
|
|
ldconfig
|
|
|
|
# Add to path
|
2022-11-06 01:00:11 +01:00
|
|
|
fish -c "set -Ua LD_LIBRARY_PATH /usr/local/lib"
|
2022-09-30 03:23:30 +02:00
|
|
|
|
|
|
|
# === Sign commits ==
|
|
|
|
git config --global commit.gpgsign true
|
|
|
|
|
|
|
|
# === tldr ==
|
|
|
|
cargo install tealdeer
|
|
|
|
tldr --update
|
|
|
|
# Fish completion
|
2022-11-06 15:57:25 +01:00
|
|
|
local latest_tldr url_tldr
|
2022-09-30 03:23:30 +02:00
|
|
|
latest_tldr=$(wget -qO- https://api.github.com/repos/dbrgn/tealdeer/releases/latest)
|
2022-10-18 13:57:36 +02:00
|
|
|
url_tldr=$(grep 'browser_download_url": ".*/completions_fish"' <<< "$latest_tldr" | awk "{ print substr ($0, 32 ) }" | awk "{ print substr( $0, 1, length($0)-1 ) }")
|
2022-09-30 03:23:30 +02:00
|
|
|
wget -q --show-progress "$url_tldr" -O completions_fish
|
|
|
|
mv completions_fish ~/.config/fish/completions/tldr.fish
|
|
|
|
|
|
|
|
# === Java ==
|
|
|
|
curl -s "https://get.sdkman.io" | bash
|
|
|
|
source "$HOME/.sdkman/bin/sdkman-init.sh"
|
|
|
|
if [ -x "$HOME"/.config/fish ] ; then
|
|
|
|
if [ ! -f "$HOME"/.config/fish/functions/fisher.fish ] ; then # install fisher if not already installed
|
2022-10-18 13:57:36 +02:00
|
|
|
curl -sL https://git.io/fisher | fish -c "source && fisher install jorgebucaran/fisher"
|
2022-09-30 03:23:30 +02:00
|
|
|
fi
|
2022-10-18 13:57:36 +02:00
|
|
|
fish -c "fisher install reitzig/sdkman-for-fish"
|
2022-09-30 03:23:30 +02:00
|
|
|
fi
|
|
|
|
sdk install java 17.0.4.1-tem # https://whichjdk.com/#adoptium-eclipse-temurin
|
|
|
|
yes | sdk upgrade java
|
|
|
|
|
|
|
|
# === Manual color ==
|
|
|
|
fish -c "set -Ux MANPAGER \"sh -c 'col -bx | bat -l man -p'\""
|
|
|
|
|
|
|
|
# === Shared folders ==
|
|
|
|
mkdir /mnt/y
|
|
|
|
|
|
|
|
# === Git ==
|
2022-11-15 20:58:49 +01:00
|
|
|
wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/dotfiles/.gitconfig -O "$HOME"/.gitconfig
|
2022-09-30 03:23:30 +02:00
|
|
|
|
2022-10-18 19:28:31 +02:00
|
|
|
# === Python ==
|
2022-09-30 13:00:53 +02:00
|
|
|
# Add PIP packages from Python
|
|
|
|
fish -c "fish_add_path $HOME/.local/bin"
|
2022-09-30 03:23:30 +02:00
|
|
|
|
|
|
|
# === OCaml ==
|
|
|
|
# Init Opam and install stuff
|
|
|
|
echo | opam init
|
|
|
|
yes | opam init
|
|
|
|
opam install -y utop ocaml-lsp-server ocamlformat ocamlformat-rpc
|
2022-10-11 17:32:03 +02:00
|
|
|
wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/dotfiles/.ocamlformat -O "$HOME"/.ocamlformat
|
2022-10-18 19:28:31 +02:00
|
|
|
# Add Opam packages from OCaml
|
2022-11-06 14:24:36 +01:00
|
|
|
fish -c "fish_add_path $HOME/.opam/default/bin"
|
2022-11-06 01:17:04 +01:00
|
|
|
# Fix dlllwt_unix_stubs.so shared object file
|
|
|
|
fish -c "set -Ux CAML_LD_LIBRARY_PATH $(opam var stublibs)"
|
2022-09-30 03:23:30 +02:00
|
|
|
|
2022-10-02 01:17:46 +02:00
|
|
|
# === Clang ==
|
|
|
|
wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/dotfiles/.clang-format -O "$HOME"/.clang-format
|
|
|
|
|
2022-10-06 17:37:50 +02:00
|
|
|
# === LaTeX ==
|
|
|
|
# Pour latexindent
|
|
|
|
sudo cpanm YAML::Tiny File::HomeDir
|
|
|
|
|
2022-10-14 17:48:53 +02:00
|
|
|
# === Valgrind ==
|
|
|
|
fish -c "set -Ux DEBUGINFOD_URLS https://debuginfod.archlinux.org"
|
|
|
|
|
2022-10-18 17:41:32 +02:00
|
|
|
# === Unison ==
|
|
|
|
wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/.unison/default.prf -O "$HOME"/.unison/default.prf
|
|
|
|
|
2022-09-30 03:23:30 +02:00
|
|
|
# === Clear useless packages
|
2022-10-14 17:49:08 +02:00
|
|
|
pacman -Rsn "$(pacman -Qqtd)" 2> /dev/null
|
2022-09-30 03:23:30 +02:00
|
|
|
|
|
|
|
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 Arch fish"
|
|
|
|
echo "- Profils par défaut => Apparence :"
|
|
|
|
echo " - Jeu de couleur = One Half Dark"
|
|
|
|
echo " - Type de police = Caskaydia Cove Nerd Font Complete Mono Windows Compatible"
|
|
|
|
echo " (à télécharger ici : https://www.nerdfonts.com/font-downloads)"
|
2022-11-06 15:57:25 +01:00
|
|
|
}
|
2022-09-30 03:23:30 +02:00
|
|
|
|
2022-11-06 15:57:25 +01:00
|
|
|
if grep "WSL2" /proc/version > /dev/null;
|
|
|
|
then
|
|
|
|
main "$@"
|
2022-09-30 03:23:30 +02:00
|
|
|
else
|
2022-11-06 15:57:25 +01:00
|
|
|
echo "Ce script ne fonctionne que sur ArchWSL." >&2
|
2022-09-30 03:23:30 +02:00
|
|
|
fi
|