File cloud-multiroute.spec of Package cloud-multiroute
Name: cloud-multiroute
Version: 0.8
Release: 1
License: GPL-2.0
Source0: rttbl2.sh
Source1: cloud-multiroute.service
Source2: cloud-multiroute.sh
Source3: rtdefl.sh
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Autoreqprov: on
%if 0%{?suse_version} >= 1210
BuildRequires: systemd-rpm-macros
%endif
BuildRequires: systemd
Requires: shyaml
#Requires: systemd
%{?systemd_requires}
Summary: Setting up multiple routing tables controlled by user_data
Group: Networking/Utilities
BuildArch: noarch
%description
When having several NICs in a cloud VM, we may want to use all of them fully.
In Linux, this needs multiple routing tables, if
(a) we have several NICs in one subnet OR
(b) we want to have several default routes.
This script creates these routes controlled by settings from cloud-init user_data.
otc:
multiroute: true
enables this for case (a).
multiroute: guessgw
also enables case (b) by guessing the gateway address for NICs in other subnets.
%prep
#sed -i 's@/usr/sbin@%{_sbindir}@' %{SOURCE1}
%build
%install
#mkdir -p $RPM_BUILD_ROOT/usr/lib/cloud-init
mkdir -p $RPM_BUILD_ROOT/%{_sbindir}
install -m 0755 %{SOURCE0} %{SOURCE2} %{SOURCE3} $RPM_BUILD_ROOT/%{_sbindir}/
mkdir -p %{buildroot}%{_unitdir}/
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_unitdir}/cloud-multiroute.service
%{_sbindir}/cloud-multiroute.sh
%{_sbindir}/rttbl2.sh
%{_sbindir}/rtdefl.sh
#%dir /usr/lib/cloud-init
%pre
#%%service_add_pre cloud-multiroute.service
%post
#%%service_add_post cloud-multiroute.service
systemctl enable cloud-multiroute.service
%preun
#%%service_del_preun cloud-multiroute.service
%postun
#%%service_del_postun cloud-multiroute.service
%changelog