mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-25 05:57:26 +00:00
changed rejects from pr review
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
# License: MIT | https://github.com/GoldenSpringness/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://github.com/orhun/rustypaste
|
||||
|
||||
# Import Functions und Setup
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
@@ -25,51 +24,40 @@ msg_ok "Dependencies Installed Successfully"
|
||||
|
||||
RUST_VERSION="1.92.0" setup_rust
|
||||
|
||||
msg_info "Setting up ${APPLICATION}"
|
||||
# Getting the latest release version
|
||||
RELEASE=$(curl -s https://api.github.com/repos/orhun/rustypaste/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
cd /opt
|
||||
git clone https://github.com/orhun/rustypaste.git
|
||||
msg_info "Setting up rustypaste"
|
||||
|
||||
if [[ ! -d "/opt/${APPLICATION}" ]]; then
|
||||
msg_error "Git clone has failed"
|
||||
exit
|
||||
fi
|
||||
fetch_and_deploy_gh_release "rustypaste" "orhun/rustypaste" "tarball" "latest" "/opt/rustypaste"
|
||||
|
||||
cd ${APPLICATION}
|
||||
git fetch --tags
|
||||
git switch --detach ${RELEASE} # checking out to latest release
|
||||
cd /opt/rustypaste
|
||||
|
||||
sed -i 's|^address = ".*"|address = "0.0.0.0:8000"|' config.toml # changing the ip and port
|
||||
sed -i 's|^address = ".*"|address = "0.0.0.0:8000"|' config.toml
|
||||
|
||||
msg_info "Compiling ${APPLICATION}"
|
||||
cargo build --locked --release # creating the binary
|
||||
msg_info "Compiling rustypaste"
|
||||
cargo build --locked --release
|
||||
|
||||
if [[ ! -f "/opt/${APPLICATION}/target/release/rustypaste" ]]; then
|
||||
if [[ ! -f "/opt/rustypaste/target/release/rustypaste" ]]; then
|
||||
msg_error "Cargo build failed"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt # creating version file for the update function
|
||||
msg_ok "Setting up ${APPLICATION} is Done!"
|
||||
msg_ok "Setting up rustypaste is Done!"
|
||||
|
||||
# Creating Service (if needed)
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/${APPLICATION}.service
|
||||
cat <<EOF >/etc/systemd/system/rustypaste.service
|
||||
[Unit]
|
||||
Description=${APPLICATION} Service
|
||||
Description=rustypaste Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/rustypaste
|
||||
ExecStart=/opt/${APPLICATION}/target/release/rustypaste
|
||||
ExecStart=/opt/rustypaste/target/release/rustypaste
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl enable -q --now ${APPLICATION}.service
|
||||
systemctl enable -q --now rustypaste.service
|
||||
msg_ok "Created Service"
|
||||
|
||||
msg_ok "RustyPaste is Running!"
|
||||
@@ -77,7 +65,6 @@ msg_ok "RustyPaste is Running!"
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
# Cleanup
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
|
||||
Reference in New Issue
Block a user