----------------------
Available at
http://libvirt.org/git/?p=autotest.git;a=shortlog;h=refs/heads/libvirt-test-API
there is also a patch from Guannan Ren (way bigger) adding
libvirt-test-API python test framework to review when you have time :)

Maybe the script can be renamed to contrib/install-autotest-server.sh
now ;-)
----------------------

Changes in this patch for those distros:
- we need to use EPEL repos on get some of the needed packages
- we use init.d and not systemctl on the older OSes
- the lsb package provide a required support of the init.d script

A generic fix to skip out 192.168.122.x nextwork addresses usually
associated to libvirt default network (fixes the last output message
not an installation problem)

Signed-off-by: Daniel Veillard <[email protected]>

diff --git a/contrib/install-autotest-server-f16.sh 
b/contrib/install-autotest-server-f16.sh
index 17e2810..4dd96f0 100755
--- a/contrib/install-autotest-server-f16.sh
+++ b/contrib/install-autotest-server-f16.sh
@@ -145,6 +145,19 @@ EOF
 
 fi
 
+if [ -f /etc/redhat-release ]
+then
+  
+    if [ ! -f /etc/yum.repos.d/epel.repo ]
+    then
+        if [ "`grep 'release 6' /etc/redhat-release`" != "" ]
+        then
+            print_log "INFO" "Adding EPEL 6 repository"
+            rpm -ivh 
http://download.fedoraproject.org/pub/epel/6/`arch`/epel-release-6-5.noarch.rpm 
>> $LOG 2>&1
+        fi
+    fi
+fi
+
 print_log "INFO" "Installing utility packages"
 yum install -y unzip wget >> $LOG 2>&1
 print_log "INFO" "Installing webserver packages"
@@ -155,6 +168,8 @@ print_log "INFO" "Installing development packages"
 yum install -y git java-1.6.0-openjdk-devel >> $LOG 2>&1
 print_log "INFO" "Installing python libraries"
 yum install -y python-imaging python-crypto python-paramiko python-httplib2 
numpy python-matplotlib python-atfork >> $LOG 2>&1
+print_log "INFO" "Installing/updating lsb package"
+yum install -y lsb >> $LOG 2>&1
 print_log "INFO" "Installing/updating selinux policy"
 yum install -y selinux-policy selinux-policy-targeted policycoreutils-python 
>> $LOG 2>&1
 
@@ -169,8 +184,14 @@ fi
 setenforce 0
 
 print_log "INFO" "Starting MySQL server"
-systemctl enable mysqld.service >> $LOG
-systemctl restart mysqld.service >> $LOG
+if [ -x /etc/init.d/mysqld ]
+then
+    chkconfig --level 2345 mysqld on >> $LOG
+    /etc/init.d/mysqld restart >> $LOG
+else
+    systemctl enable mysqld.service >> $LOG
+    systemctl restart mysqld.service >> $LOG
+fi
 
 print_log "INFO" "Installing autotest"
 if [ "$(grep "^autotest:" /etc/passwd)" = "" ]
@@ -229,7 +250,12 @@ then
     ln -s /usr/local/autotest/apache/conf/all-directives 
/etc/httpd/conf.d/autotest.conf
     service httpd configtest
 fi
-systemctl enable httpd.service >> $LOG
+if [ -x /etc/init.d/httpd ]
+then
+    chkconfig --level 2345 httpd on
+else
+    systemctl enable httpd.service >> $LOG
+fi
 
 print_log "INFO" "Setting up the autotest configuration files"
 
@@ -254,7 +280,12 @@ else
 fi
 
 print_log "INFO" "Re-starting MySQL server"
-systemctl restart mysqld.service >> $LOG
+if [ -x /etc/init.d/mysqld ]
+then
+    /etc/init.d/mysqld restart >> $LOG
+else
+    systemctl restart mysqld.service >> $LOG
+fi
 
 # Patch up a python 2.7 problem
 if [ "$(grep '^CFUNCTYPE(c_int)(lambda: None)' 
/usr/lib64/python2.7/ctypes/__init__.py)" != "" ]
@@ -273,15 +304,30 @@ cat << EOF | su - autotest >> $LOG
 EOF
 
 print_log "INFO" "Restarting web server"
-systemctl restart httpd.service
+if [ -x /etc/init.d/httpd ]
+then
+    /etc/init.d/httpd restart
+else
+    systemctl restart httpd.service
+fi
 
 print_log "INFO" "Starting the scheduler"
-cp $ATHOME/utils/autotestd.service /etc/systemd/system/ >> $LOG
-systemctl daemon-reload >> $LOG
-systemctl enable autotestd.service >> $LOG
-systemctl stop autotestd.service >> $LOG
-rm -f $ATHOME/monitor_db_babysitter.pid $ATHOME/monitor_db.pid
-systemctl start autotestd.service >> $LOG
+if [ -x /etc/init.d/httpd ]
+then
+    cp $ATHOME/utils/autotest.init /etc/init.d/autotest >> $LOG
+    chmod +x /etc/init.d/autotest >> $LOG
+    chkconfig --level 2345 autotest on >> $LOG
+    /etc/init.d/autotest stop >> $LOG
+    rm -f $ATHOME/monitor_db_babysitter.pid $ATHOME/monitor_db.pid
+    /etc/init.d/autotest start >> $LOG
+else
+    cp $ATHOME/utils/autotestd.service /etc/systemd/system/ >> $LOG
+    systemctl daemon-reload >> $LOG
+    systemctl enable autotestd.service >> $LOG
+    systemctl stop autotestd.service >> $LOG
+    rm -f $ATHOME/monitor_db_babysitter.pid $ATHOME/monitor_db.pid
+    systemctl start autotestd.service >> $LOG
+fi
 
 if [ "$(grep -- '--dport 80 -j ACCEPT' /etc/sysconfig/iptables)" = "" ]
 then
@@ -296,7 +342,12 @@ then
     cp /tmp/tmp$$ /etc/sysconfig/iptables
     rm /tmp/tmp$$
 
-    systemctl restart iptables.service >> $LOG
+    if [ -x /etc/init.d/iptables ]
+    then
+        /etc/init.d/iptables restart >> $LOG
+    else
+        systemctl restart iptables.service >> $LOG
+    fi
 fi
 
 print_log "INFO" "$(systemctl status autotestd.service)"
@@ -305,5 +356,5 @@ cd $ATHOME/client/common_lib/
 VERSION="$(./version.py)"
 print_log "INFO" "Finished installing autotest server $VERSION at: $(date)"
 
-IP="$(ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | awk 
'{ print $1}')"
+IP="$(ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | grep -v 192.168.122 
| cut -d: -f2 | awk '{ print $1}')"
 print_log "INFO" "You can access your server on http://$IP/afe";

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
[email protected]  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to