ProxmoxVE/install/opengist-install.sh

61 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 \
2025-01-13 15:34:32 +00:00
sudo
2025-01-11 04:48:52 +00:00
msg_ok "Installed Dependencies"
2025-01-13 15:34:32 +00:00
msg_info "Install Opengist"
RELEASE=$(curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
wget -q "https://github.com/thomiceli/opengist/releases/download/v${RELEASE}/opengist${RELEASE}-linux-amd64.tar.gz"
tar -xzf opengist${RELEASE}-linux-amd64.tar.gz
mv opengist /opt/opengist
2025-01-11 21:17:34 +00:00
chmod +x /opt/opengist/opengist
2025-01-13 15:34:32 +00:00
mkdir -p /opt/opengist-data
msg_ok "Installed Opengist"
msg_info "Creating Service"
sed -i 's|opengist-home:.*|opengist-home: /opt/opengist-data|' /opt/opengist/config.yml
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-13 15:34:32 +00:00
ExecStart=/opt/opengist/opengist --config config.yaml
2025-01-11 05:39:33 +00:00
Restart=always
User=root
2025-01-11 04:48:52 +00:00
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now opengist.service
2025-01-13 15:34:32 +00:00
msg_ok "Created Service"
2025-01-11 04:48:52 +00:00
motd_ssh
customize
msg_info "Cleaning up"
2025-01-13 15:34:32 +00:00
rm -rf /opengist${RELEASE}-linux-amd64.tar.gz
2025-01-11 04:48:52 +00:00
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"