linux - 如何在 init.d 上打补丁?

标签 linux bash mongodb ubuntu patch

我尝试使用 this 在我的机器上安装 mongodb指导。

但是我遇到了this问题。此链接还包含一个补丁。补丁文件是init.d.patch

我试过:

root@DevUbuntu12:/etc# sudo patch -p1 < /home/hadoop/Downloads/init.d.patch

但出现错误:

patch: **** File init.d is not a regular file -- can't patch

我该如何应用这个补丁?

最佳答案

我建议安装“numactl”而不是打补丁。该补丁是针对源代码树而不是已安装的版本制作的,因此文件都是错误的。您仍然可以使用补丁,但运行:

cd /etc/init.d
sudo patch -p2 < /tmp/init.d.patch

然后它会警告您不知道该名称并让您自己输入。输入:

mongodb

我的 session 看起来像:

derick@whisky:~ $ cd /etc

derick@whisky:/etc $ cd init.d/

derick@whisky:/etc/init.d $ sudo patch -p2 < /tmp/init.d2.patch 
can't find file to patch at input line 7
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git debian/init.d debian/init.d
|old mode 100644
|new mode 100755
|index 7e5169d..4577291
|--- debian/init.d
|+++ debian/init.d
--------------------------
File to patch: mongodb
patching file mongodb

derick@whisky:/etc/init.d $ 

关于linux - 如何在 init.d 上打补丁?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17605000/

相关文章:

bash - 如何检查进程 ID (PID) 是否存在

python - 如何编写 for 循环,以便程序针对一组 94 个 DNA 样本重复自身?

javascript - node-restful 不将文档 "contents"保存到 MongoDb

MongoDB:如何在 mongodb 中对双元素数字数组的第二个元素设置条件?

linux - 读取并解析 perf.data

linux - grep 换行后的内容

linux - 驱动程序编程 : cat command not showing output

bash - 将文件 A 的内容附加到文件 B 的每一行的末尾?狂欢

mongodb 更改流 java

php - 带有 C 包装器的脚本上的 Setuid