Blame Automation/Scripts/tcar_printCopyrightInfo.sh

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