diff --git a/ct/opengist.sh b/ct/opengist.sh index e19bebe89..57b54f17b 100644 --- a/ct/opengist.sh +++ b/ct/opengist.sh @@ -27,34 +27,27 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + RELEASE=$(curl -fsSL 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 + if [[ ! -f ~/.opengist ]] || [[ "${RELEASE}" != "$(cat ~/.opengist)" ]]; then msg_info "Stopping Service" - systemctl stop opengist.service + systemctl stop opengist msg_ok "Stopped Service" - msg_info "Updating ${APP} to v${RELEASE}" - $STD apt-get update - $STD apt-get -y upgrade - cd /opt + msg_info "Creating backup" mv /opt/opengist /opt/opengist-backup - curl -fsSL "https://github.com/thomiceli/opengist/releases/download/v${RELEASE}/opengist${RELEASE}-linux-amd64.tar.gz" -o $(basename "https://github.com/thomiceli/opengist/releases/download/v${RELEASE}/opengist${RELEASE}-linux-amd64.tar.gz") - tar -xzf opengist${RELEASE}-linux-amd64.tar.gz + msg_ok "Backup created" + + fetch_and_deploy_gh_release "opengist" "thomiceli/opengist" "prebuild" "latest" "/opt/opengist" "opengist*linux-amd64.tar.gz" + + msg_info "Configuring ${APP}" mv /opt/opengist-backup/config.yml /opt/opengist/config.yml - chmod +x /opt/opengist/opengist - echo "${RELEASE}" >"/opt/${APP}_version.txt" - msg_ok "Updated ${APP} LXC" + msg_ok "Configured ${APP}" msg_info "Starting Service" - systemctl start opengist.service + systemctl start opengist msg_ok "Started Service" - msg_info "Cleaning up" - rm -rf /opt/opengist${RELEASE}-linux-amd64.tar.gz - rm -rf /opt/opengist-backup - $STD apt-get -y autoremove - $STD apt-get -y autoclean - msg_ok "Cleaned" msg_ok "Updated Successfully" else msg_ok "No update required. ${APP} is already at v${RELEASE}." diff --git a/frontend/public/json/opengist.json b/frontend/public/json/opengist.json index 8d29583a9..80db5e445 100644 --- a/frontend/public/json/opengist.json +++ b/frontend/public/json/opengist.json @@ -9,7 +9,7 @@ "updateable": true, "privileged": false, "interface_port": 6157, - "documentation": null, + "documentation": "https://opengist.io/docs/", "website": "https://opengist.io/", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/opengist.webp", "config_path": "/opt/opengist/config.yml", diff --git a/install/opengist-install.sh b/install/opengist-install.sh index ebfd615f5..2c8efa439 100644 --- a/install/opengist-install.sh +++ b/install/opengist-install.sh @@ -17,20 +17,11 @@ msg_info "Installing Dependencies" $STD apt-get install -y git msg_ok "Installed Dependencies" -msg_info "Install Opengist" -RELEASE=$(curl -fsSL 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" -curl -fsSL "https://github.com/thomiceli/opengist/releases/download/v${RELEASE}/opengist${RELEASE}-linux-amd64.tar.gz" -o "opengist${RELEASE}-linux-amd64.tar.gz" -$STD tar -xzf opengist${RELEASE}-linux-amd64.tar.gz -mv opengist /opt/opengist -chmod +x /opt/opengist/opengist +fetch_and_deploy_gh_release "opengist" "thomiceli/opengist" "prebuild" "latest" "/opt/opengist" "opengist*linux-amd64.tar.gz" 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 +msg_info "Creating Service" cat </etc/systemd/system/opengist.service [Unit] Description=Opengist server to manage your Gists @@ -52,7 +43,6 @@ 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"