From 476fdbdd4237122e7d101ea4b56d5ad780540c19 Mon Sep 17 00:00:00 2001 From: elvito Date: Sat, 26 Apr 2025 11:01:13 +0200 Subject: [PATCH] Update librespeed-install.sh --- install/librespeed-install.sh | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/install/librespeed-install.sh b/install/librespeed-install.sh index 8b13789..ab1ec6c 100644 --- a/install/librespeed-install.sh +++ b/install/librespeed-install.sh @@ -1 +1,56 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: elvito +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/librespeed/speedtest + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get update +$STD apt-get install -y \ + caddy \ + php-fpm +msg_ok "Installed Dependencies" + +msg_info "Installing librespeed" +temp_file=$(mktemp) +RELEASE=$(curl -fsSL https://api.github.com/repos/librespeed/speedtest/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}') +curl -fsSL "https://github.com/librespeed/speedtest/archive/refs/tags/${RELEASE}.zip" -o $temp_file +mkdir -p /opt/librespeed +mkdir -p /temp +unzip -q $temp_file -d /temp +cd /temp/speedtest-${RELEASE} +cp -u favicon.ico index.html speedtest.js speedtest_worker.js /opt/librespeed/ +cp -ru backend results /opt/librespeed/ +echo "${RELEASE}" >"/opt/librespeed/librespeed_version.txt" +msg_ok "Installation completed" + +msg_info "Creating Caddyfile" +cat </etc/caddy/Caddyfile +:80 { + root * /opt/librespeed + file_server + php_fastcgi unix//run/php/php-fpm.sock +} +EOF +systemctl restart caddy +msg_ok "Caddyfile created" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf /temp +rm -f $temp_file +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"