Update opengist-install.sh

This commit is contained in:
Michel Roegl-Brunner 2025-01-13 16:34:32 +01:00 committed by GitHub
parent d66bbc4d10
commit 186e392fac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,25 +16,23 @@ msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt-get install -y \
mc \ mc \
curl \ curl \
sudo \ sudo
git
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Download Opengist Binary" msg_info "Install Opengist"
RELEASE_URL=$( RELEASE=$(curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | grep "linux-amd64.tar.gz" | grep "browser_download_url" | awk -F '"' '{print $4}' echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
) wget -q "https://github.com/thomiceli/opengist/releases/download/v${RELEASE}/opengist${RELEASE}-linux-amd64.tar.gz"
wget -q "$RELEASE_URL" tar -xzf opengist${RELEASE}-linux-amd64.tar.gz
msg_ok "Downloaded Opengist Binary" mv opengist /opt/opengist
msg_info "Creating Systemd Service"
mkdir -p /opt/opengist
mv opengist*.tar.gz opengist.tar.gz
tar -xf opengist.tar.gz
mv opengist/opengist /opt/opengist/opengist
mv opengist/config.yml /opt/opengist/config.yml
chmod +x /opt/opengist/opengist chmod +x /opt/opengist/opengist
rm -rf opengist* 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
cat <<EOF >/etc/systemd/system/opengist.service cat <<EOF >/etc/systemd/system/opengist.service
[Unit] [Unit]
Description=Opengist server to manage your Gists Description=Opengist server to manage your Gists
@ -42,24 +40,21 @@ After=network.target
[Service] [Service]
WorkingDirectory=/opt/opengist WorkingDirectory=/opt/opengist
ExecStart=/opt/opengist/opengist ExecStart=/opt/opengist/opengist --config config.yaml
Restart=always Restart=always
User=root User=root
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
msg_ok "Created Systemd Service"
msg_info "Starting Service"
systemctl daemon-reload
systemctl enable -q --now opengist.service systemctl enable -q --now opengist.service
msg_ok "Started Service" msg_ok "Created Service"
motd_ssh motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm -rf /opengist${RELEASE}-linux-amd64.tar.gz
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"