From 36fd67b75c9cdc5cabab898322317927eabe7496 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 18 Nov 2015 13:05:47 +0800 Subject: [PATCH 1/2] Fix indent and code style --- xCAT/debian/postinst | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/xCAT/debian/postinst b/xCAT/debian/postinst index 998d9d844..09aeaed1e 100644 --- a/xCAT/debian/postinst +++ b/xCAT/debian/postinst @@ -20,12 +20,12 @@ set -e case "$1" in configure) - #make dir for the current pid - mkdir -p /var/run/xcat - cp -f /opt/xcat/share/xcat/scripts/xHRM /install/postscripts/ - . /etc/profile.d/xcat.sh - if [ -f /tmp/xCAT_upgrade.tmp ] - then + # Make dir for the current pid + mkdir -p /var/run/xcat + cp -f /opt/xcat/share/xcat/scripts/xHRM /install/postscripts/ + . /etc/profile.d/xcat.sh + if [ -f /tmp/xCAT_upgrade.tmp ] + then if [ -r "/tmp/xcat/installservice.pid" ]; then mv /tmp/xcat/installservice.pid /var/run/xcat/installservice.pid fi @@ -35,16 +35,15 @@ case "$1" in if [ -r "/tmp/xcat/mainservice.pid" ]; then mv /tmp/xcat/mainservice.pid /var/run/xcat/mainservice.pid fi - xcatconfig -u - rm /tmp/xCAT_upgrade.tmp - else - xcatconfig -i -d -s - fi + xcatconfig -u + rm /tmp/xCAT_upgrade.tmp + else + xcatconfig -i -d -s + fi -# [ -e /etc/apache2/conf-enabled/xcat.conf ] && rm /etc/apache2/conf-enabled/xcat.conf - ln -s -f /etc/apache2/conf-available/xcat.conf.apach24 /etc/apache2/conf-enabled/xcat.conf + ln -s -f /etc/apache2/conf-available/xcat.conf.apach24 /etc/apache2/conf-enabled/xcat.conf - /etc/init.d/apache2 restart + /etc/init.d/apache2 restart # Let rsyslogd perform close of any open files if [ -e /var/run/rsyslogd.pid ]; then From c4367da51e3ded38dff5b98c189a26a798d54123 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 23 Nov 2015 14:19:41 +0800 Subject: [PATCH 2/2] Dirty hack, fix the permission of direcotry /var/log/xcat --- xCAT-server/share/xcat/install/scripts/post.ubuntu | 9 ++++++++- xCAT-server/share/xcat/install/scripts/post.xcat | 9 +++++++-- xCAT/postscripts/syslog | 3 ++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu b/xCAT-server/share/xcat/install/scripts/post.ubuntu index 26d062e8b..2e6d77a55 100755 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu @@ -153,6 +153,14 @@ return_value=0 run_ps () { local ret_local=0 mkdir -p "\"/var/log/xcat\"" + # On Ubuntu, the rsyslogd daemon write log files with syslog:adm + # permissison. And in some case, the directory /var/log/xcat was + # created by xCAT, and had root:root ownership. In this way, rsyslogd + # did not have enough permission to write to log files under this + # directory. + # As a dirty hack, change the ownership of directory /var/log/xcat + # to the same ownership of directory /var/log. + chown `ls -ld /var/log | awk '{ print \$3\":\"\$4 }'` "\"/var/log/xcat\"" local logfile=\"/var/log/xcat/xcat.log\" if [ -f \$1 ]; then @@ -300,4 +308,3 @@ cd / #rm -Rf /xcatpost #rm -f /tmp/mypostscript exit 0 - diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 0ad6ce8e6..abc36d1c8 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -138,6 +138,13 @@ return_value=0 run_ps () { local ret_local=0 mkdir -p "\"/var/log/xcat\"" + # On some Linux distro, the rsyslogd daemon write log files with permision + # other than root:root. And in some case, the directory /var/log/xcat was + # created by xCAT, and had root:root ownership. In this way, rsyslogd + # did not have enough permission to write to log files under this directory. + # As a dirty hack, change the ownership of directory /var/log/xcat to the + # same ownership of directory /var/log. + chown `ls -ld /var/log | awk '{ print \$3\":\"\$4 }'` "\"/var/log/xcat\"" local logfile=\"/var/log/xcat/xcat.log\" if [ -f \$1 ]; then @@ -274,5 +281,3 @@ updateflag.awk $MASTER 3002 cd / #rm -Rf /xcatpost #rm -f /xcatpost/mypostscript - - diff --git a/xCAT/postscripts/syslog b/xCAT/postscripts/syslog index 1b0aa07b4..2403351e8 100755 --- a/xCAT/postscripts/syslog +++ b/xCAT/postscripts/syslog @@ -348,7 +348,8 @@ else #making sure all the messages goes to /var/log/messages touch /var/log/messages if ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ) || ( pmatch $OSVER "debian*" ); then - chown syslog:adm /var/log/messages + chown --reference=/var/log /var/log/messages + chown --reference=/var/log /var/log/xcat fi if [ $ng -eq 0 ]; then if [ ! -f $conf_file.XCATORIG ]; then