|
|
de3499 |
#!/bin/bash
|
|
|
de3499 |
#
|
|
|
de3499 |
# prepare_updateEnvironment.sh -- This function updates the
|
|
|
79573d |
# `~/.bash_profile' file to provide default configuration values to
|
|
|
79573d |
# centos-art.sh script. Those values which aren't set by this function
|
|
|
79573d |
# are already set in the `bash_profile.conf' template file we use as
|
|
|
79573d |
|
|
|
de3499 |
#
|
|
|
de3499 |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
de3499 |
#
|
|
|
de3499 |
# This program is free software; you can redistribute it and/or modify
|
|
|
de3499 |
|
|
|
de3499 |
|
|
|
de3499 |
|
|
|
de3499 |
#
|
|
|
de3499 |
|
|
|
de3499 |
|
|
|
de3499 |
|
|
|
de3499 |
# General Public License for more details.
|
|
|
de3499 |
#
|
|
|
de3499 |
|
|
|
de3499 |
# along with this program; if not, write to the Free Software
|
|
|
de3499 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
de3499 |
#
|
|
|
de3499 |
# ----------------------------------------------------------------------
|
|
|
1da4b2 |
# $Id$
|
|
|
de3499 |
# ----------------------------------------------------------------------
|
|
|
de3499 |
|
|
|
de3499 |
function prepare_updateEnvironment {
|
|
|
de3499 |
|
|
|
34452e |
|
|
|
34452e |
|
|
|
34452e |
|
|
|
34452e |
if [[ ! $0 =~ "^/[[:alnum:]/_-]+${CLI_NAME}.sh$" ]];then
|
|
|
34452e |
cli_printMessage "`gettext "To set environment variables you should run centos-art.sh using its abosolute path."`" --as-error-line
|
|
|
34452e |
fi
|
|
|
34452e |
|
|
|
79573d |
local PROFILE=bash_profile
|
|
|
79573d |
local SOURCE=${PREPARE_CONFIG_DIR}/${PROFILE}.conf
|
|
|
79573d |
local TARGET=${HOME}/.${PROFILE}
|
|
|
79573d |
|
|
|
79573d |
|
|
|
79573d |
|
|
|
79573d |
|
|
|
79573d |
|
|
|
79573d |
local TCAR_WORKDIR=$(echo "$0" | sed -r 's!^(.+)/trunk.*!\1!')
|
|
|
79573d |
|
|
|
79573d |
|
|
|
79573d |
|
|
|
79573d |
# and shouldn't be change to anything else, at least if you
|
|
|
79573d |
|
|
|
79573d |
local TCAR_BRAND='centos'
|
|
|
de3499 |
|
|
|
de3499 |
|
|
|
79573d |
cli_printMessage "${TARGET}" --as-updating-line
|
|
|
de3499 |
|
|
|
de3499 |
|
|
|
de3499 |
|
|
|
de3499 |
|
|
|
de3499 |
cp -f $SOURCE $TARGET
|
|
|
de3499 |
|
|
|
79573d |
|
|
|
79573d |
sed -i -r \
|
|
|
79573d |
-e "s,^(TCAR_WORKDIR=).*,\1${TCAR_WORKDIR}," \
|
|
|
79573d |
-e "s,^(TCAR_BRAND=).*,\1${TCAR_BRAND}," \
|
|
|
79573d |
${TARGET}
|
|
|
e5b220 |
|
|
|
de3499 |
}
|