mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 02:12:49 +00:00 
			
		
		
		
	Refactor (#6554)
This commit is contained in:
		@@ -27,18 +27,26 @@ function update_script() {
 | 
			
		||||
    msg_error "No ${APP} Installation Found!"
 | 
			
		||||
    exit
 | 
			
		||||
  fi
 | 
			
		||||
  msg_info "Stopping ${APP}"
 | 
			
		||||
  systemctl stop pocketbase
 | 
			
		||||
  msg_ok "Stopped ${APP}"
 | 
			
		||||
 | 
			
		||||
  msg_info "Updating ${APP}"
 | 
			
		||||
  /opt/pocketbase/pocketbase update
 | 
			
		||||
  msg_ok "Updated ${APP}"
 | 
			
		||||
  RELEASE=$(curl -s https://api.github.com/repos/pocketbase/pocketbase/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
 | 
			
		||||
  if [[ "${RELEASE}" != "$(cat ~/.pocketbase 2>/dev/null)" ]] || [[ ! -f ~/.pocketbase ]]; then
 | 
			
		||||
    msg_info "Stopping ${APP}"
 | 
			
		||||
    systemctl stop pocketbase
 | 
			
		||||
    msg_ok "Stopped ${APP}"
 | 
			
		||||
 | 
			
		||||
  msg_info "Starting ${APP}"
 | 
			
		||||
  systemctl start pocketbase
 | 
			
		||||
  msg_ok "Started ${APP}"
 | 
			
		||||
  msg_ok "Updated Successfully"
 | 
			
		||||
    msg_info "Updating ${APP}"
 | 
			
		||||
    /opt/pocketbase/pocketbase update
 | 
			
		||||
    echo "${RELEASE}" > ~/.pocketbase
 | 
			
		||||
    msg_ok "Updated ${APP}"
 | 
			
		||||
 | 
			
		||||
    msg_info "Starting ${APP}"
 | 
			
		||||
    systemctl start pocketbase
 | 
			
		||||
    msg_ok "Started ${APP}"
 | 
			
		||||
    
 | 
			
		||||
    msg_ok "Update Successful"
 | 
			
		||||
  else
 | 
			
		||||
    msg_ok "No update required. ${APP} is already at ${RELEASE}"
 | 
			
		||||
  fi
 | 
			
		||||
  exit
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -49,4 +57,4 @@ description
 | 
			
		||||
msg_ok "Completed Successfully!\n"
 | 
			
		||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
 | 
			
		||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
 | 
			
		||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080/_/${CL}"
 | 
			
		||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080/_/${CL}"
 | 
			
		||||
 
 | 
			
		||||
@@ -13,12 +13,13 @@ setting_up_container
 | 
			
		||||
network_check
 | 
			
		||||
update_os
 | 
			
		||||
 | 
			
		||||
msg_info "Installing Pocketbase"
 | 
			
		||||
RELEASE="$(curl -fsSL https://api.github.com/repos/pocketbase/pocketbase/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')"
 | 
			
		||||
curl -fsSL "https://github.com/pocketbase/pocketbase/releases/download/v${RELEASE}/pocketbase_${RELEASE}_linux_amd64.zip" -o "/tmp/pocketbase.zip"
 | 
			
		||||
mkdir -p /opt/pocketbase/{pb_public,pb_migrations,pb_hooks}
 | 
			
		||||
$STD unzip -o /tmp/pocketbase.zip -d /opt/pocketbase
 | 
			
		||||
fetch_and_deploy_gh_release "pocketbase" "pocketbase/pocketbase" "prebuild" "latest" "/opt/pocketbase" "pocketbase*linux_amd64.zip"
 | 
			
		||||
 | 
			
		||||
msg_info "Configuring Pocketbase"
 | 
			
		||||
mkdir -p /opt/pocketbase/{pb_public,pb_migrations,pb_hooks}
 | 
			
		||||
msg_ok "Configured Pocketbase"
 | 
			
		||||
 | 
			
		||||
msg_info "Creating service"
 | 
			
		||||
cat <<EOF >/etc/systemd/system/pocketbase.service
 | 
			
		||||
[Unit]
 | 
			
		||||
Description = pocketbase
 | 
			
		||||
@@ -35,15 +36,13 @@ ExecStart      = /opt/pocketbase/pocketbase serve --http=0.0.0.0:8080
 | 
			
		||||
[Install]
 | 
			
		||||
WantedBy = multi-user.target
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
systemctl enable -q --now pocketbase
 | 
			
		||||
msg_ok "Installed Pocketbase"
 | 
			
		||||
msg_ok "Service created"
 | 
			
		||||
 | 
			
		||||
motd_ssh
 | 
			
		||||
customize
 | 
			
		||||
 | 
			
		||||
msg_info "Cleaning up"
 | 
			
		||||
rm -rf /tmp/pocketbase.zip
 | 
			
		||||
$STD apt-get -y autoremove
 | 
			
		||||
$STD apt-get -y autoclean
 | 
			
		||||
msg_ok "Cleaned"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user