Python automated installation source software package

Source: Internet
Author: User

#!/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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.