From 2052abef7fd767dd737e96c7b83a5b84c9826b8c1dcd40ed4231ae8751db80d3 Mon Sep 17 00:00:00 2001 From: Petr Gajdos Date: Wed, 11 Jun 2014 09:24:00 +0000 Subject: [PATCH] - move /etc/HOSTNAME to /etc/hostname during update OBS-URL: https://build.opensuse.org/package/show/Base:System/netcfg?expand=0&rev=22 --- netcfg.changes | 5 +++++ netcfg.spec | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/netcfg.changes b/netcfg.changes index b000d63..2b2b033 100644 --- a/netcfg.changes +++ b/netcfg.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Jun 11 08:47:56 UTC 2014 - pgajdos@suse.com + +- move /etc/HOSTNAME to /etc/hostname during update + ------------------------------------------------------------------- Wed Jun 4 10:36:22 UTC 2014 - pgajdos@suse.com diff --git a/netcfg.spec b/netcfg.spec index 08fbb03..8f9b160 100644 --- a/netcfg.spec +++ b/netcfg.spec @@ -81,6 +81,21 @@ if [ "0$1" -ge "2" ]; then cp %{_sysconfdir}/netgroup.rpmsave %{_sysconfdir}/...netgroup.new.rpmnew fi fi +#/etc/HOSTNAME renamed to /etc/hostname [bnc#858908] +#On Tue, Jun 10, 2014 at 03:23:00PM +0200, Frederic Crozat wrote: +#> So, it means netcfg should have a %pre which check if /etc/HOSTNAME is a +#> filename (and not a symlink) and in that case, rename the file +#> to /etc/hostname. This should ensure /etc/HOSTNAME is properly created +#> by RPM. +set -x +if [ "0$1" -ge "2" ]; then + if [ -f /etc/HOSTNAME -a ! -h /etc/HOSTNAME ]; then + if [ -f /etc/hostname ]; then + mv /etc/hostname /etc/hostname.rpmsave + fi + mv /etc/HOSTNAME /etc/hostname + fi +fi %post test -f etc/defaultdomain.rpmnew -a ! -s etc/defaultdomain.rpmnew && rm -f etc/defaultdomain.rpmnew