diff --git a/ct/netbox.sh b/ct/netbox.sh index 2699e7f4fe..f2b13b9d1f 100644 --- a/ct/netbox.sh +++ b/ct/netbox.sh @@ -66,24 +66,24 @@ if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_v msg_ok "Stopped ${APP}" msg_info "Updating $APP to v${RELEASE}" - mv /opt/netbox/ /opt/netbod-oldversion + mv /opt/netbox/ /opt/netbox-backup cd /opt wget -q "https://github.com/netbox-community/netbox/archive/refs/tags/v${RELEASE}.zip" unzip -q "v${RELEASE}.zip" mv /opt/netbox-${RELEASE}/ /opt/netbox/ - cp -r /opt/netbod-oldversion/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/ - cp -r /opt/netbod-oldversion/netbox/media/ /opt/netbox/netbox/ - cp -r /opt/netbod-oldversion/netbox/scripts /opt/netbox/netbox/ - cp -r /opt/netbod-oldversion/netbox/reports /opt/netbox/netbox/ - cp -r /opt/netbod-oldversion/gunicorn.py /opt/netbox/ + cp -r /opt/netbox-backup/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/ + cp -r /opt/netbox-backup/netbox/media/ /opt/netbox/netbox/ + cp -r /opt/netbox-backup/netbox/scripts /opt/netbox/netbox/ + cp -r /opt/netbox-backup/netbox/reports /opt/netbox/netbox/ + cp -r /opt/netbox-backup/gunicorn.py /opt/netbox/ - if [ -d /opt/netbod-oldversion/local_requirements.txt ]; then - cp -r /opt/netbod-oldversion/local_requirements.txt /opt/netbox/ + if [ -f /opt/netbox-backup/local_requirements.txt ]; then + cp -r /opt/netbox-backup/local_requirements.txt /opt/netbox/ fi - if [ -d /opt/netbod-oldversion/netbox/netbox/ldap_config.py ]; then - cp -r /opt/netbod-oldversion/netbox/netbox/ldap_config.py /opt/netbox/netbox/netbox/ + if [ -f /opt/netbox-backup/netbox/netbox/ldap_config.py ]; then + cp -r /opt/netbox-backup/netbox/netbox/ldap_config.py /opt/netbox/netbox/netbox/ fi /opt/netbox/upgrade.sh &>/dev/null @@ -96,7 +96,7 @@ if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_v msg_info "Cleaning up" rm -r "/opt/v${RELEASE}.zip" - rm -r /opt/netbod-oldversion + rm -r /opt/netbox-backup msg_ok "Cleaned" msg_ok "Updated Successfully" else diff --git a/install/netbox-install.sh b/install/netbox-install.sh index 384dd3880a..81a7183229 100644 --- a/install/netbox-install.sh +++ b/install/netbox-install.sh @@ -48,7 +48,7 @@ echo -e "Netbox Database Name: \e[32m$DB_NAME\e[0m" } >> ~/netbox.creds msg_ok "Set up PostgreSQL" -msg_info "Installing NetBox" +msg_info "Installing NetBox (Patience)" cd /opt RELEASE=$(curl -s https://api.github.com/repos/netbox-community/netbox/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') wget -q "https://github.com/netbox-community/netbox/archive/refs/tags/v${RELEASE}.zip" @@ -85,10 +85,7 @@ systemctl daemon-reload systemctl enable -q --now netbox netbox-rq echo "${RELEASE}" >/opt/${APPLICATION}_version.txt -{ -echo -e "Netbox Secret: \e[32m$SECRET_KEY\e[0m" -} >> ~/netbox.creds -msg_ok "Set up PostgreSQL" +echo -e "Netbox Secret: \e[32m$SECRET_KEY\e[0m" >> ~/netbox.creds msg_ok "Installed NetBox" msg_info "Setting up Django Admin"