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
|
2023-03-12 21:05:37 +01:00
|
|
|
set -o pipefail # same as above for piped command
|
2022-11-06 15:57:25 +01:00
|
|
|
set -o nounset # crash when a variable doesnt exist
|
|
|
|
|
|
|
|
# TRACE=1 for debug
|
|
|
|
if [[ "${TRACE-0}" == "1" ]]; then
|
2023-09-13 11:51:35 +02:00
|
|
|
set -o xtrace
|
2022-11-06 15:57:25 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$(dirname "$0")" # change script directory
|
|
|
|
|
|
|
|
main() {
|
2023-09-13 22:37:04 +02:00
|
|
|
# Variables
|
|
|
|
local repo
|
|
|
|
repo=https://git.mylloon.fr/Anri/confOS/raw/branch/main
|
|
|
|
|
2023-09-13 11:51:35 +02:00
|
|
|
# === Init pacman ==
|
|
|
|
sudo pacman-key --init
|
|
|
|
sudo pacman-key --populate
|
|
|
|
sudo pacman -Sy --noconfirm archlinux-keyring
|
|
|
|
|
|
|
|
# === Update Arch mirrors ==
|
|
|
|
sudo pacman -S --noconfirm pacman-contrib
|
|
|
|
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"
|
|
|
|
|
|
|
|
# === Update Arch ==
|
|
|
|
sudo pacman -Syyuu --noconfirm
|
|
|
|
|
|
|
|
# === Install packages ==
|
|
|
|
sudo pacman -S --noconfirm \
|
2023-09-13 22:45:51 +02:00
|
|
|
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 eza fzf glu man-pages-fr uwufetch mdcat python-pip opam \
|
2023-10-23 18:35:24 +02:00
|
|
|
cpanminus unison timidity++ rebuild-detector difftastic sdl2_ttf rustup \
|
2023-11-05 16:57:53 +01:00
|
|
|
libsamplerate rsync doxygen otf-fira-sans ttf-fira-code texlive-binextra \
|
2023-09-13 22:45:51 +02:00
|
|
|
otf-fira-mono mingw-w64-gcc otf-font-awesome soundfont-fluid fluidsynth \
|
|
|
|
pulseaudio-alsa texlive-latexextra texlive-langfrench texlive-luatex \
|
2023-11-05 17:17:03 +01:00
|
|
|
noto-fonts jdk-openjdk
|
2023-09-13 11:51:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
# === Rustup ==
|
|
|
|
# Init rustup
|
|
|
|
rustup default stable
|
|
|
|
# fish_add_path "$HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin"
|
|
|
|
# Dev tools
|
|
|
|
rustup component add rust-analysis rls
|
|
|
|
|
|
|
|
# === Colors package manager ==
|
|
|
|
sudo sed -i "s/#Color/Color/g" /etc/pacman.conf
|
|
|
|
sudo sed -i "s/#ParallelDownloads = 5/ParallelDownloads = 3/g" /etc/pacman.conf
|
|
|
|
|
|
|
|
# === Remove SU password ==
|
|
|
|
echo -e "# Disable password for specific user\nanri ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers > /dev/null
|
|
|
|
|
|
|
|
# === Paru ==
|
|
|
|
git clone https://aur.archlinux.org/paru.git
|
|
|
|
cd paru || exit
|
|
|
|
makepkg -si --noconfirm
|
|
|
|
# Remove folder
|
|
|
|
cd ..
|
|
|
|
rm -rf paru
|
|
|
|
paru --gendb
|
|
|
|
# Clean files used for compilation
|
|
|
|
sudo sed -i "s/#CleanAfter/CleanAfter/g" /etc/paru.conf
|
|
|
|
|
|
|
|
# === AUR packages ==
|
2023-09-13 13:13:26 +02:00
|
|
|
paru -S --noconfirm \
|
2023-11-05 20:24:00 +01:00
|
|
|
otf-font-awesome topgrade-bin cram
|
2023-09-13 11:51:35 +02:00
|
|
|
|
|
|
|
# === Rust ==
|
|
|
|
# Add Cargo packages from Rust
|
|
|
|
mkdir -p "$HOME"/.cargo/bin
|
2023-11-05 21:26:06 +01:00
|
|
|
fish -c "fish_add_path $HOME/.cargo/bin | true"
|
2023-09-13 11:51:35 +02:00
|
|
|
# Add cargo packages
|
|
|
|
cargo install cargo-update cargo-cache
|
|
|
|
|
|
|
|
# === Set-up systemd
|
2023-11-05 21:28:47 +01:00
|
|
|
mkdir -p subsystemctl
|
2023-09-13 11:51:35 +02:00
|
|
|
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 subsystemctl
|
|
|
|
sudo subsystemctl start
|
|
|
|
|
|
|
|
# === Locales ==
|
|
|
|
sudo sed -i "s/#fr_FR.UTF-8 UTF-8/fr_FR.UTF8 UTF-8/g" /etc/locale.gen
|
|
|
|
sudo locale-gen
|
|
|
|
subsystemctl exec sudo localectl set-locale fr_FR.UTF-8
|
|
|
|
|
|
|
|
# === Shared folders ==
|
2023-11-05 21:28:47 +01:00
|
|
|
sudo mkdir -p /mnt/y
|
2023-09-13 11:51:35 +02:00
|
|
|
|
|
|
|
# === 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"
|
|
|
|
fish -c "fisher install jorgebucaran/autopair.fish"
|
|
|
|
# SSH
|
|
|
|
wget -q https://gitlab.com/kyb/fish_ssh_agent/raw/master/functions/fish_ssh_agent.fish -P "$HOME"/.config/fish/functions/
|
2023-11-05 21:28:47 +01:00
|
|
|
mkdir -p "$HOME"/.ssh
|
2023-09-13 11:51:35 +02:00
|
|
|
# Custom config.fish
|
2023-09-13 22:37:04 +02:00
|
|
|
wget -q ${repo}/.config/fish/config_wsl.fish -O "$HOME"/.config/fish/config.fish
|
2023-09-13 13:15:12 +02:00
|
|
|
# Fish theme
|
2023-09-13 13:32:49 +02:00
|
|
|
fish -c "fish_config theme choose 'Base16 Eighties' && yes | fish_config theme save"
|
2023-09-13 21:50:20 +02:00
|
|
|
fish -c "set fish_color_comment 5c6773" # custom comment color
|
2023-09-13 13:15:12 +02:00
|
|
|
# Fish prompt
|
|
|
|
rm "$HOME"/.config/fish/functions/fish_prompt.fish 2> /dev/null
|
2023-09-13 22:37:04 +02:00
|
|
|
wget -q ${repo}/.config/fish/functions/fish_prompt.fish -P "$HOME"/.config/fish/functions/
|
2023-09-13 11:51:35 +02:00
|
|
|
# EZA colors
|
|
|
|
fish -c "set -Ux EXA_COLORS 'di=1;36:da=35'"
|
|
|
|
# Add abbreviations
|
2023-09-13 22:37:04 +02:00
|
|
|
wget -q ${repo}/.config/fish/conf.d/abbr.fish -O "$HOME"/.config/fish/conf.d/abbr.fish
|
|
|
|
curl -s ${repo}/.config/fish/conf.d/abbr_wsl.fish >> "$HOME"/.config/fish/conf.d/abbr.fish
|
2023-09-13 11:51:35 +02:00
|
|
|
# Add aliases
|
2023-09-13 22:37:04 +02:00
|
|
|
wget -q ${repo}/.config/fish/conf.d/alias.fish -O "$HOME"/.config/fish/conf.d/alias.fish
|
2023-09-13 11:51:35 +02:00
|
|
|
|
2023-10-09 17:34:17 +02:00
|
|
|
# === Default editor ==
|
|
|
|
fish -c "set -Ux EDITOR nano"
|
|
|
|
|
2023-09-13 11:51:35 +02:00
|
|
|
# === Micro configuration ==
|
2023-11-05 21:28:47 +01:00
|
|
|
mkdir -p "$HOME"/.config/micro
|
2023-09-13 22:37:04 +02:00
|
|
|
wget -q --show-progress ${repo}/.config/micro/settings.json -O "$HOME"/.config/micro/settings.json
|
2023-09-13 11:51:35 +02:00
|
|
|
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
|
|
|
|
sudo make install
|
|
|
|
cd ..
|
|
|
|
rm -rf GL4Dummies
|
|
|
|
# Fix for shared libraries (https://stackoverflow.com/a/9395355)
|
|
|
|
sudo ldconfig
|
|
|
|
# Add to path
|
|
|
|
fish -c "set -Uax LD_LIBRARY_PATH /usr/local/lib"
|
|
|
|
|
|
|
|
# === tldr ==
|
|
|
|
cargo install tealdeer
|
|
|
|
fish -c "tldr --update"
|
|
|
|
# Fish completion
|
|
|
|
local url_tldr
|
|
|
|
url_tldr=$(curl -s https://api.github.com/repos/dbrgn/tealdeer/releases/latest \
|
|
|
|
| grep 'browser_download_url": ".*/completions_fish"' \
|
|
|
|
| cut --delimiter=":" --field=2,3 \
|
|
|
|
| tr -d \" )
|
|
|
|
wget -q --show-progress "${url_tldr:1}" -O completions_fish
|
|
|
|
mv completions_fish ~/.config/fish/completions/tldr.fish
|
|
|
|
|
|
|
|
# === Manual color ==
|
|
|
|
fish -c "set -Ux MANPAGER \"sh -c 'col -bx | bat -l man -p'\""
|
2023-10-08 18:54:00 +02:00
|
|
|
fish -c "set -Ux MANROFFOPT \"-c\""
|
2023-09-13 11:51:35 +02:00
|
|
|
|
|
|
|
# === Git ==
|
2023-09-13 22:37:04 +02:00
|
|
|
wget -q ${repo}/dotfiles/.gitconfig -O "$HOME"/.gitconfig
|
2023-09-13 11:51:35 +02:00
|
|
|
|
|
|
|
# === Python ==
|
|
|
|
# Add PIP packages from Python
|
2023-11-05 21:28:47 +01:00
|
|
|
mkdir -p "$HOME"/.local/bin
|
2023-11-05 21:26:06 +01:00
|
|
|
fish -c "fish_add_path $HOME/.local/bin | true"
|
2023-09-13 11:51:35 +02:00
|
|
|
|
|
|
|
# === OCaml ==
|
|
|
|
# Init Opam and install stuff
|
|
|
|
echo | opam init
|
|
|
|
fish -c "yes | opam init"
|
2023-10-08 12:47:54 +02:00
|
|
|
opam install -y \
|
|
|
|
utop ocaml-lsp-server ocamlformat ocamlformat-rpc menhir pprint sexplib
|
2023-09-13 22:37:04 +02:00
|
|
|
wget -q ${repo}/dotfiles/.ocamlformat -O "$HOME"/.ocamlformat
|
2023-09-13 11:51:35 +02:00
|
|
|
# Add Opam packages from OCaml
|
|
|
|
mkdir -p "$HOME"/.opam/default/bin
|
2023-11-05 21:26:06 +01:00
|
|
|
fish -c "fish_add_path $HOME/.opam/default/bin | true"
|
2023-09-13 11:51:35 +02:00
|
|
|
# Fix dlllwt_unix_stubs.so shared object file
|
|
|
|
fish -c "set -Ux CAML_LD_LIBRARY_PATH $(opam var stublibs)"
|
|
|
|
|
|
|
|
# === Clang ==
|
2023-09-13 22:37:04 +02:00
|
|
|
wget -q ${repo}/dotfiles/.clang-format -O "$HOME"/.clang-format
|
2023-09-13 11:51:35 +02:00
|
|
|
|
|
|
|
# === Valgrind ==
|
|
|
|
fish -c "set -Ux DEBUGINFOD_URLS https://debuginfod.archlinux.org"
|
|
|
|
|
|
|
|
# === Unison ==
|
2023-11-05 21:28:47 +01:00
|
|
|
mkdir -p "$HOME"/.unison
|
2023-09-13 22:37:04 +02:00
|
|
|
wget -q ${repo}/.unison/default.prf -O "$HOME"/.unison/default.prf
|
2023-09-13 11:51:35 +02:00
|
|
|
|
|
|
|
# === Perl ==
|
|
|
|
# Add perl packages to path
|
2023-11-05 21:26:06 +01:00
|
|
|
fish -c "fish_add_path /usr/bin/vendor_perl | true"
|
2023-09-13 11:51:35 +02:00
|
|
|
|
|
|
|
# === Emacs ==
|
2023-11-05 21:28:47 +01:00
|
|
|
# mkdir -p "$HOME"/.emacs.d
|
|
|
|
# wget -q ${repo}/.emacs.d/init.el -O "$HOME"/.emacs.d/init.el
|
2023-09-13 11:51:35 +02:00
|
|
|
|
|
|
|
# === Bash VSCode fix ==
|
2023-09-13 22:37:04 +02:00
|
|
|
curl -s ${repo}/dotfiles/.bashrc >> "$HOME"/.bashrc
|
2023-09-13 11:51:35 +02:00
|
|
|
|
|
|
|
# === MIDI files ==
|
|
|
|
{
|
|
|
|
echo "soundfont /usr/share/soundfonts/FluidR3_GS.sf2"
|
|
|
|
echo "soundfont /usr/share/soundfonts/FluidR3_GM.sf2"
|
|
|
|
} | sudo tee -a /etc/timidity/timidity.cfg > /dev/null
|
|
|
|
sudo mkdir -p /usr/share/sounds/sf2
|
|
|
|
sudo ln -s /usr/share/soundfonts/*.sf2 /usr/share/sounds/sf2/
|
|
|
|
|
|
|
|
# === Update NPM ==
|
|
|
|
sudo npm i -g npm@latest
|
|
|
|
|
|
|
|
# === Clear useless packages
|
|
|
|
pacman -Qqtd | sudo pacman --noconfirm -Rsn subsystemctl - 2> /dev/null || true
|
|
|
|
|
|
|
|
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
|
2023-09-13 11:51:35 +02:00
|
|
|
main "$@"
|
2022-09-30 03:23:30 +02:00
|
|
|
else
|
2023-09-13 11:51:35 +02:00
|
|
|
echo "Ce script ne fonctionne que sur ArchWSL." >&2
|
2022-09-30 03:23:30 +02:00
|
|
|
fi
|