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
878a2b
# centos-art.sh script will print out. So, in that sake, I'll assume
878a2b
# the same copyright information used by The CentOS Wiki
878a2b
# (http://wiki.centos.org/) as reference.
878a2b
#
03486a
# Copyright (C) 2009, 2010, 2011, 2012 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
878a2b
            # The former year when I (as part of The CentOS Project)
878a2b
            # started to consolidate The CentOS Project Corporate
878a2b
            # Visual Identity through the CentOS Artwork 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
}