|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# prepare_forUsingPaths.sh -- This function verifies centos-art.sh
|
|
|
4c79b5 |
# required paths existence. If there is any missing path, leave a
|
|
|
4c79b5 |
# message and quit script execution.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Copyright (C) 2009-2010 Alain Reguera Delgado
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is free software; you can redistribute it and/or modify
|
|
|
4c79b5 |
# it under the terms of the GNU General Public License as published by
|
|
|
4c79b5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
|
4c79b5 |
# (at your option) any later version.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is distributed in the hope that it will be useful, but
|
|
|
4c79b5 |
# 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
|
|
|
4c79b5 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
4c79b5 |
# USA.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
# $Id: prepare_forUsingPaths.sh 98 2010-09-19 16:01:53Z al $
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function prepare_forUsingPaths {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Output action message.
|
|
|
4c79b5 |
cli_printMessage "`gettext "Directories and files"`" "AsHeadingLine"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define variables as local to avoid conflicts outside.
|
|
|
4c79b5 |
local DIRECTORY=''
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Check centos user's home directory.
|
|
|
4c79b5 |
cli_printMessage "${REPO_PATHS[0]}" "AsResponseLine"
|
|
|
4c79b5 |
if [[ ! -d ${REPO_PATHS[0]} ]];then
|
|
|
4c79b5 |
cli_printMessage "`gettext "The following directory doesn't exist:"`"
|
|
|
4c79b5 |
cli_printMessage "${REPO_PATHS[0]}" "AsResponseLine"
|
|
|
4c79b5 |
cli_printMessage "`gettext "Do you want to create the directory now?"`" "AsYesOrNoRequestLine"
|
|
|
4c79b5 |
eval sudo useradd centos
|
|
|
4c79b5 |
eval sudo passwd centos
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Check centos user's bin directory.
|
|
|
4c79b5 |
cli_printMessage "${REPO_PATHS[1]}" "AsResponseLine"
|
|
|
4c79b5 |
if [[ ! -d ${REPO_PATHS[1]} ]];then
|
|
|
4c79b5 |
cli_printMessage "`gettext "The following directory doesn't exist:"`"
|
|
|
4c79b5 |
cli_printMessage "${REPO_PATHS[1]}" "AsResponseLine"
|
|
|
4c79b5 |
cli_printMessage "`gettext "Do you want to create the directory now?"`" "AsYesOrNoRequestLine"
|
|
|
4c79b5 |
eval mkdir ${REPO_PATHS[1]}
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Check centos-art.sh invocation link.
|
|
|
4c79b5 |
cli_printMessage "${REPO_PATHS[2]}" "AsResponseLine"
|
|
|
4c79b5 |
if [[ ! -h ${REPO_PATHS[2]} ]];then
|
|
|
4c79b5 |
cli_printMessage "`gettext "The following symbolic link doesn't exist:"`"
|
|
|
4c79b5 |
cli_printMessage "${REPO_PATHS[2]}" "AsResponseLine"
|
|
|
4c79b5 |
cli_printMessage "`gettext "Do you want to create the link now?"`" "AsYesOrNoRequestLine"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Check centos-art.sh script file before creating its
|
|
|
4c79b5 |
# invocation link.
|
|
|
4c79b5 |
cli_printMessage "${REPO_PATHS[3]}" "AsResponseLine"
|
|
|
4c79b5 |
if [[ -f ${REPO_PATHS[3]} ]];then
|
|
|
4c79b5 |
eval ln -fs ${REPO_PATHS[3]} ${REPO_PATHS[2]}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
cli_printMessage "`gettext "The following file doesn't exist:"`"
|
|
|
4c79b5 |
cli_printMessage "${REPO_PATHS[3]}" "AsResponseLine"
|
|
|
4c79b5 |
cli_printMessage "trunk/Scripts/Bash/Functions/Prepare --filter='prepare_forUsingPaths.sh" "AsToKnowMoreLine"
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Check user's fonts directory. In order for some artworks to be
|
|
|
4c79b5 |
# rendered correctly, denmark font needs to be available. By
|
|
|
4c79b5 |
# default, denmark font doesn't come with CentOS distribution so
|
|
|
4c79b5 |
# create a symbolic link (from the one we have inside repository)
|
|
|
4c79b5 |
# to make it available if it isn't yet.
|
|
|
4c79b5 |
if [[ ! -d ${REPO_PATHS[6]} ]];then
|
|
|
4c79b5 |
cli_printMessage "`gettext "The following directory doesn't exist:"`"
|
|
|
4c79b5 |
cli_printMessage "${REPO_PATHS[6]}" "AsResponseLine"
|
|
|
4c79b5 |
cli_printMessage "`gettext "Do you want to create the directory now?"`" "AsYesOrNoRequestLine"
|
|
|
4c79b5 |
mkdir ${REPO_PATHS[6]}
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
if [[ ! -f ${REPO_PATHS[6]}/denmark.ttf ]];then
|
|
|
4c79b5 |
if [[ ! -h ${REPO_PATHS[6]}/denmark.ttf ]];then
|
|
|
4c79b5 |
cli_printMessage "`gettext "The following file doesn't exist:"`"
|
|
|
4c79b5 |
cli_printMessage "${REPO_PATHS[6]}/denmark.ttf" "AsResponseLine"
|
|
|
4c79b5 |
cli_printMessage "`gettext "Do you want to create the link now?"`" "AsYesOrNoRequestLine"
|
|
|
4c79b5 |
ln -sf ${REPO_PATHS[7]}/denmark.ttf ${REPO_PATHS[6]}/denmark.ttf
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
cli_printMessage "`gettext "Permissions"`" "AsHeadingLine"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Reset script files permissions. This is to be sure script files
|
|
|
4c79b5 |
# are using the correct file permissions. Otherwise some script
|
|
|
4c79b5 |
# may not be loaded.
|
|
|
4c79b5 |
cli_printMessage "${REPO_PATHS[4]}" "AsResponseLine"
|
|
|
4c79b5 |
eval "chmod -R 755 ${REPO_PATHS[4]}"
|
|
|
4c79b5 |
eval "chown -R $USER:$USER ${REPO_PATHS[4]}"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|