mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 02:12:49 +00:00 
			
		
		
		
	Refactor (#6423)
This commit is contained in:
		@@ -27,34 +27,27 @@ function update_script() {
 | 
				
			|||||||
    msg_error "No ${APP} Installation Found!"
 | 
					    msg_error "No ${APP} Installation Found!"
 | 
				
			||||||
    exit
 | 
					    exit
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  RELEASE=$(curl -fsSL https://api.github.com/repos/thomiceli/opengist/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
 | 
					  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"
 | 
					    msg_info "Stopping Service"
 | 
				
			||||||
    systemctl stop opengist.service
 | 
					    systemctl stop opengist
 | 
				
			||||||
    msg_ok "Stopped Service"
 | 
					    msg_ok "Stopped Service"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    msg_info "Updating ${APP} to v${RELEASE}"
 | 
					    msg_info "Creating backup"
 | 
				
			||||||
    $STD apt-get update
 | 
					 | 
				
			||||||
    $STD apt-get -y upgrade
 | 
					 | 
				
			||||||
    cd /opt
 | 
					 | 
				
			||||||
    mv /opt/opengist /opt/opengist-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")
 | 
					    msg_ok "Backup created"
 | 
				
			||||||
    tar -xzf opengist${RELEASE}-linux-amd64.tar.gz
 | 
					    
 | 
				
			||||||
 | 
					    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
 | 
					    mv /opt/opengist-backup/config.yml /opt/opengist/config.yml
 | 
				
			||||||
    chmod +x /opt/opengist/opengist
 | 
					    msg_ok "Configured ${APP}"
 | 
				
			||||||
    echo "${RELEASE}" >"/opt/${APP}_version.txt"
 | 
					 | 
				
			||||||
    msg_ok "Updated ${APP} LXC"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    msg_info "Starting Service"
 | 
					    msg_info "Starting Service"
 | 
				
			||||||
    systemctl start opengist.service
 | 
					    systemctl start opengist
 | 
				
			||||||
    msg_ok "Started Service"
 | 
					    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"
 | 
					    msg_ok "Updated Successfully"
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    msg_ok "No update required. ${APP} is already at v${RELEASE}."
 | 
					    msg_ok "No update required. ${APP} is already at v${RELEASE}."
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@
 | 
				
			|||||||
  "updateable": true,
 | 
					  "updateable": true,
 | 
				
			||||||
  "privileged": false,
 | 
					  "privileged": false,
 | 
				
			||||||
  "interface_port": 6157,
 | 
					  "interface_port": 6157,
 | 
				
			||||||
  "documentation": null,
 | 
					  "documentation": "https://opengist.io/docs/",
 | 
				
			||||||
  "website": "https://opengist.io/",
 | 
					  "website": "https://opengist.io/",
 | 
				
			||||||
  "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/opengist.webp",
 | 
					  "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/opengist.webp",
 | 
				
			||||||
  "config_path": "/opt/opengist/config.yml",
 | 
					  "config_path": "/opt/opengist/config.yml",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,20 +17,11 @@ msg_info "Installing Dependencies"
 | 
				
			|||||||
$STD apt-get install -y git
 | 
					$STD apt-get install -y git
 | 
				
			||||||
msg_ok "Installed Dependencies"
 | 
					msg_ok "Installed Dependencies"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Install Opengist"
 | 
					fetch_and_deploy_gh_release "opengist" "thomiceli/opengist" "prebuild" "latest" "/opt/opengist" "opengist*linux-amd64.tar.gz"
 | 
				
			||||||
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
 | 
					 | 
				
			||||||
mkdir -p /opt/opengist-data
 | 
					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
 | 
					sed -i 's|opengist-home:.*|opengist-home: /opt/opengist-data|' /opt/opengist/config.yml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					msg_info "Creating Service"
 | 
				
			||||||
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
 | 
				
			||||||
@@ -52,7 +43,6 @@ 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"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user