Blame Scripts/Functions/Prepare/prepare.sh

4c79b5
#!/bin/bash
4c79b5
#
8e457b
# prepare.sh -- This function prepares your workstation for using the
8e457b
# centos-art command-line.
4c79b5
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# WITHOUT ANY WARRANTY; without even the implied warranty of
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4c79b5
# ----------------------------------------------------------------------
3b853a
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
111205
function prepare {
4c79b5
8e457b
    # Define packages flag. The package flag (--packages) controls
8e457b
    # whether package verification is performed or not. By default no
8e457b
    # package verification is done.
8e457b
    local FLAG_PACKAGES='false'
8e457b
8e457b
    # Define links flag. The link flag (--links) controls whether
8e457b
    # links verifications are performed or not. By default no link
8e457b
    # verification is done.
8e457b
    local FLAG_LINKS='false'
8e457b
8e457b
    # Define environment flag. The environment flag (--environment)
8e457b
    # controles whether verification of environment variables are
8e457b
    # performed or not. By default no verification of environment
8e457b
    # variables is done.
8e457b
    local FLAG_ENVIRONMENT='false'
8e457b
8e457b
    # Interpret arguments and options passed through command-line.
6449f4
    prepare_getOptions
4c79b5
8e457b
    # Redefine positional parameters using ARGUMENTS. At this point,
8e457b
    # option arguments have been removed from ARGUMENTS variable and
8e457b
    # only non-option arguments remain in it. 
8e457b
    eval set -- "$ARGUMENTS"
8e457b
8e457b
    # Define action name. It does matter what option be passed to
8e457b
    # centos-art, there are many different actions to perform based on
8e457b
    # the option passed (e.g., `--packages', `--links',
8e457b
    # `--environment', etc.).  In that sake, we defined action name
6449f4
    # inside prepare_getOptions, at the moment of interpreting
8e457b
    # options.
8e457b
8e457b
    # Define action value. There is no action value in this function,
8e457b
    # but action name values only. There is no need for non-option
8e457b
    # arguments here since we are doing fixed verifications only in
8e457b
    # predifined paths.
8e457b
8e457b
    # Verify flags and execute actions accordingly. Start with
8e457b
    # packages, links and then environment.
8e457b
    prepare_doPackages
8e457b
    prepare_doLinks
8e457b
    prepare_doEnvironment
8e457b
4c79b5
}