confOS/wsl.sh

127 lines
4 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-08-31 15:19:06 +02:00
man-pages bottom maven fakeroot texlive-mathscience texlive-plaingeneric \
2024-10-06 16:04:41 +02:00
qpdf inkscape
# === 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
2024-04-08 20:26:41 +02:00
# === Global OS configuration set-up ==
curl ${repo}/meta.sh -s | bash -s -- ${repo}
# === AUR packages ==
2023-09-13 13:13:26 +02:00
paru -S --noconfirm \
2024-08-31 15:19:10 +02:00
otf-font-awesome storrent-git
# === 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
2024-04-08 21:35:48 +02:00
sudo subsystemctl stop; sudo subsystemctl start # fix weird bug
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
2024-04-15 16:00:05 +02:00
sudo mkdir -p /mnt/z
# === 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
2024-04-08 21:38:19 +02:00
# Specific WSL functions
2024-10-06 21:19:47 +02:00
#wget -q "${repo}"/.config/fish/functions/trash.fish -O "$HOME"/.config/fish/functions/trash.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 ==
2024-04-08 21:57:48 +02:00
fish -c "pacman-clean"
paru --noconfirm -Rsndd \
2024-04-08 21:58:07 +02:00
subsystemctl fakeroot-tcp
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"
2024-07-09 09:05:54 +02:00
echo "- Apparence :"
echo " - Modifier la configuration avec https://git.mylloon.fr/Anri/confOS/wiki/windows-terminal"
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