Created
July 25, 2024 14:54
-
-
Save felipealfonsog/bf2d656c0b7dc05aaf59a84fcd709590 to your computer and use it in GitHub Desktop.
Step-by-Step Guide to Create a `.deb` Package for `project`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step-by-Step Guide to Create a `.deb` Package for `project` | |
## 1. Prepare the Project Directory Structure | |
Ensure your project directory structure is as follows: | |
project/ | |
├── DEBIAN/ | |
│ ├── control | |
│ └── postinst | |
└── usr/ | |
└── local/ | |
├── bin/ | |
└── src/ | |
└── project.c | |
## 2. Create the `control` File | |
Create and edit the `control` file inside the `DEBIAN` directory: | |
```bash | |
nano project/DEBIAN/control | |
Content of the control file: | |
Package: project | |
Version: 1.0 | |
Section: base | |
Priority: optional | |
Architecture: amd64 | |
Depends: build-essential | |
Maintainer: Your Name <[email protected]> | |
Description: Project is an advanced utility crafted to continuously optimize system resources. | |
3. Create the postinst Script | |
Create and edit the postinst script inside the DEBIAN directory: | |
nano project/DEBIAN/postinst | |
Content of the postinst script: | |
#!/bin/bash | |
# Compile the source code | |
gcc /usr/local/src/project.c -o /usr/local/bin/project | |
Make the script executable: | |
chmod 755 project/DEBIAN/postinst | |
chmod 755 project/DEBIAN/postinst | |
4. Copy the Source Code | |
Copy your source code project.c to the appropriate directory: | |
cp /path/to/your/project.c project/usr/local/src/project.c | |
5. Build the Package | |
Navigate to the parent directory of project and build the package: | |
cd /path/to/project/parent | |
dpkg-deb --build project | |
This will create the project.deb package in the parent directory. | |
6. Verify the Package | |
Check the contents of the generated .deb package: | |
dpkg-deb --info project.deb | |
dpkg-deb --contents project.deb | |
7. Test the Package on Debian/Ubuntu/KALI | |
Transfer the project.deb package to a Debian or Ubuntu system and install it: | |
sudo dpkg -i project.deb | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment