Blame Scripts/Functions/cli_printCopyrightInfo.sh

1971b4
#!/bin/bash
1971b4
#
380069
# cli_printCopyrightInfo.sh -- This function outputs the copyright
83fca7
# information of content produced by the centos-art command-line
83fca7
# interface.
83fca7
#
83fca7
# As I understand, the copyright exists to make people create more.
83fca7
# The copyright gives creators the legal power over their creations
83fca7
# and so the freedom to distribute them under the ethical terms the
83fca7
# creator considers better. 
83fca7
#
83fca7
# At this moment I don't feel very sure about this legal affairs, but
83fca7
# need to decide what copyright information the centos-art will
83fca7
# output. So, I'm taking the wiki (wiki.centos.org) copyright
83fca7
# information as reference.
93aaae
#
2d3646
# Copyright (C) 2009, 2010, 2011 The CentOS Project
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# WITHOUT ANY WARRANTY; without even the implied warranty of
1971b4
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1971b4
# General Public License for more details.
1971b4
#
1971b4
# You should have received a copy of the GNU General Public License
1971b4
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
1971b4
# ----------------------------------------------------------------------
1971b4
# $Id$
1971b4
# ----------------------------------------------------------------------
1971b4
380069
function cli_printCopyrightInfo {
1971b4
93aaae
    case "$1" in
93aaae
93aaae
        '--license' )
93aaae
1d5701
            # Output default license name used by all image-based
1d5701
            # creations inside CentOS Artwork Repository.
1d5701
            echo "Creative Common Attribution-ShareAlike 3.0"
93aaae
            ;;
1d5701
f1f97d
        '--license-url' )
f1f97d
1d5701
            # Ouput default license url used by all image-based
5ac881
            # creations inside the CentOS Artwork Repository.
b89c83
            cli_printUrl --cc-sharealike
5ac881
            ;;
5ac881
5ac881
        '--copyright-year-first' )
5ac881
5ac881
            # The former year when I (as part of The CentOS Project)
5ac881
            # started to consolidate The CentOS Project Corporate
5ac881
            # Visual Identity through the CentOS Artwork Repository.
5ac881
            echo '2009'
f1f97d
            ;;
1971b4
c436b3
        '--copyright-year' | '--copyright-year-last' )
1d5701
5ac881
            # The last year when The CentOS Project stopped working in
5ac881
            # its Corporate Visual Identity through the CentOS Artwork
5ac881
            # Repository. That is something that I hope does never
5ac881
            # happen, so assume the current year as last working year.
aaed27
            date +%Y
1d5701
            ;;
c436b3
5ac881
        '--copyright-year-range' )
c436b3
380069
            local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first')
380069
            local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last')
5ac881
            echo "${FIRST_YEAR}-${LAST_YEAR}"
5ac881
            ;;
c436b3
5ac881
        '--copyright-year-list' )
5ac881
380069
            local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first')
380069
            local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last')
c436b3
c436b3
            # Define full copyright year string based on first and
c436b3
            # last year.
c436b3
            local FULL_YEAR=$(\
c436b3
                while [[ ${FIRST_YEAR} -le ${LAST_YEAR} ]];do
c436b3
                    echo -n "${FIRST_YEAR}, "
c436b3
                    FIRST_YEAR=$(($FIRST_YEAR + 1))
c436b3
                done)
c436b3
c436b3
            # Prepare full copyright year string and print it out. 
c436b3
            echo "${FULL_YEAR}" | sed 's!, *$!!'
c436b3
            ;;
1d5701
    
17dbe5
        '--copyright-holder' )
1d5701
            
1d5701
            # Output default copyright holder.
aaed27
            echo "The CentOS Project"
1d5701
            ;;
1d5701
17dbe5
        '--copyright' | * )
380069
            local YEAR=$(cli_printCopyrightInfo '--copyright-year')
380069
            local HOLDER=$(cli_printCopyrightInfo '--copyright-holder')
17dbe5
            echo "Copyright © $YEAR $HOLDER"
17dbe5
            ;;
17dbe5
1d5701
    esac
1971b4
1971b4
}