Detailed explanation of iOS program installation format (1)

Source: Internet
Author: User

IOS ProgramInstallFormatIs the content to be introduced in this article, where debFormatIs the exclusive installation package for Debian systems (including Debian and Ubuntu)FormatWith APT software management system, it has become a popular installation package in Linux. Jay Freemansaurik, creator of Cydia after the 2.x era, was transplanted to the iPhone platform, along with the APT software management system.

IpaFormatThen AppleIOSThe exclusive Software Installation Package released on the platform is officially used only after the firmware version 2.0 is released. It is currently the only official installation package on the iPhone/iPod Touch/iPad platform.

The pxl format originated from the pkg installation package on Mac systems and is widely used in the 1.x firmware era. It was once the only software installation package on the iPhone platform and is still used by software such as 91.

Installation package format

. Deb

Deb is the installation package in Unix systems (mainly Linux). Based on the tar package, deb records the file permissions (read/write/executable) and owner/user group. Because Unix systems have strict requirements on permissions, owners, and groups, and deb-format installation packages often involve underlying operations of the system, permission setting is particularly important.

The deb package consists of three parts: data packets, including the actual installed program data, and the file name is data.tar. XXX;

Installation information and control script package, including deb installation instructions, identifiers, scripts, etc. The file name is control.tar.gz;

The last one is some binary data of the deb file, including the file's first class information, which is generally invisible and can be seen in some software.

Deb itself can use different compression methods. Tar is not a compression format. Instead, it directly aggregates scattered files and directories, and records data information such as permissions. Previously mentioned data.tar. XXX, Here XXX is the suffix after compression. Deb uses the gzip format by default, so the most common is data.tar.gz. Common compression formats include bzip2 and lzma. the lzma has the highest compression rate, but the CPU resources and time required for compression are relatively long.

Data.tar.gz contains the actual installed program data. During the installation process, the data in this package is directly extracted to the root directory (I .e /), therefore, you need to set the corresponding file/directory tree according to the file location before packaging.

Control.tar.gz contains the control information required for deb installation. Generally, there are five files:

Control, used to record software identification, version number, platform, dependency information, and other data;

Preinst, the script run before data.tar.gz is unwrapped;

Postinst: the script that runs after data is unwrapped;

Prerm: the script that runs before the file is deleted during uninstallation;

Postrm: the script that runs after the file is deleted;

In the Cydia system, Saurik, the author of Cydia, adds another script, extrainst _, which is similar to postinst.

. Ipa

Users who have used Mac OS may know that most of the software on Mac has only one. app Directory, which contains all the resources and executable files of the program. Simply put, Mac software is like a green software in Windows. It can be used after being decompressed without installation, to uninstall the SDK, you only need to delete the program file (the pkg installation package is not involved here ). The ipa format can be regarded as a derivative of the. app software.

The ipa file is actually a zip package (not a rar or 7z package) and contains three components:

The. app directory under the payload directory. This is the main program of the software;

ITunesArtwork is essentially a png image without a suffix, used to display icons in iTunes;

ITunesMetadata. plist records purchaser information, prices, and other data.

Because the zip package cannot record permissions and owner information, Apple specifies the ipa installation method, that is, all ipa will be unpackaged and installed in the/var/mobile/Applications directory, the owner and user group of all files and directories are set to mobile (ID: 501), and the master program (executable files) permissions are set to 0755 (all files can be executed, but only the owner can modify it). The executable file is defined in plist. All directory permissions are set to 0755, while all other files are set to 0644 (only the owner can modify the permission, and others can only read the permission, but not all users can execute the permission ).

After ipa is unwrapped, it is not directly placed in the Applications directory, but in a directory composed of random codes. The function is to allow the software to run only in a specific Sandbox) and cannot interfere with other software. Therefore, in the random code directory, apart from the three components of ipa, there are three directories:

Library, usually used to store data such as setting files;

Documents, which stores data and uses multiple storage archives;

Tmp, Temporary Folder.

Because this software can only run under this specific directory, of course, some programs will call the system's address book, camera and other components, but it is still restricted ), this ensures the security and stability of the entire system.

Because the Unix system has strict permission requirements, the "unauthorized" behavior is absolutely not allowed. For example, mobile users do not have the permission to delete all root files because the root permission is higher than mobile. Therefore, when you modify the files installed with ipa, such as Chinese or archive modification, You cannot delete the software or save the files. This is because you cannot delete all root files, the program itself cannot write all the root archive files.

. Pxl

In the 1.x era, the pxl format was the only installation format on the iPhone platform because no APT management software such as Cydia was available at that time, and Apple did not officially launch the App Store. As we have accumulated a lot of popularity in the 1.x era, in the next App Store era, pxl still occupies a large part of the market with its relatively simple packaging and installation methods. However, as the Installer stops development and software such as iBrickr stops updating, there are currently only 91 software that are still in pxl format.

The pxl installation package usually contains three components:

PxlPkg. plist records the storage location, owner, permission, and software ID of a program file;

PkgScript file folder, which stores the installation and uninstallation scripts;

Program file.

The beginning of the PxlPkg. plist file is usually CFBundleIdentifier, which records the unique identifier of the software and distinguishes it from other software. RDPxlPackageVersion records the software version. RDPxlPackageFireware is used to record the firmware versions that can run. Other key values are used to record data such as the software introduction, URL, and author information.

In addition to the software identification, software version, and available firmware version, the core of PxlPkg. plist is RDPxlPackageFiles and RDPxlPackagePostflight. RDPxlPackageFiles records the path to which the program file should be copied, and provides the overwrite parameter. RDPxlPackagePostflight records the owner and permissions granted to the program file, which are implemented by chown and chmod commands respectively. In addition, for pxl containing the installation/uninstall script, the corresponding scripts Postflight and Preremove are also executed using the sh command.

PkgScript usually contains two files: The Postflight Script executed after installation and the Preremove Script executed before uninstallation. These two scripts are standard Linux Shell scripts executed with sh commands.


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.