Blame tcar-scripts/tcar_printCopyrightInfo.sh

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