1- %define __python /opt/rh/rh-python38/root/usr/bin/python
1+ %define __python3 python3.12
2+ %define __python3_binary /usr/bin/%{__python3}
3+ %define __psql_binary /usr/pgsql-16/bin/psql
4+
25Name: netbox
3- Version: 3.5 .4
6+ Version: 4.1 .4
47Release: 1
58Summary: The premier source of truth powering network automation.
69
@@ -11,7 +14,7 @@ Source: https://github.com/%{name}-community/%{name}/archive/refs/tags/v%{versio
1114Source2: netbox.logrotate
1215Source3: netbox.logfile
1316
14- Requires: gcc libxml2-devel libxslt-devel libffi-devel libpq5-devel openssl-devel redhat-rpm-config rh-redis6- redis rh-python38 rh-python38-python- pip rh-python38-python -devel
17+ Requires: gcc libxml2-devel libxslt-devel libffi-devel libpq5-devel openssl-devel postgresql16-server redhat-rpm-config redis %{__python3} %{__python3}- pip %{__python3} -devel
1518
1619%description
1720NetBox is the source of truth for everything on your network, from physical
@@ -97,6 +100,10 @@ cp %{name}-%{version}/contrib/*.timer %{buildroot}%{_unitdir}
97100%{__install} -D -m 0644 %{SOURCE2 } %{buildroot }/%{_sysconfdir }/logrotate.d/netbox
98101%{__install} -D -m 0640 %{SOURCE3 } %{buildroot }/var/log/netbox/netbox.log
99102
103+ # temp: Fix ambigous shebang causing rpmbuild to die
104+ # (see https://github.com/netbox-community/netbox/issues/17838)
105+ sed -e 's/^#!\/usr\/bin\/env python$/#\/usr\/bin\/env python3/' -i %{buildroot}/opt/%{name}/%{name}/manage.py
106+
100107%files
101108%{_unitdir }
102109/opt/%{name }
@@ -112,15 +119,14 @@ if [ $1 -eq 1 ]; then
112119 export pgsql_pw=$( pwgen 16 1)
113120 export secret=$( pwgen 64 1)
114121
115- sudo -Hiu postgres /usr/pgsql-13/bin/psql -c ' CREATE DATABASE netbox;' -c " CREATE USER netbox WITH PASSWORD '$pgsql_pw '; ALTER DATABASE netbox OWNER TO netbox;"
116- sudo -Hiu postgres /usr/pgsql-13/bin/psql netbox -c " GRANT CREATE ON SCHEMA public TO netbox;"
122+ sudo -Hiu postgres %{__psql_binary} -c ' CREATE DATABASE netbox;' -c " CREATE USER netbox WITH PASSWORD '$pgsql_pw '; ALTER DATABASE netbox OWNER TO netbox;"
123+ sudo -Hiu postgres %{__psql_binary} netbox -c " GRANT CREATE ON SCHEMA public TO netbox;"
117124
118125 sed -e " s/'PASSWORD': '', # PostgreSQL password/'PASSWORD': '$pgsql_pw ', # PostgreSQL password/" \
119126 -e " s/^SECRET_KEY = ''$/SECRET_KEY = '$secret '/" \
120127 -i /opt/netbox/netbox/netbox/configuration.py
121128
122- source /opt/rh/rh-python38/enable
123- /opt/netbox/upgrade.sh
129+ PYTHON=%{__python3_binary} /opt/netbox/upgrade.sh
124130
125131 chmod -R o-rwx /var/log/netbox
126132 chown -R nobody:nobody /var/log/netbox
@@ -131,5 +137,8 @@ if [ $1 -eq 1 ]; then
131137fi
132138
133139%changelog
140+ * Wed Oct 23 2024 Patrick Reichel <patrick.reichel@nmsprime.com> - 4.1.4-1
141+ - Switch to version 4
142+
134143* Wed Sep 20 2023 Ole Ernst <ole.ernst@nmsprime.com> - 3.5.4-1
135144- Initial RPM release
0 commit comments