jambonz / jambonz-infrastructure

packer and cloudformation templates for creating EC2-based jambonz deployments
23 stars 29 forks source link

introduce common #27

Open asarubbo opened 1 year ago

asarubbo commented 1 year ago

Hello Dave,

in the issue #26 I talked about die

If you think is a good idea, I think that it make no sense define die() for each script, instead let's put the die function into a file called common as packer/jambonz-mini/scripts/common and each script will source the common file at the beginning as:

source common

So this file will be a collection of functions that all scripts can share.

For example, if all scripts work with the /usr/local/src directory you can put into common something like

mkdir -p /usr/local/src
chmod 777 /usr/local/src

If only few scripts use /usr/local/src you can do:

assert_usr_local_src() {
    mkdir -p /usr/local/src
    chmod 777 /usr/local/src
}

and call in each script you need:

source common
assert_usr_local_src

Thanks