Update librespeed

This commit is contained in:
tremor021 2025-04-27 01:35:41 +02:00
parent 606940889f
commit 34d5e38b63
2 changed files with 9 additions and 10 deletions

View File

@ -32,13 +32,13 @@ function update_script() {
if [[ ! -f /opt/librespeed/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt//librespeed/${APP}_version.txt)" ]]; then if [[ ! -f /opt/librespeed/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt//librespeed/${APP}_version.txt)" ]]; then
msg_info "Updating $APP..." msg_info "Updating $APP..."
temp_file=$(mktemp) temp_file=$(mktemp)
curl -fsSL "https://github.com/librespeed/speedtest/archive/refs/tags/${RELEASE}.zip" -o $temp_file curl -fsSL "https://github.com/librespeed/speedtest/archive/refs/tags/${RELEASE}.zip" -o "$temp_file"
mkdir -p /temp mkdir -p /temp
unzip -qu $temp_file -d /temp unzip -qu "$temp_file" -d /temp
cd /temp/speedtest-${RELEASE} cd /temp/speedtest-"${RELEASE}"
cp -u favicon.ico index.html speedtest.js speedtest_worker.js /opt/librespeed/ cp -u favicon.ico index.html speedtest.js speedtest_worker.js /opt/librespeed/
cp -ru backend /opt/librespeed/ cp -ru backend /opt/librespeed/
echo "${RELEASE}" >"/opt/librespeed/librespeed_version.txt" echo "${RELEASE}" >/opt/librespeed/"${APP}_version.txt"
systemctl restart caddy systemctl restart caddy
msg_ok "$APP has been updated." msg_ok "$APP has been updated."
else else
@ -54,4 +54,3 @@ msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}" echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"

View File

@ -23,11 +23,11 @@ msg_ok "Installed Dependencies"
msg_info "Installing librespeed" msg_info "Installing librespeed"
temp_file=$(mktemp) 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)}') 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 curl -fsSL "https://github.com/librespeed/speedtest/archive/refs/tags/${RELEASE}.zip" -o "$temp_file"
mkdir -p /opt/librespeed mkdir -p /opt/librespeed
mkdir -p /temp mkdir -p /temp
unzip -q $temp_file -d /temp unzip -q "$temp_file" -d /temp
cd /temp/speedtest-${RELEASE} cd /temp/speedtest-"${RELEASE}"
cp -u favicon.ico index.html speedtest.js speedtest_worker.js /opt/librespeed/ cp -u favicon.ico index.html speedtest.js speedtest_worker.js /opt/librespeed/
cp -ru backend results /opt/librespeed/ cp -ru backend results /opt/librespeed/
@ -40,7 +40,7 @@ cat <<EOF >/etc/caddy/Caddyfile
EOF EOF
systemctl restart caddy systemctl restart caddy
echo "${RELEASE}" >"/opt/librespeed/librespeed_version.txt" echo "${RELEASE}" >/opt/"${APP}_version.txt"
msg_ok "Installation completed" msg_ok "Installation completed"
motd_ssh motd_ssh
@ -48,7 +48,7 @@ customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm -rf /temp rm -rf /temp
rm -f $temp_file rm -f "$temp_file"
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"