mirror of
https://github.com/deadcxap/init_scripts.git
synced 2026-07-02 05:43:40 +03:00
chore: run apt non-interactively without recommends
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
LOG_FILE=/var/log/core_setup.log
|
LOG_FILE=/var/log/core_setup.log
|
||||||
exec > >(tee -a "$LOG_FILE") 2>&1
|
exec > >(tee -a "$LOG_FILE") 2>&1
|
||||||
|
|
||||||
@@ -133,7 +135,7 @@ fi
|
|||||||
install_packages() {
|
install_packages() {
|
||||||
run "Waiting for apt lock" wait_for_apt
|
run "Waiting for apt lock" wait_for_apt
|
||||||
run "Updating package index" apt-get update -y
|
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() {
|
setup_timezone() {
|
||||||
@@ -217,7 +219,7 @@ configure_ufw() {
|
|||||||
install_docker() {
|
install_docker() {
|
||||||
if ! command -v docker >/dev/null 2>&1; then
|
if ! command -v docker >/dev/null 2>&1; then
|
||||||
run "Waiting for apt lock" wait_for_apt
|
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
|
fi
|
||||||
run "Adding $USERNAME to docker group" usermod -aG docker "$USERNAME"
|
run "Adding $USERNAME to docker group" usermod -aG docker "$USERNAME"
|
||||||
run "Checking Docker service" systemctl is-active --quiet docker
|
run "Checking Docker service" systemctl is-active --quiet docker
|
||||||
@@ -228,7 +230,7 @@ install_docker() {
|
|||||||
|
|
||||||
configure_fail2ban() {
|
configure_fail2ban() {
|
||||||
run "Waiting for apt lock" wait_for_apt
|
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'
|
run "Configuring fail2ban" bash -c "cat >/etc/fail2ban/jail.local <<'EOF'
|
||||||
[sshd]
|
[sshd]
|
||||||
enabled = true
|
enabled = true
|
||||||
@@ -280,7 +282,7 @@ setup_vector() {
|
|||||||
[[ -z "$VECTOR_ENDPOINT" ]] && return
|
[[ -z "$VECTOR_ENDPOINT" ]] && return
|
||||||
if ! command -v vector >/dev/null 2>&1; then
|
if ! command -v vector >/dev/null 2>&1; then
|
||||||
run "Waiting for apt lock" wait_for_apt
|
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
|
fi
|
||||||
run "Configuring Vector" bash -c "cat >/etc/vector/vector.toml <<'EOF'
|
run "Configuring Vector" bash -c "cat >/etc/vector/vector.toml <<'EOF'
|
||||||
[sources.syslog]
|
[sources.syslog]
|
||||||
|
|||||||
Reference in New Issue
Block a user