Linux deb包解壓、修改等操作方法代碼示例
出于多種原因,有的時候需要直接對deb包中的各種文件內(nèi)容進(jìn)行修改
主要有三個問題需要解決:
0、如何將deb包文件進(jìn)行解包呢?
1、修改要修改的文件?
2、對修改后的內(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
對修改后的內(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
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. UOS文檔查看器怎么添加書簽? UOS添加書簽的三種方法2. Unix文件系統(tǒng)和pwd命令實現(xiàn)詳解3. qqprotect.exe是什么進(jìn)程?qqprotect.exe怎么禁止自動啟動?4. 微軟發(fā)現(xiàn)蘋果 macOS 漏洞 可植入惡意軟件5. 統(tǒng)信uos系統(tǒng)怎么進(jìn)行打印測試頁和刪除打印機(jī)?6. Windows 注冊表LastKey鍵值的設(shè)置技巧7. VMware Workstation虛擬機(jī)安裝VMware vSphere 8.0(esxi)詳細(xì)教程8. deepin20時間顯示不準(zhǔn)確怎么調(diào)整? deepin時間校正方法9. 如何在電腦PC上啟動Windows11和Linux雙系統(tǒng)10. 統(tǒng)信uos操作系統(tǒng)怎么激活? 統(tǒng)信UOS系統(tǒng)家庭版激活教程
