Details
-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
8.1
-
None
Description
In the RPM spec file for xenserver-release, the %post scriptlet for the xenserver-release-config package contains those few lines that are intended for updates of the package, not for initial installation (according to the comments).
# Add myhostname to the hosts line of nsswitch.conf if it is not there already. # This needs to be kept until the next upgrade-only release after 8.0. grep -q '^hosts:.*myhostname' %{_sysconfdir}/nsswitch.conf || sed -i 's/^hosts:.*/\0 myhostname/' %{_sysconfdir}/nsswitch.conf # Add ntp configuration to /etc/sysconfig/network which is written # normally by the installer. # This needs to be kept until the next upgrade-only release after 8.0. grep -q '^NTPSERVERARGS=' %{_sysconfdir}/sysconfig/network || echo 'NTPSERVERARGS="iburst prefer"' >> %{_sysconfdir}/sysconfig/network
Thus, it would be better to test whether it is executed during an update or an installation.
This would become:
if [ $1 -gt 1 ]; then # Add myhostname to the hosts line of nsswitch.conf if it is not there already. # This needs to be kept until the next upgrade-only release after 8.0. grep -q '^hosts:.*myhostname' %{_sysconfdir}/nsswitch.conf || sed -i 's/^hosts:.*/\0 myhostname/' %{_sysconfdir}/nsswitch.conf # Add ntp configuration to /etc/sysconfig/network which is written # normally by the installer. # This needs to be kept until the next upgrade-only release after 8.0. grep -q '^NTPSERVERARGS=' %{_sysconfdir}/sysconfig/network || echo 'NTPSERVERARGS="iburst prefer"' >> %{_sysconfdir}/sysconfig/network fi
Currently, the installation logs contain an error message due to /etc/sysconfig/network file not existing. I don't think there are consequences, but it seems it could be avoided easily:
INFO [2020-01-09 11:35:28] YUM: Installing : xenserver-release-config-8.1.0-1.x86_64 430/533 INFO [2020-01-09 11:35:28] YUM: grep: /etc/sysconfig/network: No such file or directory