From 1f7560e25d0f5fa7dd2a609a7726eee7f6b8097c Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 21 Apr 2010 17:21:06 -0600 Subject: [PATCH] maint: enforce whitespace on shell scripts Noticed because virt-pki-validate was very inconsistent on using tabs vs. 8 spaces, sometimes mixing both paradigms on a single line. 'git diff -b' shows significant changes only in cfg.mk. * cfg.mk (sc_TAB_in_indentation): Add a few files. * daemon/libvirtd.init.in: Avoid tabs. * tools/virt-pki-validate.in: Likewise. --- cfg.mk | 4 +- daemon/libvirtd.init.in | 6 +- tools/virt-pki-validate.in | 138 ++++++++++++++++++------------------- 3 files changed, 74 insertions(+), 74 deletions(-) diff --git a/cfg.mk b/cfg.mk index 790d3570c3..105b625517 100644 --- a/cfg.mk +++ b/cfg.mk @@ -139,8 +139,8 @@ sc_prohibit_ctype_h: # files in gnulib, since they're imported. sc_TAB_in_indentation: @prohibit='^ * ' \ - in_vc_files='\.(rng|[ch](\.in)?)$$' \ - halt='use spaces, not TAB, for indentation in C sources and RNG schemas' \ + in_vc_files='(\.(rng|[ch](\.in)?)|(daemon|tools)/.*\.in)$$' \ + halt='use spaces, not TAB, for indentation in C, sh, and RNG schemas' \ $(_sc_search_regexp) ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\ diff --git a/daemon/libvirtd.init.in b/daemon/libvirtd.init.in index 4c8821b2ce..d4dc98b1bb 100644 --- a/daemon/libvirtd.init.in +++ b/daemon/libvirtd.init.in @@ -72,7 +72,7 @@ stop() { if [ $RETVAL -eq 0 ]; then rm -f @localstatedir@/lock/subsys/$SERVICE rm -f $PIDFILE - rm -rf @localstatedir@/cache/libvirt/* + rm -rf @localstatedir@/cache/libvirt/* fi } @@ -101,13 +101,13 @@ case "$1" in ;; force-reload) reload - ;; + ;; condrestart|try-restart) [ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || : ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload|try-restart}" - exit 2 + exit 2 ;; esac exit $RETVAL diff --git a/tools/virt-pki-validate.in b/tools/virt-pki-validate.in index ee7b79d5d7..9a1c6fae17 100755 --- a/tools/virt-pki-validate.in +++ b/tools/virt-pki-validate.in @@ -147,35 +147,35 @@ then if [ ! -r $LIBVIRT/clientcert.pem ] then echo Client certificate $LIBVIRT/clientcert.pem should be world readable - echo "as root do: chown root:root $LIBVIRT/clientcert.pem ; chmod 644 $LIBVIRT/clientcert.pem" + echo "as root do: chown root:root $LIBVIRT/clientcert.pem ; chmod 644 $LIBVIRT/clientcert.pem" else S_ORG=`$CERTOOL -i --infile $LIBVIRT/clientcert.pem | grep Subject: | sed 's+.*O=\([a-zA-Z \._-]*\).*+\1+'` - if [ "$ORG" != "$S_ORG" ] - then - echo The CA certificate and the client certificate do not match - echo CA organization: $ORG - echo Client organization: $S_ORG - fi - CLIENT=`$CERTOOL -i --infile $LIBVIRT/clientcert.pem | grep Subject: | sed 's+.*CN=\(.[a-zA-Z \._-]*\).*+\1+'` - echo Found client certificate $LIBVIRT/clientcert.pem for $CLIENT - if [ ! -e $LIBVIRTP/clientkey.pem ] - then - echo Missing client private key $LIBVIRTP/clientkey.pem - else - echo Found client private key $LIBVIRTP/clientkey.pem - OWN=`ls -l $LIBVIRTP/clientkey.pem | awk '{ print $3 }'` - MOD=`ls -l $LIBVIRTP/clientkey.pem | awk '{ print $1 }'` - if [ "$OWN" != "root" ] - then - echo The client private key should be owned by root - echo "as root do: chown root $LIBVIRTP/clientkey.pem" - fi - if [ "$MOD" != "-rw-r--r--" ] - then - echo The client private key need to be read by client tools - echo "as root do: chmod 644 $LIBVIRTP/clientkey.pem" - fi - fi + if [ "$ORG" != "$S_ORG" ] + then + echo The CA certificate and the client certificate do not match + echo CA organization: $ORG + echo Client organization: $S_ORG + fi + CLIENT=`$CERTOOL -i --infile $LIBVIRT/clientcert.pem | grep Subject: | sed 's+.*CN=\(.[a-zA-Z \._-]*\).*+\1+'` + echo Found client certificate $LIBVIRT/clientcert.pem for $CLIENT + if [ ! -e $LIBVIRTP/clientkey.pem ] + then + echo Missing client private key $LIBVIRTP/clientkey.pem + else + echo Found client private key $LIBVIRTP/clientkey.pem + OWN=`ls -l $LIBVIRTP/clientkey.pem | awk '{ print $3 }'` + MOD=`ls -l $LIBVIRTP/clientkey.pem | awk '{ print $1 }'` + if [ "$OWN" != "root" ] + then + echo The client private key should be owned by root + echo "as root do: chown root $LIBVIRTP/clientkey.pem" + fi + if [ "$MOD" != "-rw-r--r--" ] + then + echo The client private key need to be read by client tools + echo "as root do: chmod 644 $LIBVIRTP/clientkey.pem" + fi + fi fi else @@ -193,41 +193,41 @@ then if [ ! -r $LIBVIRT/servercert.pem ] then echo Server certificate $LIBVIRT/servercert.pem should be world readable - echo "as root do: chown root:root $LIBVIRT/servercert.pem ; chmod 644 $LIBVIRT/servercert.pem" + echo "as root do: chown root:root $LIBVIRT/servercert.pem ; chmod 644 $LIBVIRT/servercert.pem" else S_ORG=`$CERTOOL -i --infile $LIBVIRT/servercert.pem | grep Subject: | sed 's+.*O=\([a-zA-Z\. _-]*\).*+\1+'` - if [ "$ORG" != "$S_ORG" ] - then - echo The CA certificate and the server certificate do not match - echo CA organization: $ORG - echo Server organization: $S_ORG - fi - S_HOST=`$CERTOOL -i --infile $LIBVIRT/servercert.pem | grep Subject: | sed 's+.*CN=\([a-zA-Z\. _-]*\)+\1+'` - if test "$S_HOST" != "`hostname -s`" && test "$S_HOST" != "`hostname`" - then - echo The server certificate does not seem to match the host name - echo hostname: '"'`hostname`'"' - echo Server certificate CN: '"'$S_HOST'"' - fi - echo Found server certificate $LIBVIRT/servercert.pem for $S_HOST - if [ ! -e $LIBVIRTP/serverkey.pem ] - then - echo Missing server private key $LIBVIRTP/serverkey.pem - else - echo Found server private key $LIBVIRTP/serverkey.pem - OWN=`ls -l $LIBVIRTP/serverkey.pem | awk '{ print $3 }'` - MOD=`ls -l $LIBVIRTP/serverkey.pem | awk '{ print $1 }'` - if [ "$OWN" != "root" ] - then - echo The server private key should be owned by root - echo "as root do: chown root $LIBVIRTP/serverkey.pem" - fi - if [ "$MOD" != "-rw-------" ] - then - echo The server private key need to be read only by root - echo "as root do: chmod 600 $LIBVIRTP/serverkey.pem" - fi - fi + if [ "$ORG" != "$S_ORG" ] + then + echo The CA certificate and the server certificate do not match + echo CA organization: $ORG + echo Server organization: $S_ORG + fi + S_HOST=`$CERTOOL -i --infile $LIBVIRT/servercert.pem | grep Subject: | sed 's+.*CN=\([a-zA-Z\. _-]*\)+\1+'` + if test "$S_HOST" != "`hostname -s`" && test "$S_HOST" != "`hostname`" + then + echo The server certificate does not seem to match the host name + echo hostname: '"'`hostname`'"' + echo Server certificate CN: '"'$S_HOST'"' + fi + echo Found server certificate $LIBVIRT/servercert.pem for $S_HOST + if [ ! -e $LIBVIRTP/serverkey.pem ] + then + echo Missing server private key $LIBVIRTP/serverkey.pem + else + echo Found server private key $LIBVIRTP/serverkey.pem + OWN=`ls -l $LIBVIRTP/serverkey.pem | awk '{ print $3 }'` + MOD=`ls -l $LIBVIRTP/serverkey.pem | awk '{ print $1 }'` + if [ "$OWN" != "root" ] + then + echo The server private key should be owned by root + echo "as root do: chown root $LIBVIRTP/serverkey.pem" + fi + if [ "$MOD" != "-rw-------" ] + then + echo The server private key need to be read only by root + echo "as root do: chmod 600 $LIBVIRTP/serverkey.pem" + fi + fi fi else @@ -243,19 +243,19 @@ then if [ -r $(SYSCONFDIR)/sysconfig/libvirtd ] then if [ "`grep '^LIBVIRTD_ARGS' $(SYSCONFDIR)/sysconfig/libvirtd | grep -- '--listen'`" = "" ] - then - echo Make sure $(SYSCONFDIR)/sysconfig/libvirtd is setup to listen to - echo TCP/IP connections and restart the libvirtd service - fi + then + echo Make sure $(SYSCONFDIR)/sysconfig/libvirtd is setup to listen to + echo TCP/IP connections and restart the libvirtd service + fi fi if [ -r $(SYSCONFDIR)/sysconfig/iptables ] then if [ "`grep $PORT $(SYSCONFDIR)/sysconfig/iptables`" = "" ] - then - echo Make sure $(SYSCONFDIR)/sysconfig/iptables is setup to allow - echo incoming TCP/IP connections on port $PORT and - echo restart the iptables service - fi + then + echo Make sure $(SYSCONFDIR)/sysconfig/iptables is setup to allow + echo incoming TCP/IP connections on port $PORT and + echo restart the iptables service + fi fi fi