1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-03-08 13:19:05 +00:00
ProxmoxVE/install/wastebin-install.sh

69 lines
1.7 KiB
Bash
Raw Normal View History

2024-03-11 15:59:12 +01:00
#!/usr/bin/env bash
2025-03-06 15:33:55 +01:00
# Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (Canbiz)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
2024-03-11 15:59:12 +01:00
# Source: https://github.com/matze/wastebin
2025-03-06 15:33:55 +01:00
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
2024-03-11 15:59:12 +01:00
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
2025-03-06 15:33:55 +01:00
$STD apt-get install -y \
curl \
sudo \
mc
2024-03-11 15:59:12 +01:00
msg_ok "Installed Dependencies"
2024-08-04 17:10:38 -04:00
msg_info "Installing Wastebin"
2025-03-06 15:33:55 +01:00
temp_file=$(mktemp)
2024-03-11 15:59:12 +01:00
RELEASE=$(curl -s https://api.github.com/repos/matze/wastebin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
2025-03-06 15:33:55 +01:00
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
mkdir -p /opt/wastebin
mv wastebin /opt/wastebin/
chmod +x /opt/wastebin/wastebin
2025-03-06 15:33:55 +01:00
mkdir -p /opt/wastebin-data
cat <<EOF >/opt/wastebin-data/.env
WASTEBIN_DATABASE_PATH=/opt/wastebin-data/wastebin.db
WASTEBIN_CACHE_SIZE=1024
WASTEBIN_HTTP_TIMEOUT=30
WASTEBIN_SIGNING_KEY=$(openssl rand -hex 32)
WASTEBIN_PASTE_EXPIRATIONS=0,600,3600=d,86400,604800,2419200,29030400
EOF
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
2024-03-11 15:59:12 +01:00
msg_ok "Installed Wastebin"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/wastebin.service
[Unit]
Description=Start Wastebin Service
After=network.target
[Service]
WorkingDirectory=/opt/wastebin
ExecStart=/opt/wastebin/wastebin
2025-03-06 15:33:55 +01:00
EnvironmentFile=/opt/wastebin-data/.env
2024-03-11 15:59:12 +01:00
[Install]
WantedBy=multi-user.target
EOF
2025-03-06 15:33:55 +01:00
systemctl enable -q --now wastebin
2024-03-11 15:59:12 +01:00
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
2025-03-06 15:33:55 +01:00
rm -f $temp_file
2024-05-02 13:26:16 -04:00
$STD apt-get -y autoremove
$STD apt-get -y autoclean
2024-03-11 15:59:12 +01:00
msg_ok "Cleaned"