Linux deb包解壓、修改等操作方法代碼示例
出于多種原因,有的時(shí)候需要直接對(duì)deb包中的各種文件內(nèi)容進(jìn)行修改
主要有三個(gè)問題需要解決:
0、如何將deb包文件進(jìn)行解包呢?
1、修改要修改的文件?
2、對(duì)修改后的內(nèi)容進(jìn)行生成deb包?
解包命令為
#解壓出包中的文件到extract目錄下
lin@lin-host:~/Desktop/100次重啟工具$ lsLongTestTools.sh loong-test-s2s3_1.0.0-2_all.deb readme.txtlin@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.shlin@lin-host:~/Desktop/100次重啟工具$ lsextract 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.sh3 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次重啟工具$ lsextract extract.deb LongTestTools.sh readme.txt
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. Win10系統(tǒng)如何徹底關(guān)閉teniodl.exe進(jìn)程?2. win10賬戶密碼忘記了怎么辦詳細(xì)介紹3. 大番薯U盤安裝Win7系統(tǒng)的詳細(xì)操作步驟4. FreeBSD10安裝內(nèi)核源代碼方法講解5. 微軟規(guī)劃提升 Win10 / Win11圖形和音頻驅(qū)動(dòng)質(zhì)量6. Win7瀏覽器處于縮放狀態(tài)的解決方法7. UOS應(yīng)用商店不能用怎么辦? uos系統(tǒng)應(yīng)用商店不能使用的解決辦法8. WinXP系統(tǒng)注冊(cè)表解鎖方法9. Win8系統(tǒng)進(jìn)行快速文件反選的操作方法10. Solaris10.0下掛載光驅(qū)
