Alan Pevec
2009-Feb-12 00:41 UTC
[Ovirt-devel] [PATCH node] make ovirt-functions executable script
execute a shell function if called as a script, e.g. ovirt-functions ovirt_store_config /etc/hosts Signed-off-by: Alan Pevec <apevec at redhat.com> --- ovirt-node.spec.in | 4 ++-- scripts/ovirt-functions | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) mode change 100644 => 100755 scripts/ovirt-functions diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 5226131..5845d2b 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -153,7 +153,7 @@ cd - %{__install} -p -m0755 gptsync/showpart %{buildroot}%{_sbindir} # -%{__install} -p -m0644 scripts/ovirt-functions %{buildroot}%{_initrddir} +%{__install} -p -m0755 scripts/ovirt-functions %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-early %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt-firstboot %{buildroot}%{_initrddir} %{__install} -p -m0755 scripts/ovirt %{buildroot}%{_initrddir} @@ -300,8 +300,8 @@ fi %defattr(-,root,root,0755) %{_sbindir}/ovirt-awake %{_sbindir}/ovirt-identify-node -%defattr(-,root,root,0644) %{_initrddir}/ovirt-functions +%defattr(-,root,root,0644) %{_sysconfdir}/collectd.conf.in %{_sysconfdir}/chkconfig.d/collectd %config %attr(0644,root,root) %{_sysconfdir}/ovirt-release diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions old mode 100644 new mode 100755 index 630e693..3079805 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -464,3 +464,11 @@ reboot() { done /sbin/reboot } + +# execute a function if called as a script, e.g. +# ovirt-functions ovirt_store_config /etc/hosts + +if [ $(basename "$0") = "ovirt-functions" ]; then + "$@" +fi + -- 1.6.0.6