The QT program makes the Deb package and installs it in the Application menu

Source: Internet
Author: User

Production principle:
Packaging: QT-produced source program (not compiled) with Debian compression packaging (here is the script to the source program again
Compiler
Install: Unzip the source program in the Deb package (by default, unzip to the root directory) into the specified system file and compile (postinst
Script
Uninstall: Delete all extracted files (POSTRM script)
Example:
1. New Deb Package file myded
|--mydeb
| ———— Application
|--addressbook (this directory contains QT source and configure scripts)
| ———— Lib
|--addressbook.desktop (Desktop file for CP
To/usr/share/applications/)
|--addressbook.png (icon file for CP to/usr/share/pixmaps/)
| ———— DEBIAN (capitalized, used to make packaged files)
| ———— control (the file that describes the information required for the Deb package)
| ———— postinst (scripts executed after software installation, Chomod 755 Postinst Plus
Line permissions)
| ———— postrm (script executed after software uninstall, Chomod 755 POSTRM plus Executable
Permissions

2. Specific production of individual documents
**********************************
AddressBook directory:
**********************************
AddressBook stored in the source program (written by QT4), in order to be able to install the source program in different environments
Do not compile, write a configure script to compile after installation
Configure script content (chomod 755 Configure)
#!/bin/bash
Path=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
Export PATH
Qmake-project # Compile build. Pro Project file
Qmake # Compiling build makefile File
ECHO-E "Run Configure ok!"
(The Makefie file generated here is not intended to be decompressed and reused)

***********************************
Lib directory:
***********************************
Addressbook.desktop File Contents
[Desktop Entry] # must-write
Encoding=utf-8 # Encoding
Exec=addressbook # Executable program name in/usr/bin/
Name=addressbook # program Name
name[zh_cn]= Address Book # program Chinese name
X-kde-startupnotify=true # whether to start notifications
Comment=addressbook # Comments
Icon=/usr/share/pixmaps/addressbook.png # icon Position
Terminal=false # whether to use terminal
Type=application # Types
Categories=application; Utility; # placed in an Attachment menu item, or in another menu item
Categories The first general is application
The second one is generally
Internet (Internet) network
Office Office
Graphic graphics
Sound and video Audiovideo
Systems Tools System
Programming development
Annex Utility
AV audiovideo
Game Games
Preference Settings (GNOME; GTK; Settings; hardwaresettings;)
Systems management System; Settings;

Addressbook.png Download
http://www.iconpng.com/


******************************************************************
Debian content

*******************************************************************
There is at least a control file in the Debian directory, and the second may have Postinst (postinstallation),
POSTRM (Postremove), Preinst (preinstallation), Prerm (preremove), Copyright (version
Changlog (Revision Records) and Conffiles, etc.
Control: This file mainly describes the package name, version, and description
(Description) is a descriptive file that the Deb package must have to facilitate the installation management and indexing of the software.
At the same time, in order to fully manage the package, it may also have the following fields:
Section: This field declares the category of software, common to have ' utils ', ' net ', ' mail ', ' text ',
' x11′ and so on;
Priority: This field affirms how important the software is to the system, such as ' required ', ' standard ',
' Optional ', ' extra ' and so on;
Essential: This field declares whether the system is the most basic package (option yes/no), if so,
This indicates that the software is a package that maintains stable and normal operation of the system and does not allow any form of uninstallation (unless
Mandatory uninstallation of the line)
Architecture: Declare package structure, such as based on ' i386′, ' amd64 ', ' m68k ', ' SPARC ',
' Alpha ', ' PowerPC ' and so on;
Source: The source code name of the package;
Depends: Other software packages and library files on which it depends. If you are relying on multiple packages and library files,
Separated from each other by commas;
Pre-depends: The software must be installed, configured with dependent packages and library files before installation, and it is often used for required
Pre-run scripting requirements;
Recommends: This field indicates the recommended installation of additional packages and library files;
Suggests: Recommended additional packages and library files to install.
*************************************
★★control File Contents
Package:addressbook
version:0.1
Section:utils # Categories
Priority:extra # Degree of importance: extra
Maintainer:cqy <[email protected]>
Architecture:i386
Description:the Software is a opensource package
from cqy [email protected]

**********************************************
★★postinst (scripts executed after software installation, execution Chomod 755 postinst and executable permissions) content
#!/bin/sh
Dire= "/usr/share/addressbook"
Path=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
Export PATH
Mkdir-p $dire # Create a new directory store program in/usr/share/
Mv-f/application $dire/# Move the program extracted to the root directory to the new directory
CD $dire/application/addressbook/# Enter program Directory
./configure # Execute script build Makefile
Make # Compilation
echo "Install ok!" # Installation Complete
Ln-s $dire/application/addressbook/addressbook/usr/bin/addressbook # to be
Link to/usr/bin/addressbook with the program (you can call the AddressBook program)
CP-RF $dire/application/lib/addressbook.png/usr/share/pixmaps/# the picture
The addressbook.png of the document is placed in the/usr/share/pixmaps/
CP-RF $dire/application/lib/addressbook.desktop/usr/share/applications/#
Put the desktop file Addressbook.desktop in the/usr/share/applications/
echo "ok!"

****************************************************************************
★★POSTRM (scripts executed after software uninstall, execution Chomod 755 postrm and executable permissions)
#!/bin/sh
Dire= "/usr/share"
Path=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
Export PATH
RM-RF $dire/addressbook # Delete the resulting file
Rm-rf/usr/bin/addressbook
RM-RF $dire/pixmaps/addressbook.png
RM-RF $dire/applications/addressbook.desktop
echo "Delete This software is ok!"

***********************************************************************
Go back to the directory where Mydeb executes
sudo dpkg-b mydeb addressbook_0.1_i386.deb Packaging (deb package the correct naming rules program-
Name_version_architeture.deb. All values should match the corresponding statements in the control file.
With
Get Addressbook_0.1_i386.deb Bag

sudo dpkg-i addressbook_0.1_i386.deb installation (in the Application Start menu, under Accessories)
sudo dpkg-p addressbook Uninstall

***********************************************************************

Reference: http://blog.csdn.net/small_qch/article/details/6967654

The QT program makes the Deb package and installs it in the Application menu

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.