?。? alt=)
“ 目錄RHCA - 6 軟件倉庫 - 12 patch命令更新補(bǔ)丁 ”按照補(bǔ)丁文件進(jìn)行更新語法格式為patch -pn 補(bǔ)丁文件給軟件更新補(bǔ)丁后要重新執(zhí)行make編譯相較于安裝少了./configure步驟給舊文件打補(bǔ)丁依賴的不是新文件而是補(bǔ)丁文件參數(shù)作用-pnn為數(shù)字例p0、p1、p2在補(bǔ)丁文件中所記錄的目錄中取消幾個(gè)/n就是幾去掉目錄的目的是和當(dāng)前所在目錄匹配-R大寫還原補(bǔ)丁恢復(fù)用補(bǔ)丁文件修改過的源文件例當(dāng)前位于/root/test/目錄下補(bǔ)丁文件中記錄的文件目錄為/root/test/dd.txt-p1在補(bǔ)丁文件目錄中取消一級目錄代表路徑root/test/root/test/old.txt-p2在補(bǔ)丁文件目錄中取消二級目錄代表路徑/root/test/test/old.txt-p3在補(bǔ)丁文件目錄中取消三級目錄代表路徑/root/test/old.txt這個(gè)路徑才是對的1、用補(bǔ)丁文件更新原文件內(nèi)容[rootwuzuniao ~]# cat 12.patch #查看補(bǔ)丁文件路徑補(bǔ)丁文件可用diff命令生成--- 1.txt 2023-03-26 22:01:26.500034822 0800 2.txt 2023-04-05 21:55:28.978502961 0800 -1,3 1,4 xie.cnxie.cnxie.cn#xpgwuzuniao.cnwuzuniao[rootwuzuniao ~]# patch -p0 12.patch #更新原文件1.txtp0是因?yàn)檠a(bǔ)丁文件中記錄的文件目錄就在當(dāng)前目錄下所以不需要取消任何/patching file 1.txt[rootwuzuniao ~]# cat 1.txt #查看到內(nèi)容已被更改xie.cnxie.cnxie.cn#xpgwuzuniao.cnwuzuniao[rootwuzuniao ~]# patch -R 12.patch #還原被補(bǔ)丁修改過的源文件patching file 1.txt[rootwuzuniao ~]# cat 1.txt #查看到還原成功xie.cnxie.cnxie.cn#xpgwuzuniao.cn[rootwuzuniao ~]#