boxcutter / centos

Virtual machine templates for CentOS written in legacy JSON
Apache License 2.0
424 stars 199 forks source link

Folder of custom scripts #50

Closed mrjcleaver closed 7 years ago

mrjcleaver commented 8 years ago

Wouldn't it be better if custom script was a folder instead of a single file? That way things could be modularized. They could be run in alpha sort order, etc.

I'd suppose this should be a generic Boxcutter issue tracker issue, but I don't see one...

patrick-hill commented 8 years ago

Why don't you use the script to call whatever custom logic you want?

I have several layers of custom scripts I call, based on various environment variables. All my logic is defined in my own script that gets called by the custom script.

On Wed, Sep 14, 2016 at 7:11 PM, Martin Cleaver notifications@github.com wrote:

Wouldn't it be better if custom script was a folder instead of a single file? That way things could be modularized. They could be run in alpha sort order, etc.

I'd suppose this should be a generic Boxcutter issue tracker issue, but I don't see one...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/boxcutter/centos/issues/50, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXmvGbMdcvIf9B4Q95HtAFa0gbp3fMvks5qqH8agaJpZM4J9V9s .

mrjcleaver commented 8 years ago

Sure, I could build a layer of logic to call a set of scripts. It's a good idea, as is something to further distinguish based on environment variables.

I just figure that it's surely a common need and would be good to share.

Would you like to share what you have so far?

Thanks, Martin

misheska commented 7 years ago

Well, the hope is that most custom-script.sh work will be merely to call things written in Chef, Ansible, Puppet, CFEngine, etc. - configuration management systems rather than adding more scripts.

These boxes are intended to be "Just Enough Operating System" (JEOS)....for a configuration management system. So I hope there's not much that should be in custom-script.sh that are really shareable except in the various CM archives.

As far as the rest, it can be evaluated on a case-by-base basis.

lairdm commented 7 years ago

So following up on this, it sounds like a reasonable solution. However how do you pass these environment variables from the -var or -var-file to the custom script? I've tried to dump all the environment variables from a running custom script during a build, and nothing custom seems to get passed along. So how do you communicate these environment variables to the custom script without customizing the boxcutter base .json configuration?

Thanks.