From 6ce4a68318c5970245a3d036cb06648a13aff206 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 6 Mar 2025 13:57:45 +0100 Subject: [PATCH] indention --- ct/wastebin.sh | 64 ++++++++++++++++++------------------- install/wastebin-install.sh | 24 +++++++------- 2 files changed, 45 insertions(+), 43 deletions(-) diff --git a/ct/wastebin.sh b/ct/wastebin.sh index 5ea9b7b..2c9af0b 100644 --- a/ct/wastebin.sh +++ b/ct/wastebin.sh @@ -20,39 +20,39 @@ color catch_errors function update_script() { - header_info - check_container_storage - check_container_resources - if [[ ! -d /opt/wastebin ]]; then - msg_error "No ${APP} Installation Found!" + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/wastebin ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/matze/wastebin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Stopping Wastebin" + systemctl stop wastebin + msg_ok "Wastebin Stopped" + + msg_info "Updating Wastebin" + wget -q https://github.com/matze/wastebin/releases/download/${RELEASE}/wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst + tar -xf wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst + cp -f wastebin /opt/wastebin/ + chmod +x /opt/wastebin/wastebin + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated Wastebin" + + msg_info "Starting Wastebin" + systemctl start wastebin + msg_ok "Started Wastebin" + + msg_info "Cleaning Up" + rm -rf wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst + msg_ok "Cleaned" + msg_ok "Updated Successfully" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + fi exit - fi - RELEASE=$(curl -s https://api.github.com/repos/matze/wastebin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') - if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then - msg_info "Stopping Wastebin" - systemctl stop wastebin - msg_ok "Wastebin Stopped" - - msg_info "Updating Wastebin" - wget -q https://github.com/matze/wastebin/releases/download/${RELEASE}/wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst - tar -xf wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst - cp -f wastebin /opt/wastebin/ - chmod +x /opt/wastebin/wastebin - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated Wastebin" - - msg_info "Starting Wastebin" - systemctl start wastebin - msg_ok "Started Wastebin" - - msg_info "Cleaning Up" - rm -rf wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst - msg_ok "Cleaned" - msg_ok "Updated Successfully" - else - msg_ok "No update required. ${APP} is already at v${RELEASE}" - fi - exit } start diff --git a/install/wastebin-install.sh b/install/wastebin-install.sh index 1723941..e901004 100644 --- a/install/wastebin-install.sh +++ b/install/wastebin-install.sh @@ -1,12 +1,11 @@ #!/usr/bin/env bash -# Copyright (c) 2021-2025 tteck -# Author: tteck -# Co-Author: MickLesk (Canbiz) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (Canbiz) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://github.com/matze/wastebin -source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" color verb_ip6 catch_errors @@ -15,19 +14,22 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get install -y curl -$STD apt-get install -y sudo -$STD apt-get install -y mc +$STD apt-get install -y \ + curl \ + sudo \ + mc msg_ok "Installed Dependencies" msg_info "Installing Wastebin" +temp_file=$(mktemp) RELEASE=$(curl -s https://api.github.com/repos/matze/wastebin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') -wget -q https://github.com/matze/wastebin/releases/download/${RELEASE}/wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst -tar -xf wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst -rm -rf wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst +wget -q https://github.com/matze/wastebin/releases/download/${RELEASE}/wastebin_${RELEASE}_x86_64-unknown-linux-musl.zip -O $temp_file +unzip -q $temp_file +rm -rf wastebin_${RELEASE}_x86_64-unknown-linux-musl.zip mkdir -p /opt/wastebin mv wastebin /opt/wastebin/ chmod +x /opt/wastebin/wastebin +echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" msg_ok "Installed Wastebin" msg_info "Creating Service" @@ -43,7 +45,7 @@ ExecStart=/opt/wastebin/wastebin [Install] WantedBy=multi-user.target EOF -systemctl enable -q --now wastebin.service +systemctl enable -q --now wastebin msg_ok "Created Service" motd_ssh