Skip to content

Commit 35ad33f

Browse files
committed
BACKUP
1 parent cd91179 commit 35ad33f

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

SPECS/netbox.spec

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
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+
25
Name: netbox
3-
Version: 3.5.4
6+
Version: 4.1.4
47
Release: 1
58
Summary: 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
1114
Source2: netbox.logrotate
1215
Source3: 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
1720
NetBox 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
131137
fi
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

Comments
 (0)