Compare commits

..

6 Commits

Author SHA1 Message Date
Michel Roegl-Brunner
456751e7cc
Update opengist.sh 2025-01-13 19:38:44 +01:00
Michel Roegl-Brunner
ef5bb1bd28
Update opengist.sh 2025-01-13 19:37:11 +01:00
Michel Roegl-Brunner
709ae1742e
Update opengist.sh 2025-01-13 19:36:29 +01:00
Michel Roegl-Brunner
186e392fac
Update opengist-install.sh 2025-01-13 16:34:32 +01:00
Michel Roegl-Brunner
d66bbc4d10
Update opengist.sh 2025-01-13 16:34:13 +01:00
jd-apprentice
c1d86513d5 fix(review): mc, release, license, -q 2025-01-13 11:01:12 -03:00
2 changed files with 54 additions and 43 deletions

View File

@ -28,22 +28,36 @@ function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /opt/opengist/opengist ]]; then
if [[ ! -d /opt/opengist ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Updating ${APP} LXC"
LATEST_URL=$(curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | jq -r '.assets[] | select(.name | contains("linux-amd64.tar.gz")).browser_download_url')
wget "$LATEST_URL"
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
rm -rf opengist*
msg_info "Stopping Service"
systemctl stop opengist.service
msg_ok "Stopped Service"
apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null
msg_ok "Updated Successfully"
apt-get upgrade &>/dev/null
RELEASE=$(curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Updating ${APP} to v${RELEASE}"
cd /opt
wget -qO "https://github.com/thomiceli/opengist/releases/download/v${RELEASE}/opengist${RELEASE}-linux-amd64.tar.gz"
rm -rf /opt/opengist
tar -xzf opengist${RELEASE}-linux-amd64.tar.gz
chmod +x /opt/opengist/opengist
echo "${RELEASE}" >"/opt/${APP}_version.txt"
rm -rf /opt/opengist${RELEASE}-linux-amd64.tar.gz
apt-get -y autoremove &>/dev/null
apt-get -y autoclean &>/dev/null
msg_ok "Updated ${APP} LXC"
msg_info "Starting Service"
systemctl start opengist.service
msg_ok "Started Service"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}."
fi
exit
}

View File

@ -2,8 +2,7 @@
# Copyright (c) 2021-2025 community-scripts ORG
# Author: Jonathan (jd-apprentice)
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
@ -14,25 +13,26 @@ network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y curl
$STD apt-get install -y jq
$STD apt-get install -y sudo
$STD apt-get install -y git
$STD apt-get install -y \
mc \
curl \
sudo
msg_ok "Installed Dependencies"
msg_info "Download Opengist Binary"
LATEST_URL=$(curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | jq -r '.assets[] | select(.name | contains("linux-amd64.tar.gz")).browser_download_url')
wget "$LATEST_URL"
msg_ok "Downloaded Opengist Binary"
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
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
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
[Unit]
Description=Opengist server to manage your Gists
@ -40,24 +40,21 @@ After=network.target
[Service]
WorkingDirectory=/opt/opengist
ExecStart=/opt/opengist/opengist
ExecStart=/opt/opengist/opengist --config config.yaml
Restart=always
User=root
[Install]
WantedBy=multi-user.target
EOF
msg_ok "Created Systemd Service"
msg_info "Starting Service"
systemctl daemon-reload
systemctl enable -q --now opengist.service
msg_ok "Started Service"
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
rm -rf /opengist${RELEASE}-linux-amd64.tar.gz
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"