Patching a commit into OPNsense

Started by dcol, March 08, 2018, 07:43:44 PM

Previous topic - Next topic
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?


So how do you use, lets say, commit e12345b with that command?

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


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

March 09, 2018, 03:58:40 PM #5 Last Edit: March 09, 2018, 04:41:00 PM by dcol
So I want to install a plugin patch for monit

# opnsense-patch -c plugins e94878b
worked ok

Yeah, Michael posted the wrong order. That's why I answered and said "Command line options are evaluated before commit hashes".


Cheers,
Franco

patch installed, works fine again.
Thanks!