mirror of https://github.com/tteck/Proxmox.git
Compare commits
1 Commits
3fa39b1be2
...
581309c84d
Author | SHA1 | Date |
---|---|---|
Rémi Bédard-Couture | 581309c84d |
|
@ -23,8 +23,8 @@ header_info
|
||||||
echo -e "Loading..."
|
echo -e "Loading..."
|
||||||
APP="Wastebin"
|
APP="Wastebin"
|
||||||
var_disk="4"
|
var_disk="4"
|
||||||
var_cpu="1"
|
var_cpu="4"
|
||||||
var_ram="1024"
|
var_ram="2048"
|
||||||
var_os="debian"
|
var_os="debian"
|
||||||
var_version="12"
|
var_version="12"
|
||||||
variables
|
variables
|
||||||
|
@ -58,18 +58,27 @@ function default_settings() {
|
||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
if [[ ! -d /opt/wastebin ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
|
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 (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then
|
||||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
read -r -p "Warning: Storage is dangerously low, continue anyway? <y/N> " prompt
|
||||||
|
[[ ${prompt,,} =~ ^(y|yes)$ ]] || exit
|
||||||
|
fi
|
||||||
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
|
RELEASE=$(curl -s https://api.github.com/repos/matze/wastebin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
tar -xf wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst
|
cd /opt
|
||||||
cp -f wastebin /opt/wastebin/
|
if [ -d wastebin_bak ]; then
|
||||||
chmod +x /opt/wastebin/wastebin
|
rm -rf wastebin_bak
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
fi
|
||||||
|
mv wastebin wastebin_bak
|
||||||
|
wget -q "https://github.com/matze/wastebin/archive/refs/tags/${RELEASE}.zip"
|
||||||
|
unzip -q ${RELEASE}.zip
|
||||||
|
mv wastebin-${RELEASE} /opt/wastebin
|
||||||
|
cd /opt/wastebin
|
||||||
|
cargo update -q
|
||||||
|
cargo build -q --release
|
||||||
msg_ok "Updated Wastebin"
|
msg_ok "Updated Wastebin"
|
||||||
|
|
||||||
msg_info "Starting Wastebin"
|
msg_info "Starting Wastebin"
|
||||||
|
@ -77,12 +86,11 @@ if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_v
|
||||||
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
|
cd /opt
|
||||||
|
rm -R ${RELEASE}.zip
|
||||||
|
rm -R wastebin_bak
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
|
||||||
fi
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +98,10 @@ start
|
||||||
build_container
|
build_container
|
||||||
description
|
description
|
||||||
|
|
||||||
|
msg_info "Setting Container to Normal Resources"
|
||||||
|
pct set $CTID -cores 2
|
||||||
|
msg_ok "Set Container to Normal Resources"
|
||||||
|
|
||||||
msg_ok "Completed Successfully!\n"
|
msg_ok "Completed Successfully!\n"
|
||||||
echo -e "${APP} Setup should be reachable by going to the following URL.
|
echo -e "${APP} Setup should be reachable by going to the following URL.
|
||||||
${BL}http://${IP}:8088${CL} \n"
|
${BL}http://${IP}:8088${CL} \n"
|
||||||
|
|
|
@ -15,20 +15,30 @@ setting_up_container
|
||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies (Patience)"
|
||||||
$STD apt-get install -y curl
|
$STD apt-get install -y --no-install-recommends \
|
||||||
$STD apt-get install -y sudo
|
build-essential \
|
||||||
$STD apt-get install -y mc
|
unzip \
|
||||||
|
curl \
|
||||||
|
sudo \
|
||||||
|
git \
|
||||||
|
make \
|
||||||
|
mc
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Installing Wastebin"
|
msg_info "Installing Rust (Patience)"
|
||||||
|
$STD bash <(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs) -y
|
||||||
|
source ~/.cargo/env
|
||||||
|
msg_ok "Installed Rust"
|
||||||
|
|
||||||
|
msg_info "Installing Wastebin (Patience)"
|
||||||
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.tar.zst
|
wget -q "https://github.com/matze/wastebin/archive/refs/tags/${RELEASE}.zip"
|
||||||
tar -xf wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst
|
unzip -q ${RELEASE}.zip
|
||||||
rm -rf wastebin_${RELEASE}_x86_64-unknown-linux-musl.tar.zst
|
mv wastebin-${RELEASE} /opt/wastebin
|
||||||
mkdir -p /opt/wastebin
|
rm -R ${RELEASE}.zip
|
||||||
mv wastebin /opt/wastebin/
|
cd /opt/wastebin
|
||||||
chmod +x /opt/wastebin/wastebin
|
cargo build -q --release
|
||||||
msg_ok "Installed Wastebin"
|
msg_ok "Installed Wastebin"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
|
@ -38,8 +48,9 @@ Description=Start Wastebin Service
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
User=root
|
||||||
WorkingDirectory=/opt/wastebin
|
WorkingDirectory=/opt/wastebin
|
||||||
ExecStart=/opt/wastebin/wastebin
|
ExecStart=/root/.cargo/bin/cargo run --release --quiet
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
Loading…
Reference in New Issue