ProxmoxVE/install/opengist-install.sh

66 lines
1.5 KiB
Bash
Raw Normal View History

2025-01-11 04:48:52 +00:00
#!/usr/bin/env bash
2025-01-11 06:20:03 +00:00
# Copyright (c) 2021-2025 community-scripts ORG
2025-01-11 04:48:52 +00:00
# Author: Jonathan (jd-apprentice)
2025-01-13 14:00:30 +00:00
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
2025-01-11 04:48:52 +00:00
2025-01-11 21:17:34 +00:00
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
2025-01-11 04:48:52 +00:00
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
2025-01-13 14:00:30 +00:00
$STD apt-get install -y \
mc \
curl \
sudo \
git
2025-01-11 04:48:52 +00:00
msg_ok "Installed Dependencies"
msg_info "Download Opengist Binary"
2025-01-13 14:00:30 +00:00
RELEASE_URL=$(
curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | grep "linux-amd64.tar.gz" | grep "browser_download_url" | awk -F '"' '{print $4}'
)
wget -q "$RELEASE_URL"
2025-01-11 04:48:52 +00:00
msg_ok "Downloaded Opengist Binary"
msg_info "Creating Systemd Service"
2025-01-11 05:39:33 +00:00
mkdir -p /opt/opengist
2025-01-11 04:48:52 +00:00
mv opengist*.tar.gz opengist.tar.gz
tar -xf opengist.tar.gz
2025-01-11 05:39:33 +00:00
mv opengist/opengist /opt/opengist/opengist
mv opengist/config.yml /opt/opengist/config.yml
2025-01-11 21:17:34 +00:00
chmod +x /opt/opengist/opengist
2025-01-11 05:39:33 +00:00
rm -rf opengist*
2025-01-11 04:48:52 +00:00
cat <<EOF >/etc/systemd/system/opengist.service
[Unit]
Description=Opengist server to manage your Gists
2025-01-11 05:39:33 +00:00
After=network.target
2025-01-11 04:48:52 +00:00
[Service]
WorkingDirectory=/opt/opengist
2025-01-11 05:39:33 +00:00
ExecStart=/opt/opengist/opengist
Restart=always
User=root
2025-01-11 04:48:52 +00:00
[Install]
WantedBy=multi-user.target
EOF
2025-01-11 05:39:33 +00:00
msg_ok "Created Systemd Service"
2025-01-11 04:48:52 +00:00
msg_info "Starting Service"
systemctl daemon-reload
systemctl enable -q --now opengist.service
2025-01-11 05:39:33 +00:00
msg_ok "Started Service"
2025-01-11 04:48:52 +00:00
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"