From 01577008e40c7f74d8df91d3be853f6807b0123b Mon Sep 17 00:00:00 2001 From: 007hacky007 <007hacky007@users.noreply.github.com> Date: Tue, 28 Apr 2026 19:08:12 +0200 Subject: [PATCH] refactor: address MickLesk review feedback Use literal 'Squid' in msg_* labels, add missing msg_ok and spacing in update_script. Replace install_packages_with_retry/enable_and_start_service/ safe_service_restart helpers with plain apt and systemctl commands. Merge auth setup and config validation into a single msg block. Drop the custom /etc/profile.d MOTD heredoc and trailing htpasswd echo. --- ct/squid.sh | 9 +++++---- install/squid-install.sh | 26 ++++++-------------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/ct/squid.sh b/ct/squid.sh index 5a0eeb69..f48fe95c 100644 --- a/ct/squid.sh +++ b/ct/squid.sh @@ -27,17 +27,18 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_info "Updating ${APP}" + msg_info "Updating Squid" $STD apt update $STD apt upgrade -y + msg_ok "Updated Squid" + msg_info "Validating Squid Configuration" $STD squid -k parse msg_ok "Validated Squid Configuration" + msg_info "Restarting Squid" - safe_service_restart "squid" + systemctl restart squid msg_ok "Restarted Squid" - msg_ok "Updated ${APP}" - msg_ok "Updated successfully!" exit } diff --git a/install/squid-install.sh b/install/squid-install.sh index 0d19afe8..aa011082 100644 --- a/install/squid-install.sh +++ b/install/squid-install.sh @@ -67,36 +67,22 @@ EOF msg_ok "Configured Squid" msg_info "Installing Dependencies" -install_packages_with_retry squid apache2-utils +$STD apt install -y \ + squid \ + apache2-utils msg_ok "Installed Dependencies" -msg_info "Preparing Authentication" +msg_info "Configuring Squid Authentication" touch /etc/squid/passwords chown proxy:proxy /etc/squid/passwords chmod 640 /etc/squid/passwords -msg_ok "Initialized Password File" - -msg_info "Validating Squid Configuration" $STD squid -k parse -msg_ok "Validated Squid Configuration" +msg_ok "Configured Squid Authentication" msg_info "Starting Service" -enable_and_start_service "squid" +systemctl enable -q --now squid msg_ok "Started Service" motd_ssh -cat <>/etc/profile.d/00_lxc-details.sh -echo "" -echo -e "${BOLD} Squid Proxy${CL}" -echo -e " Type: ${GN}HTTP Forward Proxy${CL}" -echo -e " Port: ${GN}3128${CL}" -echo "" -echo -e "${BOLD} Configure Authentication:${CL}" -echo -e " Add user: ${GN}htpasswd /etc/squid/passwords ${CL}" -EOF - -msg_info "Configure Proxy Authentication" -echo -e "${TAB}${BGN}Run inside the container: htpasswd /etc/squid/passwords ${CL}" - customize cleanup_lxc