The Run program installation package is essentially an installation script plus the program to be installed, as shown in:
|-----------------|
| |
| installation Script |
| |
|-----------------|
| |
| program |
| |
|-----------------|
figure: The structure of the run installation package
so the entire run package structure is at a glance, in fact, because the actual need for the structure of a little change, but this does not matter, only need to understand the principle of the line.
Create a Run installation package here are some practical examples:
For the sake of simplicity, the program to be installed is the HelloWorld program, and the process of installing it is to copy it to the/bin directory.
ls install. SH catinstall. SH #!/bin/bashcp HelloWorld/bin$
Now there is a setup script, named Install.sh, that has a program to install HelloWorld. Because the programs to be installed are generally made with. tar.bz2. We'll do it here too:
tar jcvf HelloWorld. tar. bz2 HelloWorld
Now modify an installation script install.sh
Switch
#!/bin/bashlines=7 #这个值是指这个脚本的行数加1, this script has a total of 6 lines tail + $lines $0 >/tmp/ HelloWorld. tar. GZ # $ represents the script itself, which is used to write content starting from $lines to A/tmp directory of HelloWorld. Tar . gz file. tar jxvf/tmp/hellowrold. Tar . GZ CP HelloWorld/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 gives you the Myinstall.run file, which is structured as follows:
|------------------| line 1th
| |
| install.sh |
| | line 6th
|------------------|
| | line 7th
|helloworld.tar.bz2|
| |
|------------------| end
figure: Structure of the Myinstall.run installation package
When you run Myinstall.run, the exit 0 script that runs to line 6th exits, so you do not run the binary data (that is, the helloworld.tar.bz2 file) below line 7th. And we used tail to subtly regenerate a helloworld.tar.gz file with the data below line 7th. Perform the installation again.
The run installation package makes it a good choice to make a smaller package, but it also has drawbacks, and it can be cumbersome to make a more complex installation package and write an installation script. So it's better to use a different installation package at this point.
installation method: Take ***.run as example: Run sh ***.run
Source: http://www.linuxdiyf.com/viewarticle.php?id=84934