Blame Scripts/Functions/cli_printCopyrightInfo.sh

1971b4
#!/bin/bash
1971b4
#
bb4664
# cli_printCopyrightInfo.sh -- This function standardizes the
bb4664
# copyright information used by centos-art.sh script.
83fca7
#
bb4664
# As far as I understand, the copyright exists to make people create
bb4664
# more.  The copyright gives creators the legal power over their
bb4664
# creations and so the freedom to distribute them under the ethical
bb4664
# terms the creator considers better.  At this moment I don't feel
bb4664
# very confident about this legal affairs and their legal
bb4664
# implications, but I need to decide what copyright information the
bb4664
# centos-art.sh script will print out. So, in that sake, I'll assume
bb4664
# the same copyright information used by The CentOS Wiki
bb4664
# (http://wiki.centos.org/) as reference.
93aaae
#
2fe9b7
# 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
66c82d
    case "$1" in
66c82d
66c82d
        --license )
66c82d
66c82d
            # Print out the name of the license used by to release the
66c82d
            # content produced by centos-art.sh script, inside CentOS
66c82d
            # Artwork Repository.
66c82d
            echo "`gettext "Creative Common Attribution-ShareAlike 3.0 License"`"
66c82d
            ;;
66c82d
66c82d
        --license-url )
66c82d
66c82d
            # Print out the url of the license used by to release the
66c82d
            # content produced by centos-art.sh script, inside CentOS
66c82d
            # Artwork Repository.
66c82d
            cli_printUrl --cc-sharealike
66c82d
            ;;
66c82d
66c82d
        --copyright-year-first )
66c82d
66c82d
            # The former year when I (as part of The CentOS Project)
66c82d
            # started to consolidate The CentOS Project Corporate
66c82d
            # Visual Identity through the CentOS Artwork Repository.
66c82d
            echo '2009'
66c82d
            ;;
66c82d
66c82d
        --copyright-year|--copyright-year-last )
66c82d
66c82d
            # The last year when The CentOS Project stopped working in
66c82d
            # its Corporate Visual Identity through the CentOS Artwork
66c82d
            # Repository. That is something that I hope does never
66c82d
            # happen, so assume the current year as last working year.
66c82d
            date +%Y
66c82d
            ;;
66c82d
66c82d
        --copyright-year-range )
66c82d
66c82d
            local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first')
66c82d
            local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last')
66c82d
            echo "${FIRST_YEAR}-${LAST_YEAR}"
66c82d
            ;;
66c82d
66c82d
        --copyright-year-list )
66c82d
66c82d
            local FIRST_YEAR=$(cli_printCopyrightInfo '--copyright-year-first')
66c82d
            local LAST_YEAR=$(cli_printCopyrightInfo '--copyright-year-last')
66c82d
66c82d
            # Define full copyright year string based on first and
66c82d
            # last year.
66c82d
            local FULL_YEAR=$(\
66c82d
                while [[ ${FIRST_YEAR} -le ${LAST_YEAR} ]];do
66c82d
                    echo -n "${FIRST_YEAR}, "
66c82d
                    FIRST_YEAR=$(($FIRST_YEAR + 1))
66c82d
                done)
66c82d
66c82d
            # Prepare full copyright year string and print it out. 
66c82d
            echo "${FULL_YEAR}" | sed 's!, *$!!'
66c82d
            ;;
1d5701
    
66c82d
        --copyright-holder )
1d5701
            
66c82d
            # Output default copyright holder.
66c82d
            echo "`gettext "The CentOS Project"`"
66c82d
            ;;
66c82d
66c82d
        --copyright-holder-predicate )
66c82d
66c82d
            local HOLDER=$(cli_printCopyrightInfo '--copyright-holder')
66c82d
            echo "${HOLDER}. `gettext "All rights reserved."`"
66c82d
            ;;
66c82d
66c82d
        --copyright )
66c82d
66c82d
            local YEAR=$(cli_printCopyrightInfo '--copyright-year-last')
66c82d
            local HOLDER=$(cli_printCopyrightInfo '--copyright-holder')
66c82d
            echo "Copyright © ${YEAR} ${HOLDER}"
66c82d
            ;;
66c82d
66c82d
    esac
1971b4
1971b4
}