Blame Scripts/Modules/Hello/hello.sh

Alain Reguera Delgado e051b3
#!/bin/bash
Alain Reguera Delgado e051b3
######################################################################
Alain Reguera Delgado e051b3
#
Alain Reguera Delgado e051b3
#   hello.sh -- Print greeting messages and exit successfully.
Alain Reguera Delgado e051b3
#
Alain Reguera Delgado e051b3
#   Written by:
Alain Reguera Delgado e051b3
#   * Alain Reguera Delgado <al@centos.org.cu>, 2013
Alain Reguera Delgado e051b3
#
Alain Reguera Delgado e051b3
# Copyright (C) 2009-2013 The CentOS Artwork SIG
Alain Reguera Delgado e051b3
#
Alain Reguera Delgado e051b3
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado e051b3
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado e051b3
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado e051b3
# your option) any later version.
Alain Reguera Delgado e051b3
#
Alain Reguera Delgado e051b3
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado e051b3
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado e051b3
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado e051b3
# General Public License for more details.
Alain Reguera Delgado e051b3
#
Alain Reguera Delgado e051b3
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado e051b3
# along with this program; if not, write to the Free Software
Alain Reguera Delgado e051b3
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado e051b3
#
Alain Reguera Delgado e051b3
######################################################################
Alain Reguera Delgado e051b3
Alain Reguera Delgado e051b3
function hello {
Alain Reguera Delgado e051b3
Alain Reguera Delgado e051b3
    # Define default greeting message.
Alain Reguera Delgado e051b3
    local HELLO_WORLD="`gettext "Hello, World!"`"
Alain Reguera Delgado e051b3
Alain Reguera Delgado e051b3
    # Define actions variable. Here is where actions related to
Alain Reguera Delgado e051b3
    # module-specific options are stored in for further processing.
Alain Reguera Delgado e051b3
    local ACTIONS=''
Alain Reguera Delgado e051b3
Alain Reguera Delgado e051b3
    # Interpret module-specific options and store related actions.
Alain Reguera Delgado e051b3
    hello_getOptions
Alain Reguera Delgado e051b3
Alain Reguera Delgado e051b3
    # Print greeting message
Alain Reguera Delgado e051b3
    if [[ -z ${ACTIONS} ]];then
Alain Reguera Delgado e051b3
        # Using parent module.
Alain Reguera Delgado e051b3
        tcar_printMessage "${HELLO_WORLD}" --as-stdout-line
Alain Reguera Delgado e051b3
    else
Alain Reguera Delgado e051b3
        # Using child module.
Alain Reguera Delgado e051b3
        tcar_setModuleEnvironment -m 'output' -t 'child'
Alain Reguera Delgado e051b3
    fi
Alain Reguera Delgado e051b3
Alain Reguera Delgado e051b3
}