Blame Scripts/Bash/Functions/Commons/cli_printCopyrightInfo.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# cli_printCopyrightInfo.sh -- This function standardizes the
851d57
# copyright information printed on content produced by centos-art.sh
851d57
# script.
878a2b
#
878a2b
# As far as I understand, the copyright exists to make people create
878a2b
# more.  The copyright gives creators the legal power over their
878a2b
# creations and so the freedom to distribute them under the ethical
878a2b
# terms the creator considers better.  At this moment I don't feel
878a2b
# very confident about this legal affairs and their legal
878a2b
# implications, but I need to decide what copyright information the
42321e
# centos-art.sh script will print out when it be requested about it.
42321e
# So, in that sake, I'll assume the same copyright information used by
42321e
# The CentOS Wiki (http://wiki.centos.org/) as reference.
878a2b
#
e6bbbf
# Copyright (C) 2009-2013 The CentOS Project
878a2b
#
878a2b
# This program is free software; you can redistribute it and/or modify
878a2b
# it under the terms of the GNU General Public License as published by
878a2b
# the Free Software Foundation; either version 2 of the License, or (at
878a2b
# your option) any later version.
878a2b
#
878a2b
# This program is distributed in the hope that it will be useful, but
878a2b
# WITHOUT ANY WARRANTY; without even the implied warranty of
878a2b
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
878a2b
# General Public License for more details.
878a2b
#
878a2b
# You should have received a copy of the GNU General Public License
878a2b
# along with this program; if not, write to the Free Software
878a2b
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
878a2b
#
878a2b
# ----------------------------------------------------------------------
878a2b
# $Id$
878a2b
# ----------------------------------------------------------------------
878a2b
878a2b
function cli_printCopyrightInfo {
878a2b
878a2b
    case "$1" in
878a2b
878a2b
        --license )
878a2b
d4e874
            # Print the license name. 
878a2b
            echo "`gettext "Creative Common Attribution-ShareAlike 3.0 License"`"
878a2b
            ;;
878a2b
878a2b
        --license-url )
878a2b
d4e874
            # Print the url related to license name.
878a2b
            cli_printUrl --cc-sharealike
878a2b
            ;;
878a2b
d4e874
        --first-year )
878a2b
42321e
            # The former year when I (as collaborator of The CentOS
42321e
            # Project) started to consolidate The CentOS Project
42321e
            # Corporate Visual Identity through the CentOS Artwork
42321e
            # Repository.
d4e874
            echo '2009'
878a2b
            ;;
878a2b
d4e874
        --year|--last-year)
878a2b
878a2b
            # The last year when The CentOS Project stopped working in
878a2b
            # its Corporate Visual Identity through the CentOS Artwork
d4e874
            # Repository. That is something that I hope never happens,
d4e874
            # so assume the current year as last working year.
878a2b
            date +%Y
878a2b
            ;;
878a2b
d4e874
        --years-range )
878a2b
d4e874
            local FIRST_YEAR=$(cli_printCopyrightInfo --first-year)
d4e874
            local LAST_YEAR=$(cli_printCopyrightInfo --last-year)
878a2b
            echo "${FIRST_YEAR}-${LAST_YEAR}"
878a2b
            ;;
878a2b
d4e874
        --years-list )
878a2b
d4e874
            local FIRST_YEAR=$(cli_printCopyrightInfo --first-year)
d4e874
            local LAST_YEAR=$(cli_printCopyrightInfo --last-year)
878a2b
878a2b
            # Define full copyright year string based on first and
878a2b
            # last year.
878a2b
            local FULL_YEAR=$(\
878a2b
                while [[ ${FIRST_YEAR} -le ${LAST_YEAR} ]];do
878a2b
                    echo -n "${FIRST_YEAR}, "
878a2b
                    FIRST_YEAR=$(($FIRST_YEAR + 1))
878a2b
                done)
878a2b
878a2b
            # Prepare full copyright year string and print it out. 
878a2b
            echo "${FULL_YEAR}" | sed 's!, *$!!'
878a2b
            ;;
878a2b
    
d4e874
        --holder )
878a2b
            
d4e874
            # Print centos-art.sh script default copyright holder.
d4e874
            echo "The CentOS Project"
878a2b
            ;;
878a2b
d4e874
        --holder-predicate )
878a2b
d4e874
            local HOLDER=$(cli_printCopyrightInfo --holder)
878a2b
            echo "${HOLDER}. `gettext "All rights reserved."`"
878a2b
            ;;
878a2b
d4e874
        * )
878a2b
d4e874
            local YEAR=$(cli_printCopyrightInfo --last-year)
d4e874
            local HOLDER=$(cli_printCopyrightInfo --holder)
878a2b
            echo "Copyright © ${YEAR} ${HOLDER}"
878a2b
            ;;
878a2b
878a2b
    esac
878a2b
878a2b
}