Linux Run install package production __linux

Source: Internet
Author: User
Today there is this demand, the production of a package, but I do not want to play into the RPM package, suddenly think of Nvdia drive automatic installation package is run format, so, in the online search run how to make, found that the following article, easy to understand, excerpt from this to prepare for the record:
http://www.cublog.cn/u/2949/showart.php?id=85794


The Run program installation package is essentially an installation script plus the program you want to install, as shown in the following illustration:

|-----------------|
| |
| Installation Scripts |
| |
|-----------------|
| |
| Program |
| |
|-----------------|
Diagram: The structure of the run installation package

So the entire run installation package structure at a glance, in fact, because the actual need for the structure of a little change but this does not matter, just need to understand the principle on the line.
Make a real example of the run installation package below:
For simplicity, the program to install is the HelloWorld program, and the process of installing it is to copy it to/from the bin directory.
$ ls
install.sh HelloWorld
$ cat install.sh
#!/Bin/bash
CP Helloworld/bin
$
Now there's an installation script, named Install.sh, with a program to install HelloWorld. Because the program to be installed is usually done with. tar.bz2. We'll do the same here:
$ tar jcvf helloworld.tar.bz2 HelloWorld
Now modify an installation script install.sh
To
#!/Bin/bash
Lines = 7 #这个值是指这个脚本的行数加1, this script has a total of 6 lines
Tail + $lines $0 >/tmp/helloworld.tar.gz # $ is the script itself, which is used to write content from $lines to a helloworld.tar.gz file in A/tmp directory.
Tar jxvf/tmp/hellowrold.tar.gz
CP Helloworld/bin
Exit 0

Then use the Cat command to connect the installation scripts install.sh and helloworld.tar.bz2.
$ cat install.sh helloworld.tar.bz2 > Myinstall.run
This gets the Myinstall.run file, which is structured as follows:
|------------------| Line 1th
| |
| install.sh |
|  | Line 6th
|------------------|
|  | Line 7th
| helloworld.tar.bz2 |
| |
|------------------| End
Figure: Structure of Myinstall.run installation package

When you run Myinstall.run, the exit 0 script that runs to line 6th exits, so you don't run binary data (that is, helloworld.tar.bz2 file) below line 7th. And we used the tail cleverly to regenerate a helloworld.tar.gz file with the data below line 7th. Perform the installation again.

The run installation package makes a small package a good choice, but it also has drawbacks, and it can be cumbersome to write a setup script that is more complex than a logical installation package. Therefore, it is better to use a different installation package at this time.



The data concealment of this kind of installation package is not very good, but already met my request, so, use him for the time being OK ...

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.