Linux deb包解壓、修改等操作方法代碼示例
發(fā)布日期:2022-01-22 19:46 | 文章來源:腳本之家
出于多種原因,有的時候需要直接對deb包中的各種文件內(nèi)容進行修改
主要有三個問題需要解決:
0、如何將deb包文件進行解包呢?
1、修改要修改的文件?
2、對修改后的內(nèi)容進行生成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
對修改后的內(nèi)容重新進行打包生成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
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持本站。
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
相關(guān)文章