Skip to content. | Skip to navigation

Sections
You are here: Home content generated doc.free bystar PLPC 180058 current accessPage

Bash Interactive Command Modules (Bash-ICM)

Bash Interactive Command Modules (Bash-ICM)

A Permanent Libre Published Content

Bash Interactive Command Modules (Bash-ICM)

Document Number: PLPC-180058   [ .bib ]
Version: 0.1
Dated: December 12, 2018
Group: engineering
Primary URL: http://www.by-star.net/PLPC/180058
Federated Publications: ByTopic -- ByContent
AccessPage Revision: This AccessPage was produced on December 17, 2018 at 19:31 PST (-0800)
Author(s): Neda Communications, Inc.
See Also: PLPC-180050: Unified Interactive Command Modules (ICM) And ICM-Players    
PLPC-180056: Remote Operations Interactive Command Modules (RO-ICM)    
PLPC-180052: GOSSONoT: A Generalized Open-Source Self Organizing Network of Things Platform    

AVAILABLE FORMATS

  • PDF: -- 84K -- Provides the document in Portable Document Format.
  • HTML: -- 100K -- Displays the document as a web page.

AVAILABLE OTHER FORMS

SHORT DESCRIPTION

Bash Interactive Command Modules (Bash-ICM) are implementation of Python-Bash ICM as described in PLPC-180050.


FULL INLINE DOCUMENT

Bash Interactive Command Modules (Bash-ICM)


Bash Interactive Command Modules (Bash-ICM)







Document #PLPC-180058
Version 0.1
December 12, 2018
This Document is Available on-line at:
http://www.by-star.net/PLPC/180058



Neda Communications, Inc.
Email:
http://www.by-star.net/contact


Contents

Part I
About Bash-ICM: This Document, The Software And History

Chapter 1  About BASH-ICM

1.1  The Concept Of Interactive Command Modules (ICM)

The concept and python realization of Interactive Command Modules (ICM) is described in:

Unified Python Interactive Command Modules (ICM) and ICM-Players
A Framework For Development Of Expectations-Complete Commands
A Model For GUI-Line User Experience
http://www.by-star.net/PLPC/180050 — [1]

You should continue reading this document after having read that document.

1.2  Bash-ICMs as a subset of the Python-ICM Framework

Bash-ICMs are a sub-set of Python-ICM Framework. The Remote-Operations model of Python-ICM is not implemented in Bash-ICMs. Bash-ICM-Players are less complete than the Python-ICM-Players.

Bash functions whose names start with “vis_” become automatically visible at Bash-ICM’s command-line-interface. This is similar to how the “Cmnd” classes become automatically visible at Python-ICM’s command-line-interface.

1.3  History Of Bash-ICMs and Python-ICMs

Bash-ICMs predate Python-ICMs and can be considered the origin of Python-ICMs.

Bash-ICMs used to be called IIMs (Interactively Invokable Modules). The collection of Bash-ICMs that are now called BISOS (ByStar Intenernet Services OS) used to be called OSMT (Open Services Management Tools) and LSIP (Libre Service Integration Platform).

1.4  About This Document

Most of this document was written before the evolutions that we mentioned in “History Of Bash-ICMs and Python-ICMs”, hence their terminology predates the Python-ICMs.

We intend to update this document in the future. Since the basic information that is included in the current version of this document still reflects the architecture of the implementation, the current document remains of value.

Part II
Concept and Model

Chapter 2  Open Services Management Tools

2.1  Server To Services Transformation

GNU/Linux demonstrated that large a complete Operating System can be put together purely in the Free Software model.

Various forms of dedicated servers have been integrated based on GNU/Linux. Such server constructs are ad-hoc integrations demanding much expertise.

Collective collaboration towards transformation of ad-hoc servers based on Free Software into mass usable agents for delivery of Libre Services is the next challenge.

Construction of a set of Application Services requires an important extension beyond the underlying software layer. Construction of a set of Application Services requires the integration of a set of software components together to provide useful functionality to the user.

This integration layer must conform to correct principles of structure and consistency. Thus Free Services represent an extension of the Free Software model based on structured and consistent integration.

The versatile “Glue” needed to bring about the needed structure and consistency is a crucial element for realization of Libre Services. Much effort has been devoted to creation of the initial implementation of this Glue. See “Open Systems Management Tools”, [] for more details.

2.2  Open Services Management Tools

OSMT (Open Services Management Tools) are a set of tools on top of which various consistent polices can be implemented.

This is a collection tools that collectively lets you consistently manage Unix and Linux systems and some of the tools will also manage Windows system.

2.3  GOALS

Key goals for the design has been:

  • Be very Unix centric. Focus on Solaris and Linux
  • Limit use of the tools to what is minimally and genericly available on plain Unix systems. Namely Korn Shell.
  • Be consistent in use of the tools. View this work as a collection. Not bits and pieces here and there.
  • Don’t view the tools as host management tools, view them as domain management and system management tools.
  • Support consistent and simultaneous management of multiple domains. Detection of Sites, Domains and Hosts is an integral part of these tools.
  • Tools should be location independent.

2.4  Common Features

2.5  Obtaining LSIP

http://www.neda.com/libre/lpGenesis.sh

2.6  LSIP License

Afero GPL V3.

2.7  LSIP Overview

Take from presentation.

Part III
Libre Platform Base

Chapter 3  Open Platform Libraries

3.1  doLib

The doLib.sh is a place for common features for script that used the seedSubjectAction. This common features includes:

vis_lslist all of the functions (hence, equivalent to items) inside the itemsFile.
do_list 
do_describedescribing each items in the itemsFile if opItem_description function exist within the item.
do_itemActionsif the item has a list of itemActions, then it will perform all of them.
doLibExamplesOutputlist all of the common examples for the seedSubjectAction script which include common examples (showMe, seedHelp, ls, list, describe) and common debugging.

To use this feature, put the following in each of the seedSubjectAction script:

function vis_examples {
    typeset doLibExamples=`doLibExamplesOutput ${G_myName}`
 cat  << _EOF_
EXAMPLES:
${doLibExamples}
--- EVERYTHING ELSE
.....
.....
.....
_EOF_
}

3.2  visLib

This library function the same as doLib except this lib is for seedActions script.

3.3  ocp-lib

The ocp-lib loads all of the osmt library. Each of these libraries will be covered in the following sections.

3.4  ocp-general

ocp-general is a collection of several functions which can be used by any scripts. This library will most probably grow over time to simplify tasks.

Function name convention:

  • MA_: mail addressing parsing
  • ATTR_: Attribute value parsing
  • FN_: File Name Manipulation
  • USER_: passwd file related activities
  • PN_: Path name

The functions included in this library are:


 
MA_domainPartMail address parsing. Print out the domain part. Example: MA_domainPart vendors@neda.com will output neda.com.
MA_localPartMail address parsing. Print out the local part. Example: MA_localPart vendors@neda.com will output vendors.
ATTR_leftSideAttribute value parsing. Print out the left side of the equal sign (=). Example: ATTR_leftSide variable1=value1 will output variable1.
ATTR_rightSideAttribute value parsing. Print out the right side of the equal sign (=). Example: ATTR_rightSide variable1=value1 will output value1.
FN_prefixPrint out only the basename of a file without the extension. Example: FN_prefix /opt/public/osmt/bin/mmaQmailHosts.sh will output mmaQmailHosts.
FN_extensionPrint out only the extension of a basename file. Example: FN_extension /opt/public/osmt/bin/mmaQmailHosts.sh will output sh.
FN_dirsPartPrint out only the directory of a specific file location. Example: FN_dirsPart /opt/public/osmt/bin/mmaQmailHosts.sh will output /opt/public/osmt/bin.
FN_nonDirsPartPrint out only the basename of a specific file location. Example: FN_nonDirsPart /opt/public/osmt/bin/mmaQmailHosts.sh will output mmaQmailHosts.sh.
FN_fileDefunctMakeMake a specific file become no longer active in the system by moving the file into another file and chmod to 0000. It requires 2 arguments. First arg is the name of the file that we want to defunct and second arg is the new name and it should not have existed.
FN_dirDefunctMakeSame as the above except it applies to a directory instead of a file.
FN_FileCreateIfNotThereCreate a null file if it does not exist.
FN_dirCreateIfNotThereCreate a directory if it does not exist using the mkdir command.
FN_dirCreatePathIfNotThereCreate a directory path if it does not exist using mkdir -p command.
FN_fileSymlinkSafeMakeRequires 2 arguments: source/origin of a file (should exist)and the target name. If the target exist, skip the symlink process.
FN_fileSymlinkUpdateSame as FN_fileSymlinkSafeMake except if the target exist, it will remove the old symlink and make a new one.
FN_fileSafeCopyRequired 2 arguments: a source name and a target name. If the target exist, it will skip the copy process.
FN_fileCopySame as FN_fileSafeCopy except if the target exist, it will overwrite the old file. Use with caution.
FN_fileSafeKeepMove a file and rename it with a dateTag extension.
FN_dirSafeKeepMove a directory and rename it with a dteTag extension.
FN_lineIsInFileRequired 2 arguments: string to check and the filename. It will return 0 if the string is found in the file specified and 1 otherwise.
FN_lineAddToFileRequired 3 arguments: string to check, string to be added, the filename.
FN_textReplaceRequired 3 arguments: regexp of text to replace, replacement text, and the filename. The regexp of text to replace has to be in the format of text.*$.
FN_textReplaceOrAddIf the text to be replaced exist in the file, it will call FN_textReplace otherwise the replacement text will be added to the file.
FN_fileInstallThis is to ensure that we use FSF’s install command. In SunOS the location is in /opt/sfw/bin/install.
FN_grepThis is to ensure that we use grep command that supports "-F", "-v", and "-q". In SunOS, the location is /usr/xpg4/bin/grep.
FN_egrepThis is to ensure that we use egrep command that support "-v", "-q".
_opDoRunOnly 
_opDoShowOnly 
_opDoShowRun 
_opDo 
_opDoAssert 
opDoProtectedBegin 
opDoProtectedEnd 
opDoProtected 
USER_isInPasswdFileReturn 0 if a user is in the /etc/passwd file.
USER_loginGivenHomeDirRequired 1 argument: the path to home directory. If the home directory is found in /etc/passwd, it will output his/her loginName and return 0 otherwise it will return 1.
USER_nextLoginNameGet....
PN_fileVerifyList information about file.
FN_fileRmIfThereCalling PN_rmIfThere.
PN_rmIfThereIf -v is specified, it will enable the verbose mode. You can specified more than 1 file to be removed.
IS_inListRequired 2 arguments: a string to be checked and a list of strings. Return 0 if the string is in the list of strings otherwise return 1.
LIST_getLastGet the last argument/string in a list.
LIST_getFirstGet the first argument.
LIST_set 
LIST_minus 
LIST_setMinusResult 
doStderrToStdoutPut standard error to standard output.
G_validateOptionRequired 2 arguments: target and a list. If the target is in the list, it will set targetIsValid="TRUE".
G_abortIfNotSupportedOsAbort the running script if the OS is not supported. The currently supported OS are SunOS and Linux.
G_abortIfNotRunningAsRootAbort the running script if the current user is not root.
G_returnIfNotRunningAsRootReturn 1 if the current user is not root.
G_validateRunOSRequired 1 argument: a list of OS. If the current OS is in the given list, it will set isValid="TRUE" otherwise it will set isValid="FALSE" and exit.
DOS_toFrontSlashConvert DOS filename to UNIX system filename.
DOS_toBackSlash 
RELID_extractInfoInformation about product’s release ID
logActivitySeparator 
buildAndRecord 

3.5  ocp-lineNu

This library contains functions for debugging purposes.

tm_traceDepending on what the trace level is, will print out information for debugging purposes. For more complete information, see section ??.
log_eventFor loging purposes.
eh_problemGive out PROBLEM message and continue.
eh_fatalGive out a FATAL message and exit.

3.6  ocpLibUse

3.7  opRunEnvLib

To setup and verifying the environment configuration on the system.

3.8  opWrappersLib

This script includes these functions:

opNetCfg_paramsGetRequired 2 parameters: clusterName and hostName. Given these 2 parameters, the nedaIPaddr.sh is called and the network setting for this particular cluster and hostname are set.
i_nedaNetParamsGetUsed by the opNetCfg_paramsGet to set all of the network setting as global variables. These global variables are: opNetCfg_ipAddr, opNetCfg_domainName, opNetCfg_netmask, opNetCfg_networkAddr, opNetCfg_defaultRoute.

3.9  itemsLib

itemsLib ia a set of facilities that operate on any item files.

 
opItem_descriptionWhenever -i describe is executed, it will call opItem_description and this function will look for iv_descriptionFunction in each of the item in the itemsFile. If it exist, the description will be printed out.
opItem_selectClusterFiles 
opItem_ifAvailableInvoke 
opItem_isAvailableIt will check whether the item is available to hostMode (by calling opItem_isAvailableToHostMode) and if it is within the cluster (by calling opItem_isWithinClusterScope). It will return 0 if everything is correct.
opItem_isAvailableToHostMode 
opItem_isAvailableToOs 
opItem_isWithinClusterScopeSubject variables should be all set (iv_itemScopeVisibleHosts, iv_itemScopeVisibleClusters, iv_itemScopeHiddenHosts). Returns:
0  if disk within scope and should be acted upon
1  if disk is tagged to be hidden
2  if disk not in the cluster and also not tagged as visible

3.9.1  Visibility Rules

items Visibility

By adding

   iv_itemScopeVisibleHosts  -- List of hosts outside of the clusters
                                item is visible to
   iv_itemScopeVisibleClusters   -- List of clusters, item is visible to
   iv_itemScopeHiddenHosts -- List of hosts inside of the clusters
                              item is visible to

you can then use opItem_isWithinClusterScope to check the visibility of the item.

By adding

    iv_itemAvailableToHostModes

you can then use opItem_isAvailableToHostMode.

By adding

   iv_itemAvailableToOsType  -- matched against opRunOsType
   iv_itemAvailableToMachineArch  --  matched against opRunMachineArch

you can then use opItem_isAvailableToOs.

runMode Visibility

Cluster Visibility

Binary Visibility

3.10  opDoAtAsLib

Chapter 4  Seed Scripts

4.1  seedActions.sh

4.1.1  Description

4.1.2  Example

Take a look at mmaExamplesActions.sh

4.2  seedSubjectAction.sh

4.2.1  Description

4.2.2  Example

Take a look at mmaExamplesObjects.sh

References

[1]
" Neda Communications Inc". " interactive command modules (icm) and players a framework for cohesive generalized scripting a model for gui-line user experience ". Permanent Libre Published Content "180050", Autonomously Self-Published, "July" 2017. http://www.by-star.net/PLPC/180050.


Document Actions
Libre/Halaal Internet Services Provided At LibreCenter By Neda

Member of By* Federation Of Autonomous Libre Services

This web site has been created based exclusively on the use of Halaal Software and Halaal Internet Application Services. It is part of the By* Federation of Autonomous Libre Services which in turn are part of the Halaal/Libre By* Digitial Ecosystem which incorporate the following software components: