|
|
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 |
#
|
|
|
2d3646 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
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
|
|
|
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
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
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.
|
|
|
39ae1a |
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
|
|
|
37af2a |
cli_printMessage "`gettext "The first argument cannot be empty."`" --as-error-line
|
|
|
93705a |
fi
|
|
|
93705a |
|
|
|
be8fb2 |
# Redefine file name for the temporal file. Make it a combination
|
|
|
be8fb2 |
# of the program name, the program process id, a random string and
|
|
|
be8fb2 |
# the design model name. Using the program name and process id in
|
|
|
be8fb2 |
# the file name let us to relate both the shell script execution
|
|
|
be8fb2 |
# and the temporal files it creates, so they can be removed in
|
|
|
be8fb2 |
# case an interruption signal be detected. The random string let
|
|
|
be8fb2 |
# us to produce the same artwork in different terminals at the
|
|
|
be8fb2 |
# same time. the The design model name provides file
|
|
|
be8fb2 |
# identification.
|
|
|
be8fb2 |
NAME=${CLI_PROGRAM}-${CLI_PROGRAM_ID}-${RANDOM}-${NAME}
|
|
|
93705a |
|
|
|
c92010 |
# Define absolute path for temporal file using the program name,
|
|
|
c92010 |
# the current locale, the unique identifier and the file name.
|
|
|
be8fb2 |
local TEMPFILE="${CLI_TEMPDIR}/${NAME}"
|
|
|
93705a |
|
|
|
93705a |
# Output absolute path to final temporal file.
|
|
|
be8fb2 |
echo $TEMPFILE
|
|
|
93705a |
|
|
|
93705a |
}
|