#!/usr/bin/env python
#-*-Coding:utf:8-*-
#create by, Mineral water 2015/7/30
Import Sys,commands
If Len (sys.argv) = = 2:
Software = sys.argv[1]
Commands.getstatusoutput (' Tar zxvf%s &> install.log 2>&1 '%software)
Software = Software.split ('. ')
Software.pop (-1)
Software.pop (-1)
software = '. '. Join (software)
Software_name = Software.split ('-')
If software_NAME[0] = = ' httpd ':
Software_install = Commands.getstatusoutput (' cd%s &&./configure--prefix=/usr/local/apache--enable-so-- Enable-rewrite--enable-proxy--enable-ssl--with-ssl &>>. /install.log 2>&1 && make &>>. /install.log 2>&1 && make install &>>. /install.log 2>&1 '%software)
If software_install[0]! = 0:
Commands.getstatusoutput (' echo ' installation Failed ">> Install.log ')
Else
Commands.getstatusoutput (' echo ' successful Installation ">> Install.log ')
Elif software_NAME[0] = = ' php ':
Software_install = Commands.getstatusoutput (' cd%s &&./configure--prefix=/usr/local/%s-- With-config-file-path=/usr/local/domob/%s/etc--with-apxs2=/usr/local/apache/bin/apxs--enable-mbstring-- Enable-ftp--with-jpeg-dir=/usr--with-png-dir=/usr--enable-magic-quotes--enable-magic-quotes--enable-sockets-- Enable-sockets--with-zlib--with-libxml-dir=/usr--without-xmlrpc--enable-xml--enable-shmop--enable-shmop-- With-mhash--with-mhash--with-curlwrappers--with-curlwrappers &>>. /install.log 2>&1 && make &>>. /install.log 2>&1 && make install &>>. /install.log 2>&1 '% (software,software,software))
If software_install[0]! = 0:
Commands.getstatusoutput (' echo ' installation Failed ">> Install.log ')
Else
Commands.getstatusoutput (' echo ' successful Installation ">> Install.log ')
Else
print ' currently only Apche and PHP automated installation methods '
Sys.exit (2)
Else
print ' Usage:python install.py httpd-2.2.31.tar.gz & '
Sys.exit (2)
#其他软件包增加elif相关即可
This article is from the ", Mineral water" blog, please be sure to keep this source http://guwenqiang.blog.51cto.com/5462040/1680050
Python automated installation source software package