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

878a2b
#!/bin/bash
878a2b
#
878a2b
# cli_printCopyrightInfo.sh -- This function standardizes the
878a2b
# copyright information used by centos-art.sh 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
878a2b
            # Print out the name of the license used by to release the
878a2b
            # content produced by centos-art.sh script, inside CentOS
878a2b
            # Artwork Repository.
878a2b
            echo "`gettext "Creative Common Attribution-ShareAlike 3.0 License"`"
878a2b
            ;;
878a2b
878a2b
        --license-url )
878a2b
878a2b
            # Print out the url of the license used by to release the
878a2b
            # content produced by centos-art.sh script, inside CentOS
878a2b
            # Artwork Repository.
878a2b
            cli_printUrl --cc-sharealike
878a2b
            ;;
878a2b
878a2b
        --copyright-year-first )
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.
268c0a
            echo "${COPYRIGHT_YEAR_FIRST}"
878a2b
            ;;
878a2b
878a2b
        --copyright-year|--copyright-year-last )
878a2b
878a2b
            # The last year when The CentOS Project stopped working in
878a2b
            # its Corporate Visual Identity through the CentOS Artwork
878a2b
            # Repository. That is something that I hope does never
878a2b
            # happen, so assume the current year as last working year.
878a2b
            date +%Y
878a2b
            ;;
878a2b
878a2b
        --copyright-year-range )
878a2b
878a2b
            local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first')
878a2b
            local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last')
878a2b
            echo "${FIRST_YEAR}-${LAST_YEAR}"
878a2b
            ;;
878a2b
878a2b
        --copyright-year-list )
878a2b
878a2b
            local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first')
878a2b
            local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last')
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
    
878a2b
        --copyright-holder )
878a2b
            
878a2b
            # Output default copyright holder.
268c0a
            echo ${COPYRIGHT_HOLDER}
878a2b
            ;;
878a2b
878a2b
        --copyright-holder-predicate )
878a2b
878a2b
            local HOLDER=$(cli_printCopyrightInfo '--copyright-holder')
878a2b
            echo "${HOLDER}. `gettext "All rights reserved."`"
878a2b
            ;;
878a2b
878a2b
        --copyright )
878a2b
878a2b
            local YEAR=$(cli_printCopyrightInfo '--copyright-year-last')
878a2b
            local HOLDER=$(cli_printCopyrightInfo '--copyright-holder')
878a2b
            echo "Copyright © ${YEAR} ${HOLDER}"
878a2b
            ;;
878a2b
878a2b
    esac
878a2b
878a2b
}