The ipvtn system automatically detects and installs the required software packages.
Source: Internet
Author: User
The iketn system automatically detects and installs the required software package. remember that the first time I started to get in touch with Linux, I started to use the iketn9.04 system. In 10 years, I had a second-hand Pentium 4 m Dell notebook. At that time, I was very curious and very interested. in that 20 GB hard disk space, I had to go over and over again... the iketn system automatically detects and installs the required software package. remember that the first time I started to get in touch with Linux, I started to use the iketn9.04 system. In 10 years, I had a second-hand Pentium 4 m Dell notebook. At that time, I was very curious and very interested. in the 20 GB hard disk space, I had to install xp and ipvtn9.04 dual systems, although I would not use the Linux system. Later, I installed two versions 9.10 and 10.04 on it. they were purely for the sake of freshness and were basically useless. The only benefit is familiarity with the Linux environment and installation. After that, I started to learn about the knowledge and commands of Linux systems. on the new computer, I had to go through versions like 10.10, 11.04, 12.04, and Fedora16 and Fedora17. Every time a new system is installed, because the cd iso version is used, you have to download and install some commonly used tools and commands one by one. For the last installation of the 12.04 server, the installation and update of the software package did not end all night, because I do not know how to use the domestic warehouse source. In addition, I manually install tools one by one and wait for the results. This time I plan to toss a handful of Debian 7, and I hope that the system will be reduced in the future. Therefore, a shell script is written to automatically detect and install the required software package after the system is installed. 01 #! /Bin/bash02 03 # check whether some essential packages exist.04 # if not installed, install them from software repos.05 # essential packages: 06 # gcc g ++ gdb make07 # exuberant-ctags cscope08 # ftp tree wget curl lynx09 # openssh-server openssh-client10 # mysql-server mysql-client11 # vim git svn RC sed gawk12 # chromium-browser13 14MY_PROGRAM_PACKS = "gcc g ++ gdb make exuberant-ctags cs1_vim git" 15MY_UTI LITY_PACKS = "ftp tree wget curl lynx sed gawk chromium-browser" 16MY_MANAGE_PACKS = "openssh-server openssh-client mysql-server mysql-client" 17 18MY_PACKS = "$ response $ MY_MANAGE_PACKS "19 20STATUS_1 =" installed "21STATUS_2 =" not installed "22 23 # for statistics logs = 25NEW_INS_PACKS = packets = 27 28 29for pack in $ MY_PACKS30do31 echo" checking for $ pack... "32 33 status = 'aptitude show $ pack | grep State: | cut-d": "-f 2 '34 version = 'aptitude show $ pack | grep Version: | cut-d ": "-f 2-'35 36 if [" $ status "=" $ STATUS_1 "] 37 then38 INIT_INS_PACKS =" $ INIT_INS_PACKS $ pack "39 echo" $ pack is $ status, version is $ version "40 else41 echo" $ pack is $ status, start to install $ version... "42 aptitude install $ pack43 if [$? -Eq 0] 44 then45 NEW_INS_PACKS = "$ NEW_INS_PACKS $ pack" 46 echo "install $ pack ($ version) successfully. "47 else48 FAIL_INS_PACKS =" $ FAIL_INS_PACKS $ pack "49 echo" install $ pack ($ version) failed. "50 fi51 fi52 echo" checking $ pack done. "53done54 55 echo" the checking packages result: "56 echo" initial installed packages: $ INIT_INS_PACKS "57 echo" new installed packages: $ NEW_INS_PACKS "58 echo" failed ins Talled packages: $ FAIL_INS_PACKS "59 60 exit 0 script is intended for Linux distributions using the APT package management system, such as Debian and ipvtn. For Linux releases using other package management systems such as RHEL, CentOS, and Fedora, you only need to replace the package management command aptitude in the script with the corresponding command, for example, the yum command in CentOS, of course, note that the extraction of state and version information may be different.
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.