|
|
93705a |
#!/bin/bash
|
|
|
93705a |
#
|
|
|
c92010 |
# cli_getTemporalFile.sh -- This function returns the absolute path
|
|
|
c92010 |
# you need to use to create temporal files. Use this function whenever
|
|
|
c92010 |
# you need to create temporal files inside centos-art.sh script.
|
|
|
93705a |
#
|
|
|
9a3ef2 |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
93705a |
#
|
|
|
7cd8e9 |
# This program is free software; you can redistribute it and/or
|
|
|
7cd8e9 |
# modify it under the terms of the GNU General Public License as
|
|
|
7cd8e9 |
# published by the Free Software Foundation; either version 2 of the
|
|
|
7cd8e9 |
# License, or (at your option) any later version.
|
|
|
93705a |
#
|
|
|
93705a |
# This program is distributed in the hope that it will be useful, but
|
|
|
93705a |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
93705a |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
93705a |
# General Public License for more details.
|
|
|
93705a |
#
|
|
|
93705a |
# You should have received a copy of the GNU General Public License
|
|
|
93705a |
# along with this program; if not, write to the Free Software
|
|
|
93705a |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
93705a |
# USA.
|
|
|
93705a |
#
|
|
|
93705a |
# ----------------------------------------------------------------------
|
|
|
93705a |
# $Id$
|
|
|
93705a |
# ----------------------------------------------------------------------
|
|
|
93705a |
|
|
|
93705a |
function cli_getTemporalFile {
|
|
|
93705a |
|
|
|
c92010 |
# Define base name for temporal file. This is required when svg
|
|
|
c92010 |
# instances are created previous to be parsed by inkscape in order
|
|
|
c92010 |
# to be exported as png. In such cases .svg file exention is
|
|
|
c92010 |
# required in order to avoid complains from inkscape.
|
|
|
c92010 |
local NAME="$(cli_getRepoName "$1" 'f')"
|
|
|
93705a |
|
|
|
c92010 |
# Check default base name for temporal file, it can't be an empty
|
|
|
c92010 |
# value.
|
|
|
93705a |
if [[ "$NAME" == '' ]];then
|
|
|
c92010 |
cli_printMessage "${FUNCNAME}: `gettext "First argument cannot be empty."`"
|
|
|
93705a |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
93705a |
fi
|
|
|
93705a |
|
|
|
c92010 |
# Define source location where temporal files will be stored.
|
|
|
93705a |
local TMPDIR='/tmp'
|
|
|
93705a |
|
|
|
93705a |
# Define unique identifier for temporal file.
|
|
|
93705a |
local UUID=$(cat /proc/sys/kernel/random/uuid)
|
|
|
93705a |
|
|
|
c92010 |
# Define absolute path for temporal file using the program name,
|
|
|
c92010 |
# the current locale, the unique identifier and the file name.
|
|
|
c92010 |
local TMPFILE="${TMPDIR}/${CLI_PROGRAM}-$(cli_getCurrentLocale)-${UUID}-${NAME}"
|
|
|
93705a |
|
|
|
93705a |
# Output absolute path to final temporal file.
|
|
|
93705a |
echo $TMPFILE
|
|
|
93705a |
|
|
|
93705a |
}
|