I have about 5 or 6 bash scripts that I use when I run a major remaster of my puppies and these scripts are used to handle interaction between the user and the remaster process. Within these scripts I use a variable that I call "SUBTYPE" which identifies the 'flavour' or special purpose of the new puppy. This $SUBTYPE becomes grafted into various files to identify the new puppy, and also gets grafted into the name of the new iso file.
For example, the $SUBTYPE might be a name such as:
SUBTYPE=scanpup
or
SUBTYPE=testpup
or it might be a date such as:
SUBTYPE=2015_March14
At the moment I have to manually modify every one of those scripts with the new SUBTYPE variable before I do the major remaster. Is there a way to specify the SUBTYPE in one location and tell each script where to look for that variable? Where would be the best place for such a variable to be kept? Perhaps /etc/DISTRO_SPECS??
EDIT : It seems that this is easy to achieve (thanks Keef) and it is common for bash programmes to have an accompanying "config file" which contains the definitions of variables. The way to link a script to it's corresponding config (definitions) file is to add a line that tells the script where to look. For example this is how the bash script might start:
Code: Select all
#!/bin/bash
. /opt/myprogram/config
blah
blah
blah
The inclusion of the first line above will tell the script to look into file /opt/myprogram/config for a list of it's variable definitions.
The format of that config file could be something like:
Code: Select all
X="2015_version_2"
Y="Newpup_3"
DATE="2015_April_12"
STORAGE_DIRECTORY="/root/userbase"
YAFSPLASH_TEXT_1="Welcome"
YAFSPLASH_TEXT_2="Terminating"