now it works

This commit is contained in:
Mylloon 2023-03-12 21:05:37 +01:00
parent 5723804a75
commit 8f4402700e
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -o errexit # crash the script when a command crash
set -o pipefail # same as above
set -o pipefail # same as above for piped command
set -o nounset # crash when a variable doesnt exist
# TRACE=1 for debug
@ -15,25 +15,30 @@ main() {
# === Init pacman ==
sudo pacman-key --init
sudo pacman-key --populate
sudo pacman -Sy archlinux-keyring --noconfirm
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 -Syu --noconfirm
sudo pacman -Syyuu --noconfirm
# === Install packages ==
sudo 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 \
uwufetch python-pip opam pacman-contrib cpanminus \
unison rebuild-detector git-delta sdl2_ttf rustup
uwufetch python-pip opam cpanminus unison \
rebuild-detector git-delta sdl2_ttf rustup
# === Colors package manager ==
sed -i "s/#Color/Color/g" /etc/pacman.conf
sed -i "s/#ParallelDownloads = 5/ParallelDownloads = 3/g" /etc/pacman.conf
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" >> /etc/sudoers
echo -e "# Disable password for specific user\nanri ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers > /dev/null
# === Yay ==
git clone https://aur.archlinux.org/yay.git
@ -46,12 +51,14 @@ main() {
yay -Y --devel --save
# === AUR packages ==
yay -S --noconfirm spim-svn
yay -S --noconfirm spim-svn cal8tor
# === Rust ==
# Dev tools
rustup default stable
rustup component add rust-analysis rls
# Add Cargo packages from Rust
mkdir -p "$HOME"/.cargo/bin
fish -c "fish_add_path $HOME/.cargo/bin"
# === Set-up systemd
@ -60,14 +67,17 @@ main() {
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
rm -rf subsystemctl
sudo subsystemctl start
# === Locales ==
sed -i "s/#fr_FR.UTF-8 UTF-8/fr_FR.UTF8 UTF-8/g" /etc/locale.gen
locale-gen
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 ==
sudo mkdir /mnt/y
# === Fish ==
# Remove motd
fish -c "set -U fish_greeting"
@ -76,7 +86,6 @@ main() {
fish -c "fisher install jethrokuan/fzf"
fish -c "fisher install jorgebucaran/autopair.fish"
# 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
@ -84,7 +93,6 @@ main() {
wget -q https://git.mylloon.fr/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.mylloon.fr/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"
@ -167,11 +175,11 @@ main() {
make -f Makefile.autotools
./configure
make
make install
sudo make install
cd ..
rm -rf GL4Dummies
# Fix for shared libraries (https://stackoverflow.com/a/9395355)
ldconfig
sudo ldconfig
# Add to path
fish -c "set -Ua LD_LIBRARY_PATH /usr/local/lib"
@ -180,16 +188,21 @@ main() {
# === tldr ==
cargo install tealdeer
tldr --update
fish -c "tldr --update"
# Fish completion
local latest_tldr url_tldr
latest_tldr=$(wget -qO- https://api.github.com/repos/dbrgn/tealdeer/releases/latest)
url_tldr=$(grep 'browser_download_url": ".*/completions_fish"' <<< "$latest_tldr" | awk "{ print substr ($0, 32 ) }" | awk "{ print substr( $0, 1, length($0)-1 ) }")
wget -q --show-progress "$url_tldr" -O completions_fish
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
# === Java ==
curl -s "https://get.sdkman.io" | bash
# temp disable nounset for SDK
set +o nounset
# shellcheck source=/dev/null
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
@ -198,14 +211,12 @@ main() {
fish -c "fisher install reitzig/sdkman-for-fish"
fi
sdk install java 17.0.4.1-tem # https://whichjdk.com/#adoptium-eclipse-temurin
yes | sdk upgrade java
# renable nounset
set -o nounset
# === Manual color ==
fish -c "set -Ux MANPAGER \"sh -c 'col -bx | bat -l man -p'\""
# === Shared folders ==
mkdir /mnt/y
# === Git ==
wget -q https://git.mylloon.fr/Anri/confOS/raw/branch/main/dotfiles/.gitconfig -O "$HOME"/.gitconfig
@ -216,10 +227,11 @@ main() {
# === OCaml ==
# Init Opam and install stuff
echo | opam init
yes | opam init
fish -c "yes | opam init"
opam install -y utop ocaml-lsp-server ocamlformat ocamlformat-rpc menhir
wget -q https://git.mylloon.fr/Anri/confOS/raw/branch/main/dotfiles/.ocamlformat -O "$HOME"/.ocamlformat
# Add Opam packages from OCaml
mkdir -p "$HOME"/.opam/default/bin
fish -c "fish_add_path $HOME/.opam/default/bin"
# Fix dlllwt_unix_stubs.so shared object file
fish -c "set -Ux CAML_LD_LIBRARY_PATH $(opam var stublibs)"
@ -235,10 +247,11 @@ main() {
fish -c "set -Ux DEBUGINFOD_URLS https://debuginfod.archlinux.org"
# === Unison ==
mkdir "$HOME"/.unison
wget -q https://git.mylloon.fr/Anri/confOS/raw/branch/main/.unison/default.prf -O "$HOME"/.unison/default.prf
# === Clear useless packages
sudo pacman -Rsn "$(pacman -Qqtd)" fakeroot-tcp 2> /dev/null
pacman -Qqtd | sudo pacman --noconfirm -Rsn - 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 :"