Skip to content

Commit

Permalink
Update sys init
Browse files Browse the repository at this point in the history
  • Loading branch information
pmendelski committed Dec 9, 2023
1 parent b5a8c11 commit 9498dac
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 215 deletions.
104 changes: 11 additions & 93 deletions _sysinit/ubuntu-server/packages.sh
Original file line number Diff line number Diff line change
@@ -1,96 +1,14 @@
#!/usr/bin/env bash
set -euf -o pipefail

# Build tools
sudo apt install -y build-essential
sudo apt install -y automake
sudo apt install -y make
sudo apt install -y checkinstall
sudo apt install -y dpatch
sudo apt install -y patchutils
sudo apt install -y autotools-dev
sudo apt install -y debhelper
sudo apt install -y quilt
sudo apt install -y fakeroot
sudo apt install -y xutils
sudo apt install -y lintian
sudo apt install -y cmake
sudo apt install -y dh-make
sudo apt install -y libtool
sudo apt install -y autoconf
sudo apt install -y gcc
sudo apt install -y ninja-build
sudo apt install -y shellcheck

# GIT
sudo add-apt-repository -y "ppa:git-core/ppa"
sudo apt-get update
sudo apt install -y git

# HTTP clients
sudo apt install -y curl
sudo apt install -y httpie

# HTTP utils like dig
sudo apt install -y dnsutils
sudo apt install -y iperf3

# CLI parser
sudo apt install -y jq
sudo snap install yq

# Network
sudo apt install -y apt-transport-https
sudo apt install -y ca-certificates
sudo apt install -y gnupg-agent
sudo apt install -y software-properties-common
sudo apt install -y iptables-persistent

# Docker
sudo apt-get remove -y docker docker-engine docker.io containerd runc
sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
sudo apt -y update
sudo apt install -y docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker "${USER}"
# Docker compose https://docs.docker.com/compose
docker_compose_version="$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep browser_download_url | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)"
sudo curl -L "https://github.com/docker/compose/releases/download/${docker_compose_version}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo curl -L "https://raw.githubusercontent.com/docker/compose/${docker_compose_version}/contrib/completion/bash/docker-compose" -o /etc/bash_completion.d/docker-compose
curl -L "https://raw.githubusercontent.com/docker/compose/${docker_compose_version}/contrib/completion/zsh/_docker-compose" -o ~/.zsh/completion/_docker-compose

# Better terminal
mkdir -p ~/.local/bin
sudo apt install -y zsh
sudo apt install -y tmux
sudo apt install -y tree
sudo apt install -y fzf
sudo apt install -y ripgrep
sudo apt install -y zoxide
sudo apt install -y fd-find
ln -s "$(which fdfind)" ~/.local/bin/fd

# cat with highlighting
sudo apt install -y bat
if command -v batcat &>/dev/null; then
ln -s "$(which batcat)" ~/.local/bin/bat
fi

# Compression tools
sudo apt install -y zip
sudo apt install -y unzip

# Neovim
sudo apt install -y neovim
sudo apt install -y python3-neovim

# Ascii art
# figlet -f slant <Some Text>
sudo apt install -y figlet

# Image manipulation
sudo apt install -y imagemagick
../ubuntu/packages/system.sh
../ubuntu/packages/lang.sh
../ubuntu/packages/docker.sh

echo -e "\n>>> Server network tools"
sudo apt install -y \
apt-transport-https \
ca-certificates \
gnupg-agent \
software-properties-common \
iptables-persistent
2 changes: 2 additions & 0 deletions _sysinit/ubuntu/packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set -euf -o pipefail

./packages/system.sh
./packages/lang.sh
./packages/cloud.sh
./packages/docker.sh
./packages/system-gui.sh
./packages/media.sh
Expand Down
30 changes: 30 additions & 0 deletions _sysinit/ubuntu/packages/cloud.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -e

echo ""
echo ">>>"
echo ">>> CLOUD"
echo ">>>"

echo -e ">>> gcloud"
if [ ! -d "$HOME/.gcloud" ]; then
GCLOUD_VERSION="$(
curl -s "https://hub.docker.com/v2/repositories/google/cloud-sdk/tags/?page_size=1000" |
jq '.results | .[] | .name' -r |
sed 's/latest//' |
grep -E "^[0-9]+.[0-9]+.[0-9]+$" |
sort --version-sort |
tail -n 1
)"
echo "Downloading gcloud v$GCLOUD_VERSION"
cd "$(mktemp -d -t gcloud-XXX)" &&
wget -O "gcloud.tar.gz" "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-$GCLOUD_VERSION-linux-$(uname -m).tar.gz" &&
echo "Extracting gcloud v$GCLOUD_VERSION..." &&
tar -xf "gcloud.tar.gz" &&
mv ./google-cloud-sdk "$HOME/.gcloud" &&
cd "$HOME/.gcloud" &&
./install.sh --usage-reporting false --install-python false --command-completion false --path-update false
gcloud components install alpha
gcloud components install beta
gcloud components install cloud-run-proxy
fi
20 changes: 20 additions & 0 deletions _sysinit/ubuntu/packages/lang.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -e

echo ""
echo ">>>"
echo ">>> LANG"
echo ">>>"

echo -e "\n>>> Rust"
if ! command -v rustup &>/dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH="$PATH:~/.cargo/bin"
fi

# echo -e "\n>>> Haskell"
# curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org |
# BOOTSTRAP_HASKELL_INSTALL_STACK=1 BOOTSTRAP_HASKELL_INSTALL_HLS=1 BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh

echo -e "\n>>> Linters"
sudo apt intall -y yamllint
18 changes: 15 additions & 3 deletions _sysinit/ubuntu/packages/system-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ echo ">>>"
echo ">>> SYSTEM GUI"
echo ">>>"

echo -e "\n>>> Conky"
sudo apt-get install -y conky conky-all

echo -e "\n>>> Password manager"
sudo snap install keepassxc

Expand Down Expand Up @@ -107,3 +104,18 @@ echo "deb [trusted=yes arch=amd64] https://download.konghq.com/insomnia-ubuntu/
sudo tee -a /etc/apt/sources.list.d/insomnia.list
sudo apt-get update
sudo apt-get install insomnia

# Install gogh - theme switcher for terminal
echo -e "\n>>> Gogh"
if [ ! -d "$HOME/.gogh" ]; then
cd "$HOME"
git clone https://github.com/Mayccoll/Gogh.git .gogh
cd .gogh/install
export TERMINAL=gnome-terminal
./tokyo-night.sh
cd
fi

echo -e "\n>>> Others"
# GUI for GnuPG
sudo apt install -y seahorse seahorse-nautilus
Loading

0 comments on commit 9498dac

Please sign in to comment.