简体   繁体   中英

How to apply patch on init.d?

I tried to install mongodb on my machine using this guide.

However I ran into this problem. This link also contains a patch. The patch file is init.d.patch

I tried:

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

But got an error:

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

How can I apply this patch?

Instead of patching, I would suggest to install "numactl". The patch is made against the source tree, and not the installed version so the files are all wrong. You can still use the patch, but running:

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

It then warns about not knowing the name and lets you enter it yourself. Enter:

mongodb

My session looked like:

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 $ 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM