https://bugzilla.novell.com/show_bug.cgi?id=883999
https://bugzilla.novell.com/show_bug.cgi?id=883999#c14
--- Comment #14 from Petr Gajdos 2014-07-24 11:30:00 UTC ---
Is that better?
%pre
if [ "0$1" -ge "2" ]; then
if [ -f /etc/HOSTNAME -a ! -L /etc/HOSTNAME ]; then
if [ -f /etc/hostname ]; then
mv /etc/hostname /etc/hostname.rpmsave
fi
ln -f /etc/HOSTNAME /etc/HOSTNAME.rpmsave
rm /etc/HOSTNAME
fi
fi
%post
if [ -f /etc/HOSTNAME.rpmsave -a ! -L /etc/HOSTNAME.rpmsave ]; then
cp -a /etc/HOSTNAME.rpmsave /etc/hostname
fi
As far as I tested (similarly like summarized in comment 4):
before update:
==============
# | /etc/HOSTNAME | /etc/hostname | probability
---|--------------------------------------------
1. | regular | - | very high
2. | - | regular | very low
3. | regular | symlink | high
4. | symlink | regular | very low
5. | regular | regular | very low
6. | hardlink | hardlink | high
after update:
=============
1.
lrwxrwxrwx 1 root root 8 Jul 24 09:21 HOSTNAME -> hostname
-rw-r--r-- 1 root root 7 Jul 24 09:19 HOSTNAME.rpmsave
-rw-r--r-- 1 root root 7 Jul 24 09:19 hostname
hostname and HOSTNAME.rpmsave have content and timestamp of original HOSTNAME
2.
lrwxrwxrwx 1 root root 8 Jul 23 13:25 HOSTNAME -> hostname
-rw-r--r-- 1 root root 7 Jul 23 13:24 hostname
-rw-r--r-- 1 root root 11 Jul 23 13:09 hostname.rpmnew
hostname untouched
3.
lrwxrwxrwx 1 root root 8 Jul 24 09:39 HOSTNAME -> hostname
-rw-r--r-- 1 root root 7 Jul 24 09:38 HOSTNAME.rpmsave
-rw-r--r-- 1 root root 7 Jul 24 09:38 hostname
-rw-r--r-- 1 root root 11 Jul 24 08:51 hostname.rpmnew
lrwxrwxrwx 1 root root 13 Jul 24 09:38 hostname.rpmsave ->
/etc/HOSTNAME
hostname carries the content and timestamp of original HOSTNAME
4.
lrwxrwxrwx 1 root root 8 Jul 24 08:55 HOSTNAME -> hostname
lrwxrwxrwx 1 root root 13 Jul 24 08:54 HOSTNAME.rpmsave ->
/etc/hostname
-rw-r--r-- 1 root root 7 Jul 24 08:54 hostname
-rw-r--r-- 1 root root 11 Jul 24 08:51 hostname.rpmnew
hostname carries the content and timestamp of original HOSTNAME
5.
lrwxrwxrwx 1 root root 8 Jul 24 09:46 HOSTNAME -> hostname
-rw-r--r-- 1 root root 16 Jul 24 09:44 HOSTNAME.rpmsave
-rw-r--r-- 1 root root 16 Jul 24 09:44 hostname
-rw-r--r-- 1 root root 11 Jul 24 08:51 hostname.rpmnew
-rw-r--r-- 1 root root 16 Jul 24 09:45 hostname.rpmsave
*.rpmsave carry contents and timestamps of respective originals
hostname carries contents and timestamp of original HOSTNAME
6.
lrwxrwxrwx 1 root root 8 Jul 24 09:54 HOSTNAME -> hostname
-rw-r--r-- 2 root root 7 Jul 24 09:53 HOSTNAME.rpmsave
-rw-r--r-- 1 root root 7 Jul 24 09:53 hostname
-rw-r--r-- 1 root root 11 Jul 24 08:51 hostname.rpmnew
-rw-r--r-- 2 root root 7 Jul 24 09:53 hostname.rpmsave
hostname and *rpmsave carry content and timestamp of original
file
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.