Skip to content

Instantly share code, notes, and snippets.

@nickanderson
Created November 20, 2022 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickanderson/40fe61d70da895bc73d36d56e1e01c5e to your computer and use it in GitHub Desktop.
Save nickanderson/40fe61d70da895bc73d36d56e1e01c5e to your computer and use it in GitHub Desktop.
How to use cfbs to manage an overlay with modifications to the MPF

Create a folder containing your overlay at the root of your cfbs project.

For example:

[root@hub local_deploy]# find . | grep -v git
.
./overlay
./overlay/controls
./overlay/controls/def.cf
./overlay/controls/cf_execd.cf
./postfix.cf
./cfbs.json

Add the overlay as a module to your cfbs.json after the masterfiles entry:

{
  "name" "My cfbs project",
  "type": "policy-set",
  "build": [
    {
      "name": "masterfiles",
      "description": "Official CFEngine Masterfiles Policy Framework (MPF)",
      "tags": ["supported", "base"],
      "repo": "https://github.com/cfengine/masterfiles",
      "by": "https://github.com/cfengine",
      "version": "3.18.2",
      "commit": "a87b7fea6f7a88808b327730a4ba784a3dc664eb",
      "added_by": "cfbs add",
      "steps": ["run ./prepare.sh -y", "copy ./ ./"]
    },
    {
      "name": "./overlay/",
      "description": "Local subdirectory added using cfbs command line",
      "tags": ["local"],
      "added_by": "cfbs add",
      "steps": [
        "directory ./ ."
      ]
    }
 ]
}

Now cfbs build will build the mpf from 3.18.2 but then overwirte controls/cf_execd.cf and controls/def.cf with my custom versions. From there it’s easy enoguh to diff between build steps to see the difference of my customized mpf files.

@nickanderson
Copy link
Author

@basvandervlies I know you were looking for this, did this work out the way you hoped?

@basvandervlies
Copy link

Yes I am now using it with a patched shell promise library that overwrites the one include in masterfiles ;-). So thanks @nickanderson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment