dev: automated commit - 2025-06-08 23:28:55

This commit is contained in:
Mariano Z. 2025-06-08 23:28:56 -03:00
parent 33106ea4a6
commit 0ab9f62ace
Signed by: marianozunino
GPG key ID: 4C73BAD25156DACE
13 changed files with 1255 additions and 715 deletions

View file

@ -3,103 +3,99 @@
set -euo pipefail
echo "Enabling and configuring system services..."
# Source common functions
source "$(dirname "$0")/../common.sh" || {
echo "[ERROR] Could not source common.sh" >&2
exit 1
}
# ═══════════════════════════════════════════════════════════
# 🌐 NETWORKING SERVICES
# ═══════════════════════════════════════════════════════════
echo "Enabling networking services..."
enable_networking_services() {
log_info "Enabling networking services"
# NetworkManager (main network management)
sudo systemctl enable --now NetworkManager.service
sudo systemctl enable --now NetworkManager.service
sudo systemctl enable --now bluetooth.service
sudo systemctl enable --now sshd.service
}
# Bluetooth
sudo systemctl enable --now bluetooth.service
enable_audio_services() {
log_info "Enabling audio services"
# SSH daemon
sudo systemctl enable --now sshd.service
systemctl --user enable --now pipewire.service
systemctl --user enable --now pipewire-pulse.service
systemctl --user enable --now wireplumber.service
}
# ═══════════════════════════════════════════════════════════
# 🔊 AUDIO SERVICES
# ═══════════════════════════════════════════════════════════
echo "Enabling audio services..."
enable_printing_services() {
log_info "Enabling printing services"
# PipeWire audio (replaces PulseAudio)
systemctl --user enable --now pipewire.service
systemctl --user enable --now pipewire-pulse.service
systemctl --user enable --now wireplumber.service
sudo systemctl enable --now cups.service
}
# ═══════════════════════════════════════════════════════════
# 🖨️ PRINTING SERVICES
# ═══════════════════════════════════════════════════════════
echo "Enabling printing services..."
configure_time_locale() {
log_info "Configuring time and locale services"
# CUPS printing system
sudo systemctl enable --now cups.service
if ! grep -q "en_US.UTF-8 UTF-8" /etc/locale.gen; then
echo "en_US.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
sudo locale-gen
fi
# ═══════════════════════════════════════════════════════════
# ⏰ TIME & SCHEDULING SERVICES
# ═══════════════════════════════════════════════════════════
echo "Configuring time and scheduling services..."
echo "LANG=en_US.UTF-8" | sudo tee /etc/locale.conf
log_info "System locale set to en_US.UTF-8"
echo "en_US.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
sudo locale-gen
sudo timedatectl set-timezone America/Montevideo
sudo timedatectl set-ntp true
sudo systemctl enable --now systemd-timesyncd.service
sudo systemctl enable --now cronie.service
}
# Set system locale
echo "LANG=en_US.UTF-8" | sudo tee /etc/locale.conf
echo "→ System locale set to en_US.UTF-8"
enable_security_services() {
log_info "Enabling security services"
sudo timedatectl set-timezone America/Montevideo
sudo systemctl enable --now ufw.service
sudo ufw --force enable
sudo ufw default deny incoming
sudo ufw default allow outgoing
}
# Enable NTP time synchronization
sudo timedatectl set-ntp true
sudo systemctl enable --now systemd-timesyncd.service
enable_backup_services() {
log_info "Enabling backup services"
# Cron daemon for scheduled tasks
sudo systemctl enable --now cronie.service
if findmnt / -t btrfs &>/dev/null; then
sudo systemctl enable --now snapper-timeline.timer
sudo systemctl enable --now snapper-cleanup.timer
log_info "Snapper enabled (BTRFS detected)"
else
log_info "Skipping Snapper (no BTRFS detected)"
fi
}
# ═══════════════════════════════════════════════════════════
# 🔒 SECURITY & FIREWALL SERVICES
# ═══════════════════════════════════════════════════════════
echo "Enabling security services..."
enable_power_management() {
log_info "Enabling power management"
# UFW firewall
sudo systemctl enable --now ufw.service
sudo systemctl enable --now power-profiles-daemon.service
}
# Enable basic firewall rules
sudo ufw --force enable
sudo ufw default deny incoming
sudo ufw default allow outgoing
enable_system_optimization() {
log_info "Enabling system optimization"
# ═══════════════════════════════════════════════════════════
# 💾 BACKUP & SYNC SERVICES
# ═══════════════════════════════════════════════════════════
echo "Enabling backup services..."
sudo systemctl enable --now haveged.service
sudo systemctl enable --now plocate-updatedb.timer
sudo systemctl enable --now syncthing@forbi.service
}
# Snapper for BTRFS snapshots (if using BTRFS)
if findmnt / -t btrfs &>/dev/null; then
sudo systemctl enable --now snapper-timeline.timer
sudo systemctl enable --now snapper-cleanup.timer
echo "→ Snapper enabled (BTRFS detected)"
else
echo "→ Skipping Snapper (no BTRFS detected)"
fi
main() {
init_script
# ═══════════════════════════════════════════════════════════
# ⚡ POWER MANAGEMENT
# ═══════════════════════════════════════════════════════════
echo "Enabling power management..."
enable_networking_services
enable_audio_services
enable_printing_services
configure_time_locale
enable_security_services
enable_backup_services
enable_power_management
enable_system_optimization
# Power profiles daemon
sudo systemctl enable --now power-profiles-daemon.service
finish_script 0
}
# ═══════════════════════════════════════════════════════════
# 🔧 SYSTEM OPTIMIZATION
# ═══════════════════════════════════════════════════════════
echo "Enabling system optimization..."
# Haveged entropy daemon
sudo systemctl enable --now haveged.service
# Locate database updates
sudo systemctl enable --now plocate-updatedb.timer
main "$@"