dotfiles/.install/systemd.sh

50 lines
1.3 KiB
Bash

#!/usr/bin/env bash
#
# SCRIPT NAME:
# systemd.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Copies custom systemd services and enables needed services.
CONFIG_SYSTEMD_SERVICES=(
"acpid.service"
#"bluetooth.service"
"cronie.service"
"docker.service"
"fstrim.timer"
"NetworkManager.service"
"org.cups.cupsd.service"
"pkgstats.timer"
"reflector.timer"
"suspend.service"
"systemd-timesyncd.service"
"tlp.service"
"upower.service"
)
CONFIG_SYSTEMD_USER_SERVICES=(
"syncthing.service"
)
output::section "Copying systemd services"
for service in "${SYSTEM_DIR}/etc/systemd/system/"*; do
output::log "Copying service ${YELLOW}$(basename "${service}")${DEFAULT}"
sudo install -m 644 "${service}" "/etc/systemd/system" |& output::debug
done
output::success "Successfully copied systemd services"
output::section "Enabling systemd services"
for service in "${CONFIG_SYSTEMD_SERVICES[@]}"; do
output::log "Enabling service ${YELLOW}${service}${DEFAULT}"
sudo systemctl enable --now "${service}" |& output::debug
done
for service in "${CONFIG_SYSTEMD_USER_SERVICES[@]}"; do
output::log "Enabling service ${YELLOW}${service}${DEFAULT}"
systemctl --user enable --now "${service}" |& output::debug
done
output::success "Successfully enabled systemd services"