|
#!/usr/bin/env sh |
|
|
|
set -ue |
|
|
|
# Update and install required software. |
|
# |
|
sudo bash -c 'apt update; apt upgrade -y' |
|
sudo apt install git vim zsh build-essential curl rtx |
|
|
|
# Change defaults. |
|
# |
|
sudo update-alternatives --set editor `which vim.basic` |
|
# sudo sed -ei 's/(%sudo.+)ALL/\1NOPASSWD:ALL/' /etc/sudoers # UNTESTED! |
|
|
|
# Install Docker. |
|
# |
|
sudo apt-get update |
|
sudo apt-get install ca-certificates curl gnupg |
|
sudo install -m 0755 -d /etc/apt/keyrings |
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg |
|
sudo chmod a+r /etc/apt/keyrings/docker.gpg |
|
echo \ |
|
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ |
|
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ |
|
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
|
sudo apt-get update |
|
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
|
|
|
# Setup vim. |
|
# https://github.com/amix/vimrc |
|
# |
|
if ! test -d "$HOME/.vim_runtime"; then |
|
git clone --depth=1 https://github.com/amix/vimrc.git "$HOME/.vim_runtime" |
|
sh ~/.vim_runtime/install_basic_vimrc.sh |
|
fi |
|
|
|
# Setup tmux. |
|
# https://github.com/gpakosz/.tmux |
|
# |
|
if ! test -d "$HOME/.tmux"; then |
|
git clone https://github.com/gpakosz/.tmux.git "$HOME/.tmux" |
|
ln -s -f "$HOME/.tmux/.tmux.conf" "$HOME/" |
|
cp "$HOME/.tmux/.tmux.conf.local" "$HOME/" |
|
fi |
|
|
|
# Setup zsh and zprezto. |
|
# https://github.com/sorin-ionescu/prezto |
|
# |
|
if ! test -d "$HOME/.zprezto"; then |
|
which zsh || sudo apt-get install -y zsh |
|
git clone --recursive https://github.com/sorin-ionescu/prezto.git "$HOME/.zprezto" |
|
zsh -s <<-EOF |
|
setopt EXTENDED_GLOB |
|
for rcfile in $HOME/.zprezto/runcoms/^README.md(.N); do |
|
ln -s \$rcfile $HOME/.\${rcfile:t} |
|
done |
|
EOF |
|
sed -i "s/ 'prompt'/ 'syntax-highlighting' 'history-substring-search'/" "$HOME/.zpreztorc" |
|
sed -i "s/\(zstyle ':prezto:module:prompt' theme\)/#\1/" "$HOME/.zpreztorc" |
|
cat .zshrc >> ~/.zshrc |
|
chsh -s "$(which zsh)" "$(id -un)" |
|
fi |
|
|
|
# Setup prompt. |
|
# https://starship.rs/ |
|
# |
|
if ! test -f "$HOME/.config/starship.toml"; then |
|
curl -sS https://starship.rs/install.sh | sh |
|
mkdir "$HOME/.config" |
|
cp starship.toml "$HOME/.config/starship.toml" |
|
fi |
|
|
|
# Copy wsl.conf |
|
# |
|
sudo cp wsl.conf /etc/ |