出于多種原因,有的時(shí)候需要直接對(duì)deb包中的各種文件內(nèi)容進(jìn)行修改
主要有三個(gè)問(wèn)題需要解決:
0、如何將deb包文件進(jìn)行解包呢?
1、修改要修改的文件?
2、對(duì)修改后的內(nèi)容進(jìn)行生成deb包?
解包命令為
#解壓出包中的文件到extract目錄下
lin@lin-host:~/Desktop/100次重啟工具$ ls
LongTestTools.sh loong-test-s2s3_1.0.0-2_all.deb readme.txt
lin@lin-host:~/Desktop/100次重啟工具$ 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次重啟工具$ ls
extract LongTestTools.sh loong-test-s2s3_1.0.0-2_all.deb readme.txt
lin@lin-host:~/Desktop/100次重啟工具$ tree extract/
extract/
└── usr
└── bin
├── BootReplace.sh
├── BootTest.sh
├── LongTestTools.sh
├── RebootReplace.sh
├── RebootTest.sh
├── SleepTest.sh
└── SuspendTest.sh
#解壓出包的控制信息extract/DEBIAN/下:
lin@lin-host:~/Desktop/100次重啟工具$ dpkg -e loong-test-s2s3_1.0.0-2_all.deb extract/DEBIAN/
lin@lin-host:~/Desktop/100次重啟工具$ 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
#修改文件
vi extract/usr/bin/BootTest.sh
![](/d/20211016/5c33973ced1d962fa175c4605b4b8674.gif)
對(duì)修改后的內(nèi)容重新進(jìn)行打包生成deb包
lin@lin-host:~/Desktop/100次重啟工具$ dpkg-deb -b extract/
dpkg-deb:正在新建軟件包 loong-test-s2s3,包文件為 extract.deb。
lin@lin-host:~/Desktop/100次重啟工具$ ls
extract extract.deb LongTestTools.sh readme.txt
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。