Name: rename-eths Version: 1.0 Release: 2%{?dist} Summary: Rename network devices to match HWADDR, DEVICE=... in ifcfg-* License: GPL Version 3 URL: http://nicku.org/software/rename-eths Source0: http://nicku.org/software/rename-eths/%{name}-%{version}.tar.gz BuildRequires: systemd Requires: perl systemd %description Naming of network devices is undergoing a transition. Some folks like to keep the names as eth0, eth1, ..., with the eth0 being hooked up to the default route. This provides a simple little one-shot service that reads the ifcfg-* files gets the HWADDR and DEVICE values from there, and matches them to the physical devices, and names them accordingly. I know, this should be the job of udev, but there are some problems with early RHEL 7. This simple code assumes that selinux is disabled. %prep %setup -q %install install -d %{buildroot}%{_unitdir} \ %{buildroot}%{_sysconfdir} \ %{buildroot}%{_bindir} \ %{buildroot}%{_sysconfdir}/cron.d \ %{buildroot}/var/log/%{name} install -p -m 755 %{name} %{buildroot}%{_bindir}/%{name} install -p -m 644 %{name}.service %{buildroot}%{_unitdir}/%{name}.service install -p -m 644 %{name}.cron %{buildroot}%{_sysconfdir}/cron.d/%{name} %post %systemd_post %{name}.service # This really needs enabling after installation by kickstart: if [ $1 -eq 1 ]; then systemctl enable %{name}.service > /dev/null 2>&1 || : fi %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %files %defattr(-,root,root) %{_bindir}/%{name} %{_unitdir}/%{name}.service %{_sysconfdir}/cron.d/%{name} %dir /var/log/%{name} %changelog * Mon Mar 14 2016 Nick Urbanik - 1.0-1 - Initial build. * Mon Mar 14 2016 Nick Urbanik - 1.0-2 - Do not depend on systemd presets; enable this.