Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User customization without forking #230

Merged
merged 3 commits into from
Feb 29, 2020
Merged

Conversation

daxgames
Copy link
Contributor

@daxgames daxgames commented Feb 26, 2020

User customization without forking

Note: Does not affect existing make commands if PREFIX is not set.

Users can clone boxcutter/windows and make user specific copies of Packer templates, scripts and configs they can edit that are ignored by git.

  • Packer *.json template files can be symlinks to files in another repo.
  • Files in floppy and script cannot be symlinks but can be links to files in other repos.

This adds flexibility to customize and to easily sync with the upstream repo at any time!

cp eval-win10x64-enterprise.json [company].eval-win10x64-enterprise.json
make PREFIX=[company]. [company].[target]
rm -rf output-virtualbox-iso
mkdir -p box/virtualbox
packer build -on-error=cleanup -only=virtualbox-iso -var 'version=1.0.4' -var 'update=false' -var 'headless=false' -var "shutdown_command=shutdown /s /t 10 /f /d p:4:1 /c Packer_Shutdown" -var "iso_url=file://./iso/win10x64.iso" -var "iso_checksum=a4ea45ec1282e85fc84af49acf7a8d649c31ac5c" [company].eval-win10x64-enterprise.json
  • Add $(PREFIX) to the Makefile
    • Run make PREFIX=[company]. [company].[target] to build from [company].target.json
  • Add user customization ignores to the .gitignore floppy and script folders:
    • *.*.json
    • floppy/*.*.*
    • script/*.*.*

I use it as follows:

I have a repo in Github with my customizations that are business specific:

floppy/*
    Scripts - Proxy Settings
    SSL Certs - Required to get to the internet so I can build. (IT Security Requiremnt)
scripts/*
    Any business specific custom script that should not be in this repo.
Makefile.local
Packer Templates
link_repos.sh
    Clones boxcutter/windows to ./boxcutter_windows
    Symlinks required files/folders from my repo into ./boxcutter_windows/*
        These links are added to the ./boxcutter\windows\.gitignore by this PR.
    Links required files from [my repo]/floppy into ./boxcutter_windows/floppy/*
        Symlinks don't work here
    Links required files from [my repo]/scripts into ./boxcutter_windows/scripts/*
        Symlinks don't work here

I can now use boxcutter/windows unmodified with my user customizations that have no business being in your repo and everything is still in source control.

I think this is a great add to this project for users that need user customizations and don't want to fork and keep their personal repo synched with this repo.

Dax T. Games added 2 commits February 26, 2020 10:22
@daxgames daxgames changed the title Prefix User customization without forking Feb 26, 2020
@arizvisa
Copy link
Contributor

Cool. I'm for this.

One addition, though, can you define PREFIX?= after the other variables in the beginning of the makefile and add a comment which mentions that it's used to prefix the targets? This way people whom surf through the Makefile can immediately see any variables that are used/customizeable.

Sorry it took me a bit to follow up on this, was afk for a few weeks and apparently can't get Internet where I live, so it's hard for me to test things at the moment. Heh.

@daxgames
Copy link
Contributor Author

@arizvisa Done.

@arizvisa arizvisa added the enhancement This will introduce or improve an already existing capability label Feb 29, 2020
@arizvisa arizvisa self-assigned this Feb 29, 2020
@arizvisa
Copy link
Contributor

Merging.

@arizvisa arizvisa merged commit 80f4ef7 into boxcutter:master Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This will introduce or improve an already existing capability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants