From 5fb4aeeab7487955d0c03776fd9f44b2b3b924a9 Mon Sep 17 00:00:00 2001 From: Severin Kaderli Date: Sun, 15 Jan 2023 00:56:18 +0100 Subject: [PATCH] Use reflector timer Signed-off-by: Severin Kaderli --- .install/etc.sh | 2 +- .install/systemd.sh | 25 +++++++++++++------------ system/etc/cron.daily/update-mirror | 19 ------------------- system/etc/xdg/reflector/reflector.conf | 5 +++++ 4 files changed, 19 insertions(+), 32 deletions(-) delete mode 100644 system/etc/cron.daily/update-mirror create mode 100644 system/etc/xdg/reflector/reflector.conf diff --git a/.install/etc.sh b/.install/etc.sh index 42ea757..ab36f7e 100644 --- a/.install/etc.sh +++ b/.install/etc.sh @@ -11,7 +11,6 @@ declare -A CONFIG_ETC_FILES CONFIG_ETC_FILES=( - ["/etc/cron.daily/update-mirror"]="755" ["/etc/default/tlp"]="644" ["/etc/docker/daemon.json"]="644" ["/etc/gemrc"]="644" @@ -31,6 +30,7 @@ CONFIG_ETC_FILES=( ["/etc/sysctl.d/99-sysctl.conf"]="644" ["/etc/bluetooth/main.conf"]="644" ["/etc/modprobe.d/hid_apple.conf"]="644" + ["/etc/xdg/reflector/reflector.conf"]="644" ) output::section "Copying /etc files" diff --git a/.install/systemd.sh b/.install/systemd.sh index 7d532db..d59c778 100644 --- a/.install/systemd.sh +++ b/.install/systemd.sh @@ -10,17 +10,18 @@ # Copies custom systemd services and enables needed services. CONFIG_SYSTEMD_SERVICES=( - "acpid" - "bluetooth" - "cronie" - "docker" - "NetworkManager" - "org.cups.cupsd" + "acpid.service" + "bluetooth.service" + "cronie.service" + "docker.service" + "NetworkManager.service" + "org.cups.cupsd.service" "pkgstats.timer" - "suspend" - "systemd-timesyncd" - "tlp" - "upower" + "reflector.timer" + "suspend.service" + "systemd-timesyncd.service" + "tlp.service" + "upower.service" ) CONFIG_SYSTEMD_USER_SERVICES=() @@ -36,11 +37,11 @@ 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 "${service}" |& output::debug + 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 "${service}" |& output::debug done -output::success "Successfully enabled systemd services" \ No newline at end of file +output::success "Successfully enabled systemd services" diff --git a/system/etc/cron.daily/update-mirror b/system/etc/cron.daily/update-mirror deleted file mode 100644 index 0dd0bce..0000000 --- a/system/etc/cron.daily/update-mirror +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -# -# SCRIPT NAME: -# update-mirror -# -# AUTHOR: -# Severin Kaderli -# -# DESCRIPTION: -# Updates pacman mirror list using reflector -# -# USAGE: -# ./update-mirror -. /home/severin/.local/bin/utils - -{ - print_time_log "update-mirror" "Update pacman mirror list" - reflector --country Switzerland --age 12 --protocol https --sort rate --save /etc/pacman.d/mirrorlist -} >> /home/severin/.local/log/cron.log 2>&1 \ No newline at end of file diff --git a/system/etc/xdg/reflector/reflector.conf b/system/etc/xdg/reflector/reflector.conf new file mode 100644 index 0000000..c4657ec --- /dev/null +++ b/system/etc/xdg/reflector/reflector.conf @@ -0,0 +1,5 @@ +--save /etc/pacman.d/mirrorlist +--country Switzerland +--age 12 +--protocol https +--sort rate