OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • Patching a commit into OPNsense
« previous next »
  • Print
Pages: [1]

Author Topic: Patching a commit into OPNsense  (Read 5991 times)

dcol

  • Hero Member
  • *****
  • Posts: 635
  • Karma: 51
    • View Profile
Patching a commit into OPNsense
« on: March 08, 2018, 07:43:44 pm »
When I see a commit on github that I want to install, other than a manual edit of the file(s), is there a way to easily 'patch' the commit into OPNsense from the shell? Or do we have to ask for a patch first?
Logged

mimugmail

  • Hero Member
  • *****
  • Posts: 6767
  • Karma: 494
    • View Profile
Re: Patching a commit into OPNsense
« Reply #1 on: March 08, 2018, 08:39:55 pm »
man opnsense-patch :)
Logged
WWW: www.routerperformance.net
Support plans: https://www.max-it.de/en/it-services/opnsense/
Commercial Plugins (German): https://opnsense.max-it.de/

dcol

  • Hero Member
  • *****
  • Posts: 635
  • Karma: 51
    • View Profile
Re: Patching a commit into OPNsense
« Reply #2 on: March 08, 2018, 11:01:08 pm »
So how do you use, lets say, commit e12345b with that command?
Logged

mimugmail

  • Hero Member
  • *****
  • Posts: 6767
  • Karma: 494
    • View Profile
Re: Patching a commit into OPNsense
« Reply #3 on: March 09, 2018, 05:47:31 am »
Just
 
opnsense-patch xxxxxxx

You can revert the patch when type it again. It's only important that this patch is in core repo.
If not, e.g. plugins, you have to add -c plugins. And if it's your own repo, you have to add -a username.

So when I fork plugins and add a patch and want to test it, I can do:

opnsense-patch xxxxxxx -c plugins -a mimugmail

Logged
WWW: www.routerperformance.net
Support plans: https://www.max-it.de/en/it-services/opnsense/
Commercial Plugins (German): https://opnsense.max-it.de/

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17707
  • Karma: 1618
    • View Profile
Re: Patching a commit into OPNsense
« Reply #4 on: March 09, 2018, 12:13:51 pm »
So, opnsense-patch uses patch(1) and GitHub to fetch them, so if a commit is there you can patch it as long as the code is mostly in sync. A bit of magic allows to select different accounts, projects, types, etc as describe in the manual page.

Command line options are evaluated before commit hashes:

# opnsense-patch -m my_option -n another_option COMMITHASH1 COMMITHASH2 ...

If patching does fail, even if partially this is a safe thing to do:

# opnsense-revert opnsense

It will rewrite the core package (unless you patch plugins, give it the plugin name os-... )


Cheers,
Franco
Logged

dcol

  • Hero Member
  • *****
  • Posts: 635
  • Karma: 51
    • View Profile
Re: Patching a commit into OPNsense
« Reply #5 on: March 09, 2018, 03:58:40 pm »
So I want to install a plugin patch for monit

# opnsense-patch -c plugins e94878b
worked ok
« Last Edit: March 09, 2018, 04:41:00 pm by dcol »
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17707
  • Karma: 1618
    • View Profile
Re: Patching a commit into OPNsense
« Reply #6 on: March 09, 2018, 05:07:26 pm »
Yeah, Michael posted the wrong order. That's why I answered and said "Command line options are evaluated before commit hashes".


Cheers,
Franco
Logged

siegfried

  • Newbie
  • *
  • Posts: 26
  • Karma: 3
    • View Profile
Re: Patching a commit into OPNsense
« Reply #7 on: May 14, 2018, 10:59:32 am »
patch installed, works fine again.
Thanks!
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • Patching a commit into OPNsense
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2