Linux deb package decompression, modification and other operation methods code examples

Linux deb package decompression, modification and other operation methods code examples

For various reasons, sometimes you need to modify the contents of various files in the deb package directly

There are three main issues that need to be addressed:

0. How to unpack the deb package file?

1. Modify the file to be modified?

2. Generate a deb package for the modified content?

The unpacking command is

#Unzip the files in the package to the extract directory

lin@lin-host:~/Desktop/100 restart tools$ ls
LongTestTools.sh loong-test-s2s3_1.0.0-2_all.deb readme.txt
lin@lin-host:~/Desktop/100 times restart tool$ dpkg -X loong-test-s2s3_1.0.0-2_all.deb extract/
./
./usr/
./usr/bin/
./usr/bin/BootReplace.sh
./usr/bin/BootTest.sh
./usr/bin/LongTestTools.sh
./usr/bin/RebootReplace.sh
./usr/bin/RebootTest.sh
./usr/bin/SleepTest.sh
./usr/bin/SuspendTest.sh
lin@lin-host:~/Desktop/100 restart tools$ ls
extract LongTestTools.sh loong-test-s2s3_1.0.0-2_all.deb readme.txt
lin@lin-host:~/Desktop/100 restart tools$ tree extract/
extract/
└── usr
  └── bin
    ├── BootReplace.sh
    ├── BootTest.sh
    ├── LongTestTools.sh
    ├── RebootReplace.sh
    ├── RebootTest.sh
    ├── SleepTest.sh
    └── SuspendTest.sh

# Extract the control information of the package extract/DEBIAN/:

lin@lin-host:~/Desktop/100 times restart tool$ dpkg -e loong-test-s2s3_1.0.0-2_all.deb extract/DEBIAN/ 
lin@lin-host:~/Desktop/100 restart tools$ tree extract/
extract/
├── DEBIAN
│ ├── control
│ └── md5sums
└── usr
  └── bin
    ├── BootReplace.sh
    ├── BootTest.sh
    ├── LongTestTools.sh
    ├── RebootReplace.sh
    ├── RebootTest.sh
    ├── SleepTest.sh
    └── SuspendTest.sh

3 directories, 9 files

#Modify the file

vi extract/usr/bin/BootTest.sh

Repackage the modified content to generate a deb package

lin@lin-host:~/Desktop/100 restart tool$ dpkg-deb -b extract/ 
dpkg-deb: Creating new software package loong-test-s2s3, package file is extract.deb.
lin@lin-host:~/Desktop/100 restart tools$ ls
extract extract.deb LongTestTools.sh readme.txt

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • IntelliJ IDEA remote debugging Linux Java program, find the problem do not just look at the log (recommended)
  • How to check whether .so and executable files are debug compiled in Linux (must read)
  • Detailed explanation of how to install software tar.gz, rpm, deb under Linux
  • Debian configuration JDK1.7 and Linux Java Helloworld
  • Tutorial on compiling and installing the ixgbe driver in Debian Linux
  • How to check if a package is installed in Debian Linux
  • Detailed installation and configuration of Xdebug, a PHP code debugging tool in Windows and Linux
  • Comparison of Linux server systems CentOS, uBuntu, Gentoo, FreeBSD, and Debian
  • Linux VPS Security Settings 1: Modify SSH Port (CentOS/Debian)

<<:  The whole process of configuring hive metadata to MySQL

>>:  Problems and solutions of error 08001 when linking to MySQL in IDEA and no table display after successful connection

Recommend

How to limit the number of concurrent connection requests in nginx

Introduction The module that limits the number of...

Vue implements the magnifying glass function of the product details page

This article shares the specific code of Vue to i...

Software Testing - MySQL (VI: Database Functions)

1.MySQL functions 1. Mathematical functions PI() ...

Analysis of mysql view functions and usage examples

This article uses examples to illustrate the func...

Detailed example of using the distinct method in MySQL

A distinct Meaning: distinct is used to query the...

What is em? Introduction and conversion method of em and px

What is em? em refers to the font height, and the ...

How to install jupyter in docker on centos and open ports

Table of contents Install jupyter Docker port map...

Docker core and specific use of installation

1. What is Docker? (1) Docker is an open source t...

Difference between MySQL update set and and

Table of contents Problem Description Cause Analy...

JavaScript to achieve stair rolling special effects (jQuery implementation)

I believe everyone has used JD. There is a very c...

Solution to "No input file specified" in nginx+php

Today, the error "No input file specified&qu...