confOS/wsl.sh

121 lines
3.6 KiB
Bash
Raw Normal View History

2022-09-30 03:23:30 +02:00
#!/usr/bin/env bash
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
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
2024-03-30 17:50:32 +01:00
function main {
# === Variables ==
2023-09-13 22:37:04 +02:00
local repo
repo=https://git.mylloon.fr/Anri/confOS/raw/branch/main
# === Init pacman ==
sudo pacman-key --init
sudo pacman-key --populate
sudo pacman -Sy --noconfirm archlinux-keyring
# === 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 \
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-12-11 12:39:17 +01:00
noto-fonts jdk-openjdk texlive-fontsrecommended texlive-publishers sfml \
2024-03-11 09:44:07 +01:00
texlive-fontsextra perl-yaml-tiny perl-file-homedir perl-file-which \
2024-03-25 22:10:31 +01:00
man-pages bottom
# === Global OS configuration set-up ==
# shellcheck disable=SC1091
2024-03-30 17:50:32 +01:00
source meta.sh ${repo}
# === Remove SU password ==
2023-12-19 15:21:51 +01:00
echo -e "\n# Disable password for specific user\n$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers > /dev/null
# === AUR packages ==
2023-09-13 13:13:26 +02:00
paru -S --noconfirm \
otf-font-awesome
# === Set-up systemd ==
2023-11-05 21:28:47 +01:00
mkdir -p 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 ..
2023-11-05 21:32:41 +01:00
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
# === Fish ==
# Custom WSL configuration
2024-03-30 17:50:32 +01:00
curl -s ${repo}/.config/fish/config_wsl.fish >> "$HOME"/.config/fish/config.fish
2023-09-13 22:37:04 +02:00
curl -s ${repo}/.config/fish/conf.d/abbr_wsl.fish >> "$HOME"/.config/fish/conf.d/abbr.fish
2023-11-15 09:58:58 +01:00
curl -s ${repo}/.config/fish/conf.d/alias_wsl.fish >> "$HOME"/.config/fish/conf.d/alias.fish
# === OCaml ==
# Fix dlllwt_unix_stubs.so shared object file
fish -c "set -Ux CAML_LD_LIBRARY_PATH $(opam var stublibs)"
# === 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
# === Bash VSCode fix ==
2023-09-13 22:37:04 +02:00
curl -s ${repo}/dotfiles/.bashrc >> "$HOME"/.bashrc
# === Clear useless packages ==
2023-11-05 21:31:36 +01:00
pacman -Qqtd | sudo pacman --noconfirm -Rsn subsystemctl - 2> /dev/null ||:
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-09-30 03:23:30 +02:00
if grep "WSL2" /proc/version > /dev/null;
then
main "$@"
2022-09-30 03:23:30 +02:00
else
echo "Ce script ne fonctionne que sur ArchWSL." >&2
2022-09-30 03:23:30 +02:00
fi