Automatically checks and installs the Shell script of the specified RPM offline

Source: Internet
Author: User

Preparation: 1. Prepare the rpm file to be installed.
2. Write the rpm file to the file list pkg. lst (the file name is optional)
3. install. sh

Directory structure
|-Install. sh
|-Pkg. lst
|-Readme.txt
|-Xxxx. rpm
|-Yyyy. rpm
|-Installation process: 1. Put the rpm file to this directory.
2. Write the pkg. lst file list in the rpm file list in the dependent order. An example is as follows:
Gcc-c ++-4.1.2
Glibc-2.5-24
Glibc-common-2.5
Glibc-devel-2.5
Glibc-headers-2.5
Kernel-headers-2.6.18
3. Upload All files in this directory to the Linux machine to be installed (rpm supported)
4. Add install. sh executable permission: chmod a + x install. sh
5. Run the installation script:./install. sh pkg. lst.
(End)

Note: When editing these files under the Window, you must specify the unix line terminator. Otherwise, an error is reported in the unix system. Attachment: installation script install. sh

#! /Bin/basffe [$ #-ne 1]; then echo "Usage: $0 rpmlist" exit 1 fiRPMLIST = $1 ERRFILE = ~ /Rpminst 'date + % Y % m % d % H % m % s '. errfor pkg in 'cat $ rpmlist' do rpm-qa | grep $ pkg &>/dev/null if [$? -Ne 0]; then echo $ pkg is not installed yet, starting to install... rpm-Uvh $ pkg * 2> $ ERRFILE else echo $ pkg already installed. fidone

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.