-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwsl.sh
More file actions
66 lines (55 loc) · 2.52 KB
/
wsl.sh
File metadata and controls
66 lines (55 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# I need newer version https://unix.stackexchange.com/a/740124
# https://github.com/fish-shell/fish-shell/blob/bfb32cdbd94644f29a8e4dd156a50e32e4f4c7c2/CHANGELOG.rst#notable-backwards-incompatible-changes
# https://repology.org/project/fish/versions
# TODO: remove this after upgrade to 26.04
sudo add-apt-repository -y ppa:fish-shell/release-4
# Installing software
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive apt upgrade -y
sudo DEBIAN_FRONTEND=noninteractive apt install -y pipx fish tmux jq htop
# Creating bin dir for user binaries
mkdir -p ~/.local/bin
# Installing topgrade
curl -s https://api.github.com/repos/topgrade-rs/topgrade/releases/latest | jq -r ".assets[] | select(.name | test(\"x86_64-unknown-linux-gnu.tar.gz\")) | .browser_download_url" | xargs wget
tar -xzf topgrade*.tar.gz -C ~/.local/bin/
rm topgrade*.tar.gz
# pipx stuff
pipx ensurepath
pipx install internetarchive
# fish & fisher installation
fish -c "curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source; fisher install jorgebucaran/fisher pure-fish/pure"
# No cursor blinking https://github.com/microsoft/terminal/issues/1379#issuecomment-821825557 https://github.com/fish-shell/fish-shell/issues/3741#issuecomment-273209823
tee ~/.config/fish/conf.d/main.fish >/dev/null <<EOF
fish_add_path \$HOME/.local/bin
alias upall 'topgrade --yes --cleanup --only 'system' 'pipx' 'shell' 'self_update''
alias iauploadcheckderive 'ia upload --checksum --verify --retries 50 --no-backup'
alias iauploadfastderive 'ia upload --verify --retries 50 --no-backup'
alias iauploadcheck 'ia upload --checksum --verify --retries 50 --no-backup --no-derive'
alias iauploadfast 'ia upload --verify --retries 50 --no-backup --no-derive'
echo -en "\e[6 q"
EOF
# https://wiki.archlinux.org/title/Tmux#Other_Settings
tee ~/.tmux.conf >/dev/null <<EOF
set -g mouse on
EOF
# https://wiki.archlinux.org/title/Systemd/Journal#Journal_size_limit
# https://github.com/systemd/systemd/issues/17382
sudo mkdir -p /etc/systemd/journald.conf.d
sudo tee /etc/systemd/journald.conf.d/00-journal-size.conf >/dev/null <<EOF
[Journal]
SystemMaxUse=200M
EOF
sudo systemctl daemon-reload
# https://github.com/microsoft/WSL/issues/4071
if grep -q microsoft /proc/version; then
# Disable password for the user
sudo passwd -d "$USER"
# Set user shell to fish
sudo chsh -s "$(which fish)" "$USER"
else
# https://github.com/canonical/multipass/issues/3033
grep -q "exec fish" ~/.bashrc || echo "exec fish" >>~/.bashrc
fi
# Shutdown distro
sudo systemctl poweroff