This commit is contained in:
CanbiZ 2025-03-06 14:04:05 +01:00
parent 78579650e6
commit 5b834bd5ff
3 changed files with 12 additions and 6 deletions

View File

@ -57,7 +57,7 @@ function update_script() {
msg_info "Cleaning Up" msg_info "Cleaning Up"
rm -f $temp_file rm -f $temp_file
msg_ok "Cleanup Completed" msg_ok "Cleanup Completed"
msg_ok "Updated Successfully"
else else
msg_ok "No update required. ${APP} is already at ${RELEASE}" msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi fi

View File

@ -28,14 +28,20 @@ function update_script() {
exit exit
fi fi
RELEASE=$(curl -s https://api.github.com/repos/matze/wastebin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -s https://api.github.com/repos/matze/wastebin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
# Dirty-Fix 03/2025 for missing APP_version.txt on old installations, set to pre-latest release
if [[ ! -f /opt/${APP}_version.txt ]]; then
echo "2.7.1" >/opt/${APP}_version.txt
fi
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping Wastebin" msg_info "Stopping Wastebin"
systemctl stop wastebin systemctl stop wastebin
msg_ok "Wastebin Stopped" msg_ok "Wastebin Stopped"
msg_info "Updating Wastebin" msg_info "Updating Wastebin"
wget -q https://github.com/matze/wastebin/releases/download/${RELEASE}/wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst temp_file=$(mktemp)
tar -xf wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst 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.zip -O $temp_file
unzip -q $temp_file
cp -f wastebin /opt/wastebin/ cp -f wastebin /opt/wastebin/
chmod +x /opt/wastebin/wastebin chmod +x /opt/wastebin/wastebin
echo "${RELEASE}" >/opt/${APP}_version.txt echo "${RELEASE}" >/opt/${APP}_version.txt
@ -46,8 +52,8 @@ function update_script() {
msg_ok "Started Wastebin" msg_ok "Started Wastebin"
msg_info "Cleaning Up" msg_info "Cleaning Up"
rm -rf wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst rm -f $temp_file
msg_ok "Cleaned" msg_ok "Cleanup Completed"
msg_ok "Updated Successfully" msg_ok "Updated Successfully"
else else
msg_ok "No update required. ${APP} is already at v${RELEASE}" msg_ok "No update required. ${APP} is already at v${RELEASE}"

View File

@ -25,7 +25,6 @@ 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) }') 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.zip -O $temp_file 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 unzip -q $temp_file
rm -rf wastebin_${RELEASE}_x86_64-unknown-linux-musl.zip
mkdir -p /opt/wastebin mkdir -p /opt/wastebin
mv wastebin /opt/wastebin/ mv wastebin /opt/wastebin/
chmod +x /opt/wastebin/wastebin chmod +x /opt/wastebin/wastebin
@ -52,6 +51,7 @@ motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
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"