Environment Functions Reference In addition to environment variables described above, the centos-art.sh script makes available the following common environment functions once it is executed: cli_checkRepoDirSource cli_checkRepoDirSource The cli_checkRepoDirSource function standardizes the path construction to directories inside it the working copy, using absolute paths. This function transforms relative paths passed as non-option arguments to centos-art.sh script command-line into absolute paths inside the working copy and verifies whether they really exist as directories inside the working copy or not. If the path provided doesn't exist as directory inside the working copy, the script will finish its execution immediately with an error message. Otherwise, if the directory exists, the variable ACTIONVAL is redefined with the related absolute path for further use. Use the cli_checkRepoDirSource function whenever you need to be sure that non-option arguments passed to centos-art.sh script command-line will always point to directories inside the working copy. cli_expandTMarkers cli_expandTMarkers LOCATION The cli_expandTMarkers standardizes construction of translation markers and their related expansion. As convention, translation markers are set inside source files (e.g., DocBook, SVG) and expanded inside temporal instances used to produce final contents. The LOCATION argument should point to the temporal file where translation markers expansion takes place in. Translation markers written in source files must comply the =[A-Z_]+= regular expression pattern. For example, =UNKNOWN_MARKER= is a valid translation marker without any replacement. To prevent centos-art.sh script from expanding translation markers, add a backslash (\) between the first equal sign and the following letter. For example, =\...= won't be expanded. The cli_expandTMarkers supports the following translation markers: =\COPYRIGHT_YEAR_LAST= =\COPYRIGHT_YEAR= These translation markers expand to the last year used in copyright notes. For example, =COPYRIGHT_YEAR_LAST=. =\COPYRIGHT_YEAR_LIST= =\COPYRIGHT_YEARS_LIST= This translation markers expand to the list of years used in copyright notes. For example, =COPYRIGHT_YEARS_LIST=. The first year represents the time we began to work on &TCAR;. =\COPYRIGHT_HOLDER= This translation marker expands to the holder used in copyright notes. For example, =COPYRIGHT_HOLDER=. =\COPYRIGHT_HOLDER_PREDICATE= This translation marker expands both the holder and the predicate used in copyright notes. For example, =COPYRIGHT_HOLDER_PREDICATE=. =\BRAND= This translation marker expands to the brand name used on files names and URLs inside &TCAR;. For example, =BRAND=. =\LICENSE= This translation marker expands to the license information used in files created by centos-art.sh script. For example, =LICENSE=. =\LICENSE_URL= This translation marker expands to the license URL used in files created by centos-art.sh script. For example, =LICENSE_URL=. =\THEME= This translation marker expands to the theme portion of path you are producing through centos-art.sh script. As consequence, this translation marker should be used in situations where you are producing theme components only. This translation marker expands its value by retrieving the theme part of the path you provide as non-option argument to centos-art.sh script. For example, if you provide the path trunk/Identity/Images/Themes/Modern/2/Distro/5, this translation will expand to the Modern/2/ value. In case you need to retrieve the theme name or version separately one another, then you can use the =\THEMENAME= and =\THEMERELEASE= translation markers, respectively. When you use these translation markers, forward slashes are removed from result. So, if you provide the path trunk/Identity/Images/Themes/Modern/2/Distro/5, =\THEMENAME= will expand to Modern and =THEMERELEASE= will expand to 2. =\RELEASE= This translation marker expands to the current release information of your CentOS distribution. By default this information is retrieved from /etc/redhat-release. In case the option be passed, the value specified with it will overwrite the default value and will be this the one used as section for this translation marker to retrieve the release information. So, for example, if you are running a CentOS-5.8 distribution and no option is passed to centos-art.sh script, this translation marker expands to 5.8. On the other hand, if you are still running a CentOS-5.8 distribution but provide the option to centos-art.sh script, this translation marker expands to 6.3 instead. In case you need to retrieve minor and major release numbers separately one another, then you can use the =\MINOR_RELEASE= and =\MAJOR_RELEASE= translation makers, respectively. =\ARCH= This translation marker expands to the current architecture of your CentOS Distribution. By default this information is retrieved from uname -i. In case the option be passed, the value specified with it will overwrite the default value and will be the one used as section. For example, if the uname -i outputs the line i386, this translation marker will expand to i386. On the other hand, if you pass the option to centos-art.sh script, this translation marker will expand to x86_64 instead. =\URL= This translation marker expands to the URL which points to &TCP; home page. For example, =URL=. In case you are using the centos-art.sh script in a different locale but English (en_US.UTF-8), this translation marker expands as usual but with the language information appended to the end of the string. For example, if you are executing the centos-art.shscript for Spanish locale (e.g., es_ES.UTF-8), this translation marker expands to =URL=es/. In case you need to expand other URL related to &TCP; domain, use translation markers described in . Likewise =\URL=, translation markers described in does append the current language information to the end of the URL string based on the locale information you are currently executing the centos-art.sh script. URL-related translation markers Translation Marker Expands To =\URL_WIKI= =URL_WIKI= =\URL_LISTS= =URL_LISTS= =\URL_FORUMS= =URL_FORUMS= =\URL_MIRRORS= =URL_MIRRORS= =\URL_DOCS= =URL_DOCS= =\URL_PROJECTS= =URL_PROJECTS= =\URL_SVN= =URL_SVN= =\URL_TRAC= =URL_TRAC= =\URL_PLANET= =URL_PLANET=
=\MAIL_DOCS= This translation marker expands to CentOS documentation mailing list address. For example, =MAIL_DOCS=. =\LOCALE= This translation marker expands to the current locale information used by centos-art.sh script. This value is retrieved from the LANG environment variable and should look like =LOCALE=. In case you need to retrieve the language and country part separately one another, you can use the =\LOCALE_LL= and =\LOCALE_CC=, respectively. =\REPO_TLDIR= This translation marker expands to the absolute path to trunk/ directory inside your workstation. For example, /home/al/Projects/CentOS/artwork/trunk. =\REPO_HOME= =\TCAR_WORKDIR= This translation marker expands to the absolute path of your working copy. For example, /home/al/Projects/CentOS/artwork.
See also:
cli_exportFunctions cli_exportFunctions EXPORTID The cli_exportFunctions function standardizes the way specific functionalities are exported to centos-art.sh script execution environment. The EXPORTID argument points the specific function initialization file relatively from trunk/Scripts/Bash/Functions directory on. For example, if we want to export the render specific functionality, we use the following construction: cli_exportFunctions "Render/render" In this construction, Render with the first letter in upper case is the name of the directory under trunk/Scripts/Bash/Functions where the specific functionality is stored in, and render with all letters in lower case is the name of the specific functionality we want to export, without its extension. This name is also used as suffix to identify all files related to the specific functionality we are exporting to centos-art.sh script execution environment. See also: cli_getConfigLines cli_getConfigLines FILE SECTION OPTION The cli_getConfigLines function standardizes the way configuration lines are retrieved from configuration files. The cli_getConfigLines function accepts the following arguments: FILE This argument specifies the absolute path to the configuration file you want to retrieve configuration lines from. For example, ${TCAR_WORKDIR}/trunk/Identity/Models/Themes/Default/Distro/5/Anaconda/branding.conf. SECTION This argument specifies the name of the section you want to retrieve configuration lines from. For example, symbols without brackets. OPTION This argument specifies the name of the option related to the configuration line you want to retrieve. For example, anaconda_header.svgz. In order for cli_getConfigLines to work properly, the configuration files must have a section line with the form [sectionname] which groups several option = "value" lines. Lines beginning with # are ignored and can be used for comments. Configuration file used to produce Tcar-fs documentation manual Configuration used to produce Tcar-fs documentation manual [main] # Specify documentation backend used by documentation manual. manual_format = "texinfo" # Specify title style used by sections inside the manual. manual_section_style = "directory" # Specify the order used by sections inside the manual. manual_section_order = "ordered" [templates] # Specify relation between template files and section definition files # inside the manual. Chapters/section-functions.texinfo = "^.+-functions-[[:alnum:]]+\.texinfo$" Chapters/section.texinfo = "^.+\.texinfo$" The section names and option names used inside configuration files can be anything. It depends on the use and interpretation programmed inside centos-art.sh script for specific purposes which defines what kind of section and options must exist inside a configuration file. For example, consider the configuration files used by render functionality. They follow the same structure used in documentation configuration files but the meaning of their sections and options change to fit the specific needs of render functionality. Configuration file used to produced Anaconda images Configuration used to produced Anaconda images [types] anaconda_header.svgz = "Types/White/48/=\BRAND=-5.png:x48+20+20" first.svgz = "Types/White/32/=\BRAND=-5.png:x32+30+219" splash.svgz = "Types/White/48/=\BRAND=-5-msg.png:x48+30+138" [symbols] anaconda_header.svgz = "Symbols/48/=\BRAND=.png:x48+732+20" first.svgz = "Symbols/48/=\BRAND=.png:x48+30+20" splash.svgz = "Symbols/48/=\BRAND=.png:x48+30+20" Use the cli_getConfigLines function when you need to retrieve option = "value" lines from configuration files in a controlled way. See also: cli_getConfigValue cli_getConfigValue FILE SECTION OPTION The cli_getConfigValue function standardizes the way option values are retrieved from configuration files. As convention, cli_getConfigValue uses the output produced by cli_getConfigLines as input to retrieve the option values. As convention, in option = "value" lines, the values retrieved are always on the right side. The values retrieved are also output without quotation and translation markers already expanded. The cli_getConfigValue function accepts the following arguments: FILE This argument specifies the absolute path to the configuration file you want to retrieve the value from. For example, ${TCAR_WORKDIR}/trunk/Identity/Models/Themes/Default/Distro/5/Anaconda/branding.conf. SECTION This argument specifies the name of the section related to the configuration line you want to retrieve the value from. For example, symbols without brackets. OPTION This argument specifies the name of the option you want to retrieve the value from. For example, in , the anaconda_header.svgz option will output the Symbols/48/=\BRAND=.png:x48+732+20 value without quotation and translation markers expanded. So if the value of TCAR_BRAND environment variable is centos, the real value you get will be Symbols/48/centos.png:x48+732+20. Use the cli_getConfigValue function whenever you want to retrieve values from configuration files in a controlled way. See also: cli_getFilesList cli_getFilesList --pattern --mindepth --maxdepth --type --uid LOCATION The cli_getFilesList standardizes the way list of files are built inside the centos-art.sh script. This function outputs a sorted and unique list of files based on the options and location provided as argument. This function is an interface to the find command. Don't use find command directly inside the centos-art.sh script. Instead, use the cli_getFilesList function. The cli_getFilesList accepts the following arguments: LOCATION This arguments must be the absolute path to a directory and specifies where the search of files in any form (e.g., directories, links, etc.) will take place in. If LOCATION isn't a directory, the script finishes its execution with an error message. The cli_getFilesList accepts the following options: This option specifies a posix-egrep type regular expression as value. This regular expression is applied to path specified in LOCATION argument. Only file paths that match this regular expression inside LOCATION directory will be included in the final list of files. By default, if this option is not provided, the ^/.*[[:alnum:]_/-]+$ regular expression is used. When you use the cli_getFilesList you don't need to specified the absolute path of files you want to look for. This is something cli_getFilesList already does for you. When you use this function, the value you pass as regular expression isn't the final regular expression used. Instead, the regular expression you pass is used to build the final regular expression passed to find command. The final regular expression passed to find is ^/.*${PATTERN}$, where ${PATTERN} is the value you passed to option as REGEX. This option specifies the minimal NUMBER of levels deep the search should go under the directory LOCATION specified. For example, if you specify the search will start two levels deep considering the path provided as section. This option specifies the maximum NUMBER of levels deep the search should go under the directory LOCATION specified. For example, if you specify the search will begin in the very same directory path you provided as LOCATION and stop two levels deep using it as section. This option specifies the type of files being searched. This option accepts the same values the find option does. However, the following STRING values are the most used inside the script so far: d — directory. f — regular file. This option specifies the numeric user id of the files you want to search. Only files that match this numeric user id will be added to the final list of files. Use the cli_getFilesList whenever you need to build list of files for further processing. cli_getPathComponent cli_getPathComponent --release --release-major --release-minor --release-pattern --architecture --architecture-pattern --motif --motif-name --motif-release --motif-pattern PATH ... cli_synchronizeRepoChanges cli_syncronizeRepoChanges LOCATION The cli_synchronizeRepoChanges standardizes the way changes are synchronized between the working copy and the central repository using LOCATION as section. This function is the interface we use inside the centos-art.sh script to execute the Svn functionality described in . Use cli_synchronizeRepoChanges function inside the centos-art.sh script whenever you need to synchronize one or more changes at any LOCATION inside the working copy. cli_printMessage cli_printMessage MESSAGE --as-separator-line --as-banner-line --as-cropping-line --as-tuningup-line --as-checking-line --as-combining-line --as-creating-line --as-reading-line --as-savedas-line --as-linkto-line --as-movedto-line --as-validating-line --as-template-line --as-configuration-line --as-palette-line --as-reponse-line --as-request-line --as-selection-line --as-error-line --as-toknowmore-line --as-yesornorequest-line --as-notrailingnew-line --as-stdout-line --as-stderr-line The cli_printMessage function standardizes the way centos-ar.sh scirpt prints messages. By default, centos-art.sh script prints all messages to the standard output with the exception of those messages printed with the option, which are printed to standard error output instead. The cli_printMessage function requires two arguments. The first argument specifies the MESSAGE you want to print and the second argument specifies the FORMAT you'll use to print that message. Because this function is so used inside the centos-art.sh script, it is convenient to provide localization to strings passed as MESSAGE using gettext contructions when they aren't paths. The cli_printMessage function accepts the following formats as second argument: This format takes the first character passed as MESSAGE and repeats it horizontally to build a separator line. Use this format whenever you need to create a logical separation between different actions. This format takes the string passed as MESSAGE and puts it inside two horizontal separator lines. Use this format whenever you need to print header information for following lines. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file has been cropped. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file has been tuned-up. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file has been checked or verified (e.g., through cli_checkFiles functionality). This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file has been combined. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file has been created. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file has been read. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file has been saved. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file has been linked. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file has been moved. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file has been validated. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file is a template or design model. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file is a configuration file. This format is for two columns messages where MESSAGE generally refers to a file inside the repository. Use this format whenever you need to imply the fact that certain file is a palette of colors. This format adds --> at the begining of the string passed as MESSAGE. Use this format whenever you need to imply the fact that certain file is considered part of a response. For example, when you need to express that a group of files will take ceratin action, you can use this option to doing so. This format prints MESSAGE without trailing new line. Use this format whenever you need to imply a question or yes or no request. This format uses each word in MESSAGE as item of a selection list. Use this format whenever you need to select one of the items provided as MESSAGE. This format prints error messages produced by centos-art.sh script. It uses the caller built-in command to display the line number and the filename where such error was triggered. Later, it prints where to find more information by using the option. This format takes a function name as MESSAGE and prints the command you can use to find more information about it. When this option is passed the script finishes its execution immediately. This option is used in combination with to finish the script execution after an error. This format takes a question as MESSAGE and reads a yes or no answer. When answer is negative, the script finishes its execution immediately. When answer is affirmative, the script continues its execution normally. Print MESSAGE without any trailing newline. Print MESSAGE to standard output. Print MESSAGE to standard error output. Use cli_printMessage function whenever you need to print information inside the centos-art.sh script. cli_unsetFunctions cli_unsetFunctions EXPORTID ... See also: cli_getTemporalFile cli_unsetFunctions FILENAME ... ... ...