Create and install the linux. run File

Source: Internet
Author: User
Linux. run file production and installation-general Linux technology-Linux programming and kernel information, the following is a detailed description. This problem occurs only when the nvidia driver is installed.

By the way, you can find the. run file.

The run program installation package is essentially an installation script plus the program to be installed, as shown in:

| --------------- |
|
| Installation script |
|
| --------------- |
|
| Program |
|
| --------------- |
Figure: Structure of the run installation package

In this way, the entire run installation package structure is clear at a glance. In fact, the actual structure is somewhat changed, but this does not matter. You only need to understand the principle.

Create the run installation package:

For the sake of simplicity, the program to be installed is the helloworld program. The installation process is to copy it to the/bin directory.

$ Ls
Install. sh helloworld
$ Cat install. sh
#! /Bin/bash
Cp helloworld/bin
$

Now there is an installation script named install.sh, and a program to be installed, helloworld.because the program to be installed is generally made of .tar.bz2. Let's also do the following:

$ Tar jcvf helloworld.tar.bz2 helloworld

Now modify an installation script install. sh.

Changed:
#! /Bin/bash
Lines = 7 # This value indicates that the number of rows in the script is increased by 1, and there are 6 rows in the script.
Tail + $ lines $0>/tmp/helloworld.tar.gz #$0 indicates the script itself. This command is used to write content starting with $ lines into a helloworld.tar.gz file in the/tmpdirectory.
Tar jxvf/tmp/hellowrold.tar.gz
Cp helloworld/bin
Exit 0

Then, use the catcommand to connect the installation scripts install.shand helloworld.tar.bz2.

$ Cat install. sh helloworld.tar.bz2> myinstall. run

In this way, the myinstall. run file is obtained. Its structure is as follows:

| ---------------- | 1st rows
|
| Install. sh |
| Row 6th
| ---------------- |
| Row 7th
| Helloworld.tar.bz2 |
|
| ---------------- | End
Figure: Structure of the myinstall. run installation package

When myinstall. run is run, the exit 0 script running on Line 1 exits, so the system does not run binary data (namely, the prepare file) of Line 2 or below. Then run the installation.

It is a good choice to create a small package for the run installation package, but it also has disadvantages. If the installation package has complicated logic, it will be very troublesome to write the installation script. Therefore, it is better to use other installation packages.

Installation Method: Take ***. run as an example: run sh ***. run

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.