Linux deb包解壓、修改等操作方法代碼示例
出于多種原因,有的時(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

對(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í)有所幫助,也希望大家多多支持本站。
版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。
關(guān)注官方微信