Blame tcar_printCopyrightInfo.sh

Alain Reguera Delgado e54180
#!/bin/bash
Alain Reguera Delgado e54180
######################################################################
Alain Reguera Delgado e54180
#
Alain Reguera Delgado e54180
#   tcar_printCopyrightInfo.sh -- This function standardizes the
Alain Reguera Delgado e54180
#   copyright information printed on content produced by centos-art.sh
Alain Reguera Delgado e54180
#   script.
Alain Reguera Delgado e54180
#
Alain Reguera Delgado e54180
#   As far as I understand, the copyright exists to make people create
Alain Reguera Delgado e54180
#   more.  The copyright gives creators the legal power over their
Alain Reguera Delgado e54180
#   creations and so the freedom to distribute them under the ethical
Alain Reguera Delgado e54180
#   terms the creator considers better.  At this moment I don't feel
Alain Reguera Delgado e54180
#   very confident about this legal affairs and their legal
Alain Reguera Delgado e54180
#   implications, but I need to decide what copyright information the
Alain Reguera Delgado e54180
#   centos-art.sh script will print out when someone request
Alain Reguera Delgado e54180
#   information about it.  So, in that sake, I am using The CentOS
Alain Reguera Delgado e54180
#   Artwork SIG as copyright holder and the GNU Public License,
Alain Reguera Delgado e54180
#   version 2 or any later, for software distribution.
Alain Reguera Delgado e54180
#
Alain Reguera Delgado e54180
#   Written by:
Alain Reguera Delgado e54180
#   * Alain Reguera Delgado <al@centos.org.cu>, 2009-2013
Alain Reguera Delgado e54180
#
Alain Reguera Delgado e54180
# Copyright (C) 2009-2013 The CentOS Artwork SIG
Alain Reguera Delgado e54180
#
Alain Reguera Delgado e54180
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado e54180
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado e54180
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado e54180
# your option) any later version.
Alain Reguera Delgado e54180
#
Alain Reguera Delgado e54180
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado e54180
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado e54180
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado e54180
# General Public License for more details.
Alain Reguera Delgado e54180
#
Alain Reguera Delgado e54180
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado e54180
# along with this program; if not, write to the Free Software
Alain Reguera Delgado e54180
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado e54180
#
Alain Reguera Delgado e54180
######################################################################
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
function tcar_printCopyrightInfo {
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
    # Define gettext-specific variables locally, to provide
Alain Reguera Delgado e54180
    # per-function localization.
Alain Reguera Delgado e54180
    local TEXTDOMAIN="${FUNCNAME}.sh"
Alain Reguera Delgado e54180
    local TEXTDOMAINDIR="${TCAR_SCRIPT_BASEDIR}/Scripts/Locales"
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
    case "${1}" in
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
        --license )
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
            # Print the license name. 
Alain Reguera Delgado e54180
            echo "`gettext "Creative Common Attribution-ShareAlike 3.0 License"`"
Alain Reguera Delgado e54180
            ;;
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
        --license-url )
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
            # Print the url related to license name.
Alain Reguera Delgado e54180
            tcar_printUrl --cc-sharealike
Alain Reguera Delgado e54180
            ;;
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
        --first-year )
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
            # The former year when I (as collaborator of The CentOS
Alain Reguera Delgado e54180
            # Project) started to consolidate The CentOS Project
Alain Reguera Delgado e54180
            # Corporate Visual Identity through the CentOS Artwork
Alain Reguera Delgado e54180
            # Repository.
Alain Reguera Delgado e54180
            echo '2009'
Alain Reguera Delgado e54180
            ;;
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
        --year|--last-year)
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
            # The last year when The CentOS Project stopped working in
Alain Reguera Delgado e54180
            # its Corporate Visual Identity through the CentOS Artwork
Alain Reguera Delgado e54180
            # Repository. That is something that I hope never happens,
Alain Reguera Delgado e54180
            # so assume the current year as last working year.
Alain Reguera Delgado e54180
            date +%Y
Alain Reguera Delgado e54180
            ;;
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
        --years-range )
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
            local FIRST_YEAR=$(tcar_printCopyrightInfo --first-year)
Alain Reguera Delgado e54180
            local LAST_YEAR=$(tcar_printCopyrightInfo --last-year)
Alain Reguera Delgado e54180
            echo "${FIRST_YEAR}-${LAST_YEAR}"
Alain Reguera Delgado e54180
            ;;
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
        --years-list )
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
            local FIRST_YEAR=$(tcar_printCopyrightInfo --first-year)
Alain Reguera Delgado e54180
            local LAST_YEAR=$(tcar_printCopyrightInfo --last-year)
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
            # Define full copyright year string based on first and
Alain Reguera Delgado e54180
            # last year.
Alain Reguera Delgado e54180
            local FULL_YEAR=$(\
Alain Reguera Delgado e54180
                while [[ ${FIRST_YEAR} -le ${LAST_YEAR} ]];do
Alain Reguera Delgado e54180
                    echo -n "${FIRST_YEAR}, "
Alain Reguera Delgado e54180
                    FIRST_YEAR=$((${FIRST_YEAR} + 1))
Alain Reguera Delgado e54180
                done)
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
            # Prepare full copyright year string and print it out. 
Alain Reguera Delgado e54180
            echo "${FULL_YEAR}" | sed 's!, *$!!'
Alain Reguera Delgado e54180
            ;;
Alain Reguera Delgado e54180
    
Alain Reguera Delgado e54180
        --holder )
Alain Reguera Delgado e54180
            
Alain Reguera Delgado e54180
            # Print centos-art.sh script default copyright holder. Be
Alain Reguera Delgado e54180
            # pragmatic about this information, please. The CentOS
Alain Reguera Delgado e54180
            # Project exists to produce The CentOS Distribution, not
Alain Reguera Delgado e54180
            # centos-art.sh script. Nevertheless, The CentOS Artwork
Alain Reguera Delgado e54180
            # SIG is an organizational unit of The CentOS Project
Alain Reguera Delgado e54180
            # which is focused on producing The CentOS Project
Alain Reguera Delgado e54180
            # corporate visual identity, by means of The CentOS
Alain Reguera Delgado e54180
            # Artwork Repository.  The centos-art.sh script automates
Alain Reguera Delgado e54180
            # frequent tasks inside The CentOS Artwork Repository so,
Alain Reguera Delgado e54180
            # based on these considerations, the copyright holder of
Alain Reguera Delgado e54180
            # the centos-art.sh script is "closer" to be The CentOS
Alain Reguera Delgado e54180
            # Artwork SIG than it would be The CentOS Project. These
Alain Reguera Delgado e54180
            # are the logical choosing ideas behind the copyright
Alain Reguera Delgado e54180
            # holder of centos-art.sh script.
Alain Reguera Delgado e54180
            echo "The CentOS Artwork SIG"
Alain Reguera Delgado e54180
            ;;
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
        --holder-predicate )
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
            local HOLDER=$(tcar_printCopyrightInfo --holder)
Alain Reguera Delgado e54180
            echo "${HOLDER}. `gettext "All rights reserved."`"
Alain Reguera Delgado e54180
            ;;
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
        * )
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
            local YEAR=$(tcar_printCopyrightInfo --last-year)
Alain Reguera Delgado e54180
            local HOLDER=$(tcar_printCopyrightInfo --holder)
Alain Reguera Delgado e54180
            echo "Copyright © ${YEAR} ${HOLDER}"
Alain Reguera Delgado e54180
            ;;
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
    esac
Alain Reguera Delgado e54180
Alain Reguera Delgado e54180
}