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

@ -25,26 +25,40 @@ color
catch_errors catch_errors
function update_script() { function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -f /opt/opengist/opengist ]]; then if [[ ! -d /opt/opengist ]]; then
msg_error "No ${APP} Installation Found!" 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*
apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null
msg_ok "Updated Successfully"
exit exit
fi
msg_info "Stopping Service"
systemctl stop opengist.service
msg_ok "Stopped Service"
apt-get update &>/dev/null
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
} }
start start

View File

@ -2,8 +2,7 @@
# Copyright (c) 2021-2025 community-scripts ORG # Copyright (c) 2021-2025 community-scripts ORG
# Author: Jonathan (jd-apprentice) # Author: Jonathan (jd-apprentice)
# License: MIT # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color color
@ -14,25 +13,26 @@ network_check
update_os update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y curl $STD apt-get install -y \
$STD apt-get install -y jq mc \
$STD apt-get install -y sudo curl \
$STD apt-get install -y git sudo
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Download Opengist Binary" msg_info "Install Opengist"
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') RELEASE=$(curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget "$LATEST_URL" echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Downloaded Opengist Binary" 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
msg_info "Creating Systemd Service" mv opengist /opt/opengist
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
@ -40,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"