Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
Download PDF Format document: Http://app.weiphone.com/files/how_to_make_deb.pdf
This post is modified by http://bbs.weiphone.com/read-htm-tid-300101.html.
The Dpkg-deb command is required to make the Deb file, and the Ubuntu/debian system has this command, and the jailbreak iPhone OS has this command, and the fink,windows under Mac OS X needs to be installed Cygwin.
In the above system, the iphone OS is best used to pack the Deb files because the user/group settings on the iphone OS are exactly the same as the desired settings. But because Iphone/ipod touch is a handheld device, processing performance is not comparable to the computer, in the packaging of large Deb files will take a long time, may lead to loss of connectivity or springboard crash. And in WinSCP, where text is modified, encoding is a problem (not saved as UTF-8) if the text contains Chinese.
Ubuntu/debian is the native system of the Deb file system, which is best for compatibility and processing performance, but the problem is that Ubuntu/debian does not have some users and groups on the IPhone OS, most typically wheel, mobile, and mobile users.
Mac OS x has the same problem as Ubuntu/debian, no mobile user/group, and requires Fink to support Deb.
Windows has the most problems, the Cygwin is too large to use, and it's cumbersome, and Windows is not recommended for packaging, with Windows file systems and Unix standards completely different, and windows facing more serious coding problems.
Regardless of the system, the way to package Deb is the same, but in some places special attention is needed for some systems.
A Deb installation package consists of two parts, one is installation control/identification information, and the other is the actual program file.
Use the 7-zip or Linux archive Manager to open the Deb file, where the installation control/identification information is stored in the control.tar.gz, while the DATA.TAR.XXX stores the program data.
Unpack the Deb file
Instead of having to make a brand new Deb, you need to modify the existing Deb, the first step is to unpack. Suppose Deb's filename is Abc_1.0.deb
Then the unpack command is the copy code DPKG-DEB-X abc_1.0.deb tmp and the replication code DPKG-DEB-E abc_1.0.deb Tmp/debian
The first command is used to extract the actual data into the TMP directory, and the latter command is to extract the installation control script into the Tmp/debian directory, where it must be uppercase Debian.
You can see the actual data and the Debian directory appearing in the TMP directory.
Unpack with the Dpkg-deb-x and-e command the Deb retains the file's attributes/permissions/user/group information.
For Dpkg-deb commands, you can enter the copy code Dpkg-deb--HELP
Entering the Debian directory, you can see a control file with no prefix name, which is used to record the Deb installation information. Sometimes you can also see postinst,preinst,prerm,postrm,extrainst_ these files, which are scripts that were executed when Deb was installed (similar to a batch file under Windows).
Another way to unpack Deb is to use software such as 7-zip or Archive manager to unpack directly into a specified directory. This does not, however, preserve the file's attributes/permissions/user/group information, so this method is not recommended unless the information is unimportant, or if the information is set through a script. If you just want to extract some of the files can be used, more convenient.
Table of Contents/file references for packing Deb
If you are solving the existing deb, then the catalog is already configured. If you are creating a new deb, you need to have a home directory, and here, for example, TMP, create a new directory in the TMP directory, DEBIAN.
Complete Deb Data Configuration reference
Place the program files in the TMP directory. The placement rule is, if the previous file on the iphone OS is/APPLICATIONS/ABC.APP/ABC, create a new directory in the TMP directory Applications,abc.app, and then put ABC under Abc.app. The rest of the files and directories are placed the same.
Note here that the file attributes/permissions/user/group issues, of course, the prerequisite is to know the file properties and permissions and other information.
Typically, executables, such as application executables, scripts, and so on, must be set to 0755 or higher (0775 or 0777), and the vast majority of files/folders under/var/mobile/need to be mobile.
To set permissions/attributes for a file/folder, use the command to copy code chmod ABCD XXX in such a format that ABCD is required for attributes/permissions such as 0644,0755, in general, the feasibility document needs to be set to 0755 (0775 and 0777 Most of the cases are not available, Some special needs set to 4755, etc., other files by default is 0644 (not executable), XXX is the filename, you can add a path.
To set up a user/group for a File/folder, use the command to copy code chown user:group XXXX where user is the one that needs to be set up, group is groups. The most commonly used are root:wheel and mobile:mobile.
1. If the current user is a non-root account, you need to use the sudo command to prompt permissions if you want to set the user/group of the file to root.
2. If you want to recursively set the above information, you can use the-r argument. For example, to set all subdirectories and files in the TMP directory to 0755 and Root:wheel, you can use the command to copy code CHMOD-R 0755 tmp chown-r root:wheel tmp
For more information on File/folder properties/Permissions/Users/groups:
Because Deb packaging is to compress all files/folders before they are archived as tar files, the Properties/permissions/Users/groups of the file/folder will be preserved. So if you just set it up and then pack Deb, you don't need to set permissions such as Postinst.
If you cannot set properties/user/group information directly, you usually need to include a command to set properties/Permissions/Users/groups in the Postinst script
If the directory in Deb is on the iphone OS itself, there is no need to set properties/Permissions/Users/groups, etc., even if the existing and required are not the same. Because the Deb installation does not replace the data in the original folder. For example, the/applications directory is root:admin, and the directory in Deb to be packaged is abc:def, so there is no need to modify Abc:def
Especially to be aware of is mobile:mobile
Although there is no wheel group on the Ubuntu/debian, Root:root automatically turns root:wheel on the iphone, so you can keep root:root if you are ready to turn Root:wheel into Root:root.
Theoretically, all operations can be done directly on Ubuntu/debian and Mac OS X without having to set up a user/group for the installation script without involving the Mobile:mobile user/group
Debian Control Reference
Control records the package identification, software name, Introduction, author, conflict software, etc. to identify a software package. In some software, such as icy, is case-sensitive, but is case-insensitive in Cydia.
The control file must be Utf-8,unix encoded, Unix/linux (LF), and non-compliant control can cause Cydia to open.
A blank line is required at the end of the file.
Package identifier, similar to an identity card, a package must have a unique identifier. It is usually named in the form of COM.XXX.ABC.
Architecture, used to identify running systems, on the iphone for Iphoneos-arm
Version number, you cannot use underscores and commas and spaces. The format has (comma-delimited) 1.0,1.0f,0-1,1:1.0, where 1:1 is a special format, and in Cydia, 1:1 still appears as 1.0, but the version number is actually higher than 1.0.
The above 3 items are required and cannot be successful without a deb package.
The following options are available:
Package in the Cydia display name, both in English and Chinese, can also use a space, but not too long (long show incomplete).
Maintainer, typically the owner of a software source.
Person in charge, can be a person or can be a website.
Author,maintainer,sponsor format is the same, are the name + space +< e-mail address or URL, tested, if the name is Chinese, even if the e-mail address and URL, click in the Cydia will not jump.
Example: Weip. Tech <weip.com@gmail,com>/weiphone.com < http://www.weiphone.com>
If you do not have an e-mail address or URL, you do not need the content in <> and <>.
Chinese name or no email/url, no > symbol
Specifies the icon display for the package. When no icon is set, Cydia displays the category icon for the package.
Online address, such as Http://www.abc.com/abc.png Local address: file://+ path, such as File:///Applications/Cydia.app/Sources/app.weiphone.com.png
Note: In the Software page (non-list page), the custom icon is not displayed and the category icon is displayed.
Software classification, Chinese and English are unrestricted, the order is-> in English.
In addition, if you add  to the category, such as [tools], then this is the top of the line.
Unpack the size of the file, you can have decimal places, in KB, do not need to indicate KB, this does not need to be very accurate, and the number of decimal places in the Cydia is not shown (not rounded, all the homes). Whether the file size contains content in the Debian directory is optional.
Priority, can fill Required,important,standard,optional,extra, order must, important, general, optional, secondary. While there is no practical effect, packages with priority required and important are warned to uninstall, which avoids removing some of the system's required software. But required and important do not abuse, generally with standard,optional or extra can.
Priority is not displayed in Cydia
Whether the package must be filled with Yes and no, fill yes to be a must package, Cydia will have a warning when uninstalling. Uninstalling a package labeled Yes by essential may cause system problems. Of course, this feature should be used with caution, do not because you do not want users to delete their own software to join the Essential:yes. If there is no essential this, the default is not necessary, the equivalent of Essential:no.
The depends field should contain the name of any package that is absolutely necessary for your package to work correctly.
"Pre-depends" is reserved for special cases. When a package is listed as "pre-depends," it forces the system to fully install the specified package before attempting to install your package.
Conflicting packages. For example, packages A and B are conflicting and cannot be installed at the same time. For example, A and B conflict, when the system has installed a, try to install B, you can not continue.
The package provided, for example, package A contains all the functions of B, then it is a provides B, so you can not install B on the premise of installing a. However, this feature may not be recognized in Cydia Software management tools (in fact, these software do not fit the Deb standard)
Replace the package, install a will replace B.
The above 5 items in the same format, directly fill in the package package identification, if you need to add version number, then the Software table identification + space + (judge symbol version number).
such as Depends:apt-key, firmware (>=3.0), which means reliance on apt-key, not limited to version, firmware, and version is greater than or equal to 3.0.
Judging symbols: far below (<<), below (<), below or equal to (<=), equal to (=), equal to or higher (>=), greater than (>), and Far above (>>).
Represents multiple packages, separated by commas in English.
To express a "or" relationship with | Separated. For example, Package C relies on A or B, writable Depends:a | B. But the "or" relationship should be used with caution. The reason is that when a "or" relationship does not exist, assuming B is dependent on a and the system does not have a, then installing B in Cydia automatically downloads installation A. If c depends on a or b, and A and B are not installed, then the installation of C will fail, because the system can not determine whether to download a or B. C cannot be installed unless a or B is installed on the system.
A special dependency: firmware. This package records the firmware version and is particularly important in software packages that are required for the firmware version.
Assuming B is dependent on a, the B is also unloaded when you uninstall a
Software description, can not be directly wrapped in control, if you need to implement line-wrapping display, you may use the <br> code. When depiction is specified, description is not displayed on the Software view page.
function is similar to a software description, linked to a Web page to replace the content of the software description. Only displayed on the Software view page, not shown on the Package list page.
You can use the local Web page to format the icon.
Note: This feature may consume a large amount of network traffic.
Link to page, cydia display as more information.
The page is not actively loaded.
Label, which is used to classify package information.
Purpose:: Package type, such as software source, command line, library, etc. Purpose::console indicates that the software is a command-line interface. Available options are commercial, console, daemon, extension, library, Uikit, x, corresponding icon files in the/applications/cydia.app/purposes directory. You can also add the purpose category by yourself, with an icon with the same name.
Role:: The package user is categorized. Developer developer, Hacker Hacker, Enduser Normal user, the label used for Cydia package display filtering.
Cydia::commercial Cydia Store software.
Example: Control.txt (1 K) Download number of times: 738 remove the. txt suffix name
Debian script Preinst/postinst/prerm/postrm/extrainst_ References
Most of the time Deb Setup doesn't copy files to the iphone, you need to execute some commands, such as setting permissions, backing up files, loading the startup process, and so on, and then you need some scripting to do that.
There are 4 standard Deb scripts, preinst,postinst,prerm and Postrm,pre are prefixes before XX, post is the prefix after xx, Inst is the abbreviation for install (installation), RM is the abbreviation of remove (remove), So the features of these 4 scripts are obvious:
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.