boxcutter / windows

Virtual machine templates for Windows written in legacy JSON and Batch Scripting/JScript
Apache License 2.0
753 stars 266 forks source link

User customization without forking #230

Closed daxgames closed 4 years ago

daxgames commented 4 years ago

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.

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

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.

arizvisa commented 4 years ago

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 commented 4 years ago

@arizvisa Done.

arizvisa commented 4 years ago

Merging.