0

I'm new to Ubuntu and I never ran Drupal patches before and now is my first to do so: I've searched here in the Drupal answers with the phrase: "Patches, Ubuntu" But I didn't find instruction on how to run patches for a module in a local site via the Ubuntu terminal. I've also searched some in Google in Youtube but I found ways for many other CLIs, but not for the Ubuntu terminal.

Is it possible to run the patches there as I would run Drush commands?

1
1

As far as I know there is nothing in specific about applying patches for drupal in ubuntu.

If you are already using git for managing your project code then you can apply a patch to a project's repository by using following code:

git apply -v path/file.patch

If you are not using git, or if the repo isn't a local checkout of the project you wish to patch:

patch -p1 < path/file.patch

For more information, check https://www.drupal.org/patch/apply

Live example for patching in Drupal 8:

  1. Download the .patch file (in this case: Add_rtl_support.patch)

  2. Copy it into the particular module's directory (since the patch is relative to the module directory).

  3. Change the destination directory in the Ubuntu terminal to the module's folder - In this case it should be cd modules/admin_toolbar.

  4. Apply the patch using 2nd method patch -p1 < Add_rtl_support.patch

4
  • 1
    @benos yes, you need to install git, sudo apt-get install git – No Sssweat Jan 7 '16 at 5:55
  • 1
    Hello Benos. it all depends on the patch that you are applying. Check the path given in the patch, depending on that you should either apply the patch from site root or the module root directory. Regarding #1, if you are already using git as version control management then you can #1 else use #2. Yes, you can install git using sudo apt-get install git – Suresh R Jan 7 '16 at 5:57
  • 1
    Download the patch and have the name as "Add_rtl_support.patch". Change the directory to the module folder, since its for Drupal 8 it must be something like cd modules/contrib/admin_toolbar. Then try to apply patch using #2, patch -p1 < Add_rtl_support.patch Ensure you have the patch file in the same module directory. Hope am clear! – Suresh R Jan 7 '16 at 6:18
  • Update: Stage two of my process in solving this problem can be viewed here: drupal.stackexchange.com/questions/186028/… – user16289 Jan 7 '16 at 19:39