Create a Linux. Bin Installation File

Source: Internet
Author: User

A Linux Installation File

Common Linux installation methods include tar, zip, GZ, rpm, Deb, and bin. We can simply divide it into three categories,

1. Package or compress the tar, zip, and GZ files. Generally, unzip the files, or decompress the files to run the sh files;

Second, corresponding to Deb and RPM with management tools. Generally, such installation files can be simply installed through a third-party command line or UI, such as apt in Ubuntu to install Deb, install RPM using yum in RedHat;

Third: image. the bin class is to package SH and zip as bin, or package SH and RPM as bin. When you run the bin installation file on the command line, in fact, it is the sh in the bin to decompress the zip in the bin or install the RPM process;

 

Ii. Bin Installation File

The. Bin installation file can be considered as a package of SH files, zip files, rpm, and other installation files. For example:

 

Advantages of. Bin installation files:

1) only one package is the. binfile;

2) It can run directly on Linux, because it is SH (the first half of it is SH );

3) The sh contains the protocol information to be received by the user and prompts the user to receive the message. If the user does not receive the message, the installation will exit;

 

Iii. Bin Installation File Execution

1) super simple: Sh XXXX. bin or directly XXXX. Bin.

2) The process is as follows:

 

Iv. Bin Installation File Creation

1) Sh file (example: yyyy. Bin)

 

# ! / Bin / Sh
Path =/ USR / Bin: / Bin
Umask 022
Echo_args = " -E "
Localinstall = $ 1
More < " EOF "
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
EOF
Agreed =
While [x $ Agreed = X] ;   Do
Echo
Echo   " Do you agree to the above license terms? [Yes or No] "
Read reply leftover
Case $ Reply in
Y * | y * )
Agreed = 1 ;;
N * | N * )
Echo   " If you don't agree to the license you can't install this software " ;
Exit   1 ;;
Esac
Done
If [-D " $ Localinstall " ] ;   Then
Outname = $ Localinstall / Outname
Else
Outname = Outname
Fi
Echo   " Unpacking... "
Tail-n + Aaa $ 0   >   $ Outname
If [-X / USR / Bin / Sum] ;   Then
Echo   " Checksumming... "

Sum= ` / USR / Bin / Sum $ Outname'
Index = 1
For S in $ Sum
Do
Case $ Index in
1 ) Sum1 = $ S ;
Index = 2 ;
;;
2 ) Sum2 = $ S ;
Index = 3 ;
;;
Esac
Done
If [ $ Sum1! = Sum1-o $ Sum2! = Sum2] ;   Then
Echo   " The download file appears to be upted. "
Echo   " Please do not attempt to install this archive file. "
Exit   1
Fi
Else
Echo   " Can't find/usr/bin/sum to do checksum. Continuing anyway. "
Fi
Echo   " Done. "
Exit   0

# This file YYYY. Bin can be used repeatedly. outname, sum1, and sum2 are identifiers, indicating the zip, RPM path to be packaged into the bin, checksum of sum, and filesize.

#User Agreement: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

#Tail-n+Aaa $0 > $Outname, AAA is the line count of the sh file. This command extracts the ZIP or rpm after the sh in the bin;

# Sum is used to check whether the extracted ZIP or RPM files are correct;

# Be sureExit 0Yes.
# You can also install the new cloud unzip or RPM before exiting, or install the ZIP or RPM by yourself.

 

2) Zip, GZ, or RPM (example: XXXX. rpm)

This is the ZIP or RPM you want to install.

 

3) Create the bin Installation File Script SH (example: createbin. Sh, use the above YYYY. SH and XXXX. rpm)

# ! / Bin / Sh

Path =. : $ Path
Rpm = Xxxx . Rpm
Licensebin = Yyyy . Bin
Base = $ ( Basename $ Rpm . Rpm )
Sum = 'Sum $ Rpm'
Index = 1
For S in $ Sum
Do
Case $ Index in
1 ) Sum1 = $ S ;
Index = 2 ;
;;
2 ) Sum2 = $ S ;
Index = 3 ;
;;
Esac
Done
Cat $ Licensebin | sed-E S / Outname /$ Rpm / -E S / Sum1 /$ Sum1 / -E S / Sum2 /$ Sum2 /   > Linux_license_new . Bin
Dos2unix-K-Q linux_license_new . Bin
Cat linux_license_new . Bin $ Rpm > $ {Base}-rpm . Bin
Sudo chmod + X res /$ {Base}-rpm . Bin

# Dos2unix ensure that the license shell is in Linux format;

# The shell file must be executed on Linux;

 

5 Reference: http://itboba.com/taxonomy/term/1015

 

Complete!

Thanks, thanks!

By itech
Source: http://itech.cnblogs.com/

The copyright of this article is owned by the author itech. If it is reproduced, please include the author's signature and source. It shall not be used for commercial purposes. Otherwise, you shall be held legally responsible!

 

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.