diff --git a/nfv/centos/nfv.spec b/nfv/centos/nfv.spec index 109450fc..0444e05f 100755 --- a/nfv/centos/nfv.spec +++ b/nfv/centos/nfv.spec @@ -79,6 +79,14 @@ Network Function Virtualization Client %prep %setup +# use actual value of %{_sysconfdir} to repace @SYSCONFDIR@ in config files +# use actual value of %{pythonroot} to replace @PYTHONROOT@ in config.ini. +sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/scripts/vim +sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/scripts/vim-api +sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/scripts/vim-webserver +sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/nfv_vim/config.ini +sed -i -e 's|@PYTHONROOT@|%{pythonroot}|g' nfv-vim/nfv_vim/config.ini + %build %build_python nfv-common %build_python nfv-plugins @@ -98,26 +106,26 @@ install -d -m 755 %{buildroot}%{_sysconfdir}/bash_completion.d install -m 444 nfv-client/scripts/sw-manager.completion %{buildroot}%{_sysconfdir}/bash_completion.d/sw-manager # nfv-plugins -install -d -m 755 %{buildroot}/etc/nfv/ -install -d -m 755 %{buildroot}/etc/nfv/nfv_plugins/ -install -d -m 755 %{buildroot}/etc/nfv/nfv_plugins/alarm_handlers/ -install -p -D -m 600 nfv-plugins/nfv_plugins/alarm_handlers/config.ini %{buildroot}/etc/nfv/nfv_plugins/alarm_handlers/config.ini -install -d -m 755 %{buildroot}/etc/nfv/nfv_plugins/event_log_handlers/ -install -p -D -m 600 nfv-plugins/nfv_plugins/event_log_handlers/config.ini %{buildroot}/etc/nfv/nfv_plugins/event_log_handlers/config.ini -install -d -m 755 %{buildroot}/etc/nfv/nfv_plugins/nfvi_plugins/ -install -p -D -m 600 nfv-plugins/nfv_plugins/nfvi_plugins/config.ini %{buildroot}/etc/nfv/nfv_plugins/nfvi_plugins/config.ini +install -d -m 755 %{buildroot}/%{_sysconfdir}/nfv/ +install -d -m 755 %{buildroot}/%{_sysconfdir}/nfv/nfv_plugins/ +install -d -m 755 %{buildroot}/%{_sysconfdir}/nfv/nfv_plugins/alarm_handlers/ +install -p -D -m 600 nfv-plugins/nfv_plugins/alarm_handlers/config.ini %{buildroot}/%{_sysconfdir}/nfv/nfv_plugins/alarm_handlers/config.ini +install -d -m 755 %{buildroot}/%{_sysconfdir}/nfv/nfv_plugins/event_log_handlers/ +install -p -D -m 600 nfv-plugins/nfv_plugins/event_log_handlers/config.ini %{buildroot}/%{_sysconfdir}/nfv/nfv_plugins/event_log_handlers/config.ini +install -d -m 755 %{buildroot}/%{_sysconfdir}/nfv/nfv_plugins/nfvi_plugins/ +install -p -D -m 600 nfv-plugins/nfv_plugins/nfvi_plugins/config.ini %{buildroot}/%{_sysconfdir}/nfv/nfv_plugins/nfvi_plugins/config.ini install -d -m 755 %{buildroot}/ -install -p -D -m 644 nfv-plugins/scripts/nfvi-plugins.logrotate %{buildroot}/etc/logrotate.d/nfvi-plugins.logrotate +install -p -D -m 644 nfv-plugins/scripts/nfvi-plugins.logrotate %{buildroot}/%{_sysconfdir}/logrotate.d/nfvi-plugins.logrotate # nfv-vim install -d -m 755 %{buildroot}/usr/lib/ocf/resource.d/nfv install -p -D -m 755 nfv-vim/scripts/vim %{buildroot}/usr/lib/ocf/resource.d/nfv/vim install -p -D -m 755 nfv-vim/scripts/vim-api %{buildroot}/usr/lib/ocf/resource.d/nfv/vim-api install -p -D -m 755 nfv-vim/scripts/vim-webserver %{buildroot}/usr/lib/ocf/resource.d/nfv/vim-webserver -install -d -m 755 %{buildroot}/etc/nfv/ -install -d -m 755 %{buildroot}/etc/nfv/vim/ -install -p -D -m 600 nfv-vim/nfv_vim/config.ini %{buildroot}/etc/nfv/vim/config.ini -install -p -D -m 600 nfv-vim/nfv_vim/debug.ini %{buildroot}/etc/nfv/vim/debug.ini +install -d -m 755 %{buildroot}/%{_sysconfdir}/nfv/ +install -d -m 755 %{buildroot}/%{_sysconfdir}/nfv/vim/ +install -p -D -m 600 nfv-vim/nfv_vim/config.ini %{buildroot}/%{_sysconfdir}/nfv/vim/config.ini +install -p -D -m 600 nfv-vim/nfv_vim/debug.ini %{buildroot}/%{_sysconfdir}/nfv/vim/debug.ini %post -n nfv-common @@ -140,13 +148,13 @@ rm -rf $RPM_BUILD_ROOT %files -n nfv-plugins %defattr(-,root,root,-) %doc nfv-plugins/LICENSE -%dir /etc/logrotate.d/ -/etc/logrotate.d/nfvi-plugins.logrotate -%dir /etc/nfv/nfv_plugins/ -%config(noreplace)/etc/nfv/nfv_plugins/alarm_handlers/config.ini -%config(noreplace)/etc/nfv/nfv_plugins/event_log_handlers/config.ini -%config(noreplace)/etc/nfv/nfv_plugins/nfvi_plugins/config.ini -/etc/nfv/nfv_plugins/* +%dir %{_sysconfdir}/logrotate.d/ +%{_sysconfdir}/logrotate.d/nfvi-plugins.logrotate +%dir %{_sysconfdir}/nfv/nfv_plugins/ +%config(noreplace)/%{_sysconfdir}/nfv/nfv_plugins/alarm_handlers/config.ini +%config(noreplace)/%{_sysconfdir}/nfv/nfv_plugins/event_log_handlers/config.ini +%config(noreplace)/%{_sysconfdir}/nfv/nfv_plugins/nfvi_plugins/config.ini +%{_sysconfdir}/nfv/nfv_plugins/* %dir %{pythonroot}/nfv_plugins/ %{pythonroot}/nfv_plugins/* %dir %{pythonroot}/windriver_nfv_plugins-%{version}.0-py2.7.egg-info @@ -169,9 +177,9 @@ rm -rf $RPM_BUILD_ROOT %{local_bindir}/nfv-vim-api %{local_bindir}/nfv-vim-manage %{local_bindir}/nfv-vim-webserver -%dir /etc/nfv/vim/ -%config(noreplace)/etc/nfv/vim/config.ini -%config(noreplace)/etc/nfv/vim/debug.ini +%dir %{_sysconfdir}/nfv/vim/ +%config(noreplace)/%{_sysconfdir}/nfv/vim/config.ini +%config(noreplace)/%{_sysconfdir}/nfv/vim/debug.ini %dir /usr/lib/ocf/resource.d/nfv/ /usr/lib/ocf/resource.d/nfv/vim /usr/lib/ocf/resource.d/nfv/vim-api diff --git a/nfv/nfv-vim/nfv_vim/config.ini b/nfv/nfv-vim/nfv_vim/config.ini index db4e3ab0..2a59a9c0 100755 --- a/nfv/nfv-vim/nfv_vim/config.ini +++ b/nfv/nfv-vim/nfv_vim/config.ini @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # [debug] -config_file=/etc/nfv/vim/debug.ini +config_file=@SYSCONFDIR@/nfv/vim/debug.ini handlers=syslog, stdout syslog_address=/dev/log syslog_facility=user @@ -16,16 +16,16 @@ database_dir=/var/lib/vim namespace= nfv_vim.alarm.handlers.v1 handlers=File-Storage, Fault-Management audit_interval=30 -config_file=/etc/nfv/nfv_plugins/alarm_handlers/config.ini +config_file=@SYSCONFDIR@/nfv/nfv_plugins/alarm_handlers/config.ini [event-log] namespace=nfv_vim.event_log.handlers.v1 handlers=File-Storage, Event-Log-Management -config_file=/etc/nfv/nfv_plugins/event_log_handlers/config.ini +config_file=@SYSCONFDIR@/nfv/nfv_plugins/event_log_handlers/config.ini [nfvi] namespace=nfv_vim.nfvi.plugins.v1 -config_file=/etc/nfv/nfv_plugins/nfvi_plugins/config.ini +config_file=@SYSCONFDIR@/nfv/nfv_plugins/nfvi_plugins/config.ini [host-configuration] max_host_deleting_wait_in_secs=60 @@ -60,4 +60,4 @@ rpc_port=0 [vim-webserver] host=127.0.0.1 port=32323 -source_dir=/usr/lib64/python2.7/site-packages/nfv_vim/webserver +source_dir=@PYTHONROOT@/nfv_vim/webserver diff --git a/nfv/nfv-vim/scripts/vim b/nfv/nfv-vim/scripts/vim index 4aff4f98..ad5c8403 100755 --- a/nfv/nfv-vim/scripts/vim +++ b/nfv/nfv-vim/scripts/vim @@ -26,7 +26,7 @@ binname="${process}" # Fill in some defaults if no values are specified OCF_RESKEY_binary_default=${binname} -OCF_RESKEY_config_default="/etc/nfv/vim/config.ini" +OCF_RESKEY_config_default="@SYSCONFDIR@/nfv/vim/config.ini" OCF_RESKEY_pid_default="/var/run/${binname}.pid" @@ -314,4 +314,4 @@ case ${__OCF_ACTION} in *) usage exit ${OCF_ERR_UNIMPLEMENTED} ;; -esac \ No newline at end of file +esac diff --git a/nfv/nfv-vim/scripts/vim-api b/nfv/nfv-vim/scripts/vim-api index 96b2b5d1..609dde17 100755 --- a/nfv/nfv-vim/scripts/vim-api +++ b/nfv/nfv-vim/scripts/vim-api @@ -26,7 +26,7 @@ binname="${process}" # Fill in some defaults if no values are specified OCF_RESKEY_binary_default=${binname} -OCF_RESKEY_config_default="/etc/nfv/vim/config.ini" +OCF_RESKEY_config_default="@SYSCONFDIR@/nfv/vim/config.ini" OCF_RESKEY_pid_default="/var/run/${binname}.pid" @@ -314,4 +314,4 @@ case ${__OCF_ACTION} in *) usage exit ${OCF_ERR_UNIMPLEMENTED} ;; -esac \ No newline at end of file +esac diff --git a/nfv/nfv-vim/scripts/vim-webserver b/nfv/nfv-vim/scripts/vim-webserver index 6341b9ce..176e79c7 100755 --- a/nfv/nfv-vim/scripts/vim-webserver +++ b/nfv/nfv-vim/scripts/vim-webserver @@ -26,7 +26,7 @@ binname="${process}" # Fill in some defaults if no values are specified OCF_RESKEY_binary_default=${binname} -OCF_RESKEY_config_default="/etc/nfv/vim/config.ini" +OCF_RESKEY_config_default="@SYSCONFDIR@/nfv/vim/config.ini" OCF_RESKEY_pid_default="/var/run/${binname}.pid" @@ -314,4 +314,4 @@ case ${__OCF_ACTION} in *) usage exit ${OCF_ERR_UNIMPLEMENTED} ;; -esac \ No newline at end of file +esac