Merge pull request #19 from deadcxap/codex/explain-debian_frontend-setting-and-options

Use noninteractive apt without recommended packages
This commit is contained in:
deadcxap
2025-08-27 11:14:52 +03:00
committed by GitHub
+6 -4
View File
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
LOG_FILE=/var/log/core_setup.log
exec > >(tee -a "$LOG_FILE") 2>&1
@@ -148,7 +150,7 @@ fi
install_packages() {
run "Waiting for apt lock" wait_for_apt
run "Updating package index" apt-get update -y
run "Installing base packages" apt-get install -y sudo curl wget git ufw logrotate unattended-upgrades ca-certificates gnupg lsb-release apt-transport-https jq
run "Installing base packages" apt-get install -y --no-install-recommends sudo curl wget git ufw logrotate unattended-upgrades ca-certificates gnupg lsb-release apt-transport-https jq
}
setup_timezone() {
@@ -232,7 +234,7 @@ configure_ufw() {
install_docker() {
if ! command -v docker >/dev/null 2>&1; then
run "Waiting for apt lock" wait_for_apt
run "Installing Docker" bash -c "install -m 0755 -d /etc/apt/keyrings && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && echo 'deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable' | tee /etc/apt/sources.list.d/docker.list >/dev/null && apt-get update -y && apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
run "Installing Docker" bash -c "install -m 0755 -d /etc/apt/keyrings && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && echo 'deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable' | tee /etc/apt/sources.list.d/docker.list >/dev/null && apt-get update -y && apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
fi
run "Adding $USERNAME to docker group" usermod -aG docker "$USERNAME"
run "Checking Docker service" systemctl is-active --quiet docker
@@ -243,7 +245,7 @@ install_docker() {
configure_fail2ban() {
run "Waiting for apt lock" wait_for_apt
run "Installing fail2ban" apt-get install -y fail2ban
run "Installing fail2ban" apt-get install -y --no-install-recommends fail2ban
run "Configuring fail2ban" bash -c "cat >/etc/fail2ban/jail.local <<'EOF'
[sshd]
enabled = true
@@ -295,7 +297,7 @@ setup_vector() {
[[ -z "$VECTOR_ENDPOINT" ]] && return
if ! command -v vector >/dev/null 2>&1; then
run "Waiting for apt lock" wait_for_apt
run "Installing Vector" bash -c "curl -1sLf 'https://repositories.timber.io/public/vector/cfg/setup/bash.deb.sh' | bash && apt-get install -y vector"
run "Installing Vector" bash -c "curl -1sLf 'https://repositories.timber.io/public/vector/cfg/setup/bash.deb.sh' | bash && apt-get install -y --no-install-recommends vector"
fi
run "Configuring Vector" bash -c "cat >/etc/vector/vector.toml <<'EOF'
[sources.syslog]