diff --git a/ct/nodebb.sh b/ct/nodebb.sh index 0fae92fe3..e806e3609 100644 --- a/ct/nodebb.sh +++ b/ct/nodebb.sh @@ -32,7 +32,7 @@ function update_script() { fi RELEASE=$(curl -fsSL https://api.github.com/repos/NodeBB/NodeBB/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + if [[ "${RELEASE}" != "$(cat ~/.nodebb)" ]] || [[ ! -f ~/.nodebb ]]; then msg_info "Stopping ${APP}" systemctl stop nodebb msg_ok "Stopped ${APP}" @@ -40,13 +40,14 @@ function update_script() { msg_info "Updating ${APP} to v${RELEASE}" cd /opt/nodebb $STD ./nodebb upgrade - echo "${RELEASE}" >/opt/${APP}_version.txt + echo "${RELEASE}" > ~/.nodebb msg_ok "Updated ${APP} to v${RELEASE}" msg_info "Starting ${APP}" systemctl start nodebb msg_ok "Started ${APP}" - msg_ok "Updated Successfully" + + msg_ok "Updated Successfully\n" else msg_ok "No update required. ${APP} is already at v${RELEASE}." fi @@ -60,4 +61,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}:4567${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:4567${CL}" diff --git a/install/nodebb-install.sh b/install/nodebb-install.sh index 92c54c30d..016302525 100644 --- a/install/nodebb-install.sh +++ b/install/nodebb-install.sh @@ -24,7 +24,7 @@ msg_ok "Installed Dependencies" setup_mongodb NODE_VERSION="22" setup_nodejs -msg_info "Configure MongoDB" +msg_info "Configuring MongoDB" MONGO_ADMIN_USER="admin" MONGO_ADMIN_PWD="$(openssl rand -base64 18 | cut -c1-13)" NODEBB_USER="nodebb" @@ -63,14 +63,11 @@ sed -i 's/bindIp: 127.0.0.1/bindIp: 0.0.0.0/' /etc/mongod.conf sed -i '/security:/d' /etc/mongod.conf bash -c 'echo -e "\nsecurity:\n authorization: enabled" >> /etc/mongod.conf' systemctl restart mongod -msg_ok "MongoDB successfully configurated" +msg_ok "MongoDB configured" -msg_info "Install NodeBB" -cd /opt -RELEASE=$(curl -fsSL https://api.github.com/repos/NodeBB/NodeBB/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -curl -fsSL "https://github.com/NodeBB/NodeBB/archive/refs/tags/v${RELEASE}.zip" -o "/opt/v${RELEASE}.zip" -$STD unzip v${RELEASE}.zip -mv NodeBB-${RELEASE} /opt/nodebb +fetch_and_deploy_gh_release "nodebb" "NodeBB/NodeBB" "tarball" + +msg_info "Configuring NodeBB" cd /opt/nodebb touch pidfile expect </dev/null 2>&1 @@ -107,8 +104,7 @@ expect "Confirm Password" { } expect eof EOF -echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" -msg_ok "Installed NodeBB" +msg_ok "Configured NodeBB" msg_info "Creating Services" cat </etc/systemd/system/nodebb.service @@ -136,7 +132,6 @@ motd_ssh customize msg_info "Cleaning up" -rm -R /opt/v${RELEASE}.zip $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"