Annotation of freem/scripts/fmd-changelog, revision 1.1

1.1     ! snw         1: #!/usr/bin/env bash
        !             2: 
        !             3: #
        !             4: #   $Id$
        !             5: #    Gets the changelog for a specific version
        !             6: #
        !             7: #  
        !             8: #   Author: Serena Willis <snw@coherent-logic.com>
        !             9: #    Copyright (C) 2025 Coherent Logic Development LLC
        !            10: #
        !            11: #
        !            12: #   This file is part of FreeM.
        !            13: #
        !            14: #   FreeM is free software: you can redistribute it and/or modify
        !            15: #   it under the terms of the GNU Affero Public License as published by
        !            16: #   the Free Software Foundation, either version 3 of the License, or
        !            17: #   (at your option) any later version.
        !            18: #
        !            19: #   FreeM is distributed in the hope that it will be useful,
        !            20: #   but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            21: #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            22: #   GNU Affero Public License for more details.
        !            23: #
        !            24: #   You should have received a copy of the GNU Affero Public License
        !            25: #   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
        !            26: #
        !            27: #   $Log$
        !            28: #
        !            29: # SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
        !            30: # SPDX-License-Identifier: AGPL-3.0-or-later
        !            31: #
        !            32: 
        !            33: MINIMAL=0
        !            34: 
        !            35: function usage() {
        !            36:     echo "usage:  fmd changelog [--minimal] <freem-version>"
        !            37:     exit 1
        !            38: }
        !            39: 
        !            40: if [[ $# == 0 ]]
        !            41: then
        !            42:     echo "changelog:  must be run from 'fmd changelog'"
        !            43:     exit 1
        !            44: fi
        !            45: 
        !            46: if [[ ! -f sem.ver ]]
        !            47: then
        !            48:     echo "Not in the root of the FreeM repository."
        !            49:     exit 1
        !            50: fi
        !            51: 
        !            52: if [[ $# < 2 ]]
        !            53: then
        !            54:     if [[ $# == 1 ]]
        !            55:     then
        !            56:         FREEM_VERSION=$(cat sem.ver)
        !            57:     else
        !            58:         usage
        !            59:     fi
        !            60: fi
        !            61: 
        !            62: if [[ $# == 2 ]]
        !            63: then
        !            64:     if [[ "$2" == "--minimal" ]]
        !            65:     then
        !            66:         MINIMAL=1
        !            67:         FREEM_VERSION=$(cat sem.ver)
        !            68:     else
        !            69:         FREEM_VERSION=$2
        !            70:     fi
        !            71: elif [[ $# == 3 ]]
        !            72: then
        !            73:     if [[ "$2" != "--minimal" ]]
        !            74:     then
        !            75:         usage
        !            76:     fi
        !            77:     FREEM_VERSION=$3
        !            78:     MINIMAL=1
        !            79: fi
        !            80: 
        !            81: VERSTR="VERSION ${FREEM_VERSION}"
        !            82: 
        !            83: egrep "^${VERSTR}" ChangeLog &> /dev/null
        !            84: RESULT=$?
        !            85: 
        !            86: if [[ ${RESULT} != 0 ]]
        !            87: then
        !            88:     echo "setversion:  version ${FREEM_VERSION} not found in ChangeLog"
        !            89:     exit 1
        !            90: fi
        !            91: 
        !            92: DIVIDER='********************************************************************************'
        !            93: INVER=0
        !            94: 
        !            95: 
        !            96: while read -r LINE
        !            97: do    
        !            98:     if [[ "${LINE}" == "${VERSTR}" ]]
        !            99:     then
        !           100:         if [[ ${MINIMAL} == 0 ]]
        !           101:         then
        !           102:             echo "${LINE}"
        !           103:         fi
        !           104:         INVER=1
        !           105:     else
        !           106:         if [[ ${INVER} == 1 ]]
        !           107:         then
        !           108:             if [[ "${LINE:0:2}" == '**' ]]
        !           109:             then
        !           110:                 exit 0
        !           111:             fi
        !           112:             if [[ ${MINIMAL} == 0 ]]
        !           113:             then
        !           114:                 echo "  ${LINE}"
        !           115:             else
        !           116:                 if [[ "${LINE:0:1}" == '*' ]]
        !           117:                 then
        !           118:                     echo "  ${LINE}"
        !           119:                 fi
        !           120:             fi
        !           121:         fi        
        !           122:     fi
        !           123: 
        !           124: done < ChangeLog
        !           125: 
        !           126: 
        !           127: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>