Annotation of freem/scripts/fmd-changelog, revision 1.2
1.1 snw 1: #!/usr/bin/env bash
2:
3: #
1.2 ! snw 4: # $Id: fmd-changelog,v 1.1 2025/04/04 18:00:01 snw Exp $
1.1 snw 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: #
1.2 ! snw 27: # $Log: fmd-changelog,v $
! 28: # Revision 1.1 2025/04/04 18:00:01 snw
! 29: # *** empty log message ***
! 30: #
1.1 snw 31: #
32: # SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
33: # SPDX-License-Identifier: AGPL-3.0-or-later
34: #
35:
36: MINIMAL=0
37:
38: function usage() {
1.2 ! snw 39: echo
! 40: echo "Prints a FreeM ChangeLog entry"
! 41: echo
! 42: echo "usage:"
! 43: echo
! 44: echo " fmd changelog [--minimal] [<freem-version>]"
! 45: echo
! 46: echo " If the '--minimal' flag is specified, will print only the ChangeLog entries"
! 47: echo " without the version header."
! 48: echo
! 49: echo " If <freem-version> is omitted, fmd changelog will assume you want the ChangeLog"
! 50: echo " for the current version in your copy of the repository."
! 51: echo
1.1 snw 52: exit 1
53: }
54:
1.2 ! snw 55: if [[ $1 == "help" ]]
! 56: then
! 57: usage
! 58: fi
! 59:
1.1 snw 60: if [[ $# == 0 ]]
61: then
62: echo "changelog: must be run from 'fmd changelog'"
63: exit 1
64: fi
65:
66: if [[ ! -f sem.ver ]]
67: then
68: echo "Not in the root of the FreeM repository."
69: exit 1
70: fi
71:
72: if [[ $# < 2 ]]
73: then
74: if [[ $# == 1 ]]
75: then
76: FREEM_VERSION=$(cat sem.ver)
77: else
78: usage
79: fi
80: fi
81:
82: if [[ $# == 2 ]]
83: then
84: if [[ "$2" == "--minimal" ]]
85: then
86: MINIMAL=1
87: FREEM_VERSION=$(cat sem.ver)
88: else
89: FREEM_VERSION=$2
90: fi
91: elif [[ $# == 3 ]]
92: then
93: if [[ "$2" != "--minimal" ]]
94: then
95: usage
96: fi
97: FREEM_VERSION=$3
98: MINIMAL=1
99: fi
100:
101: VERSTR="VERSION ${FREEM_VERSION}"
102:
103: egrep "^${VERSTR}" ChangeLog &> /dev/null
104: RESULT=$?
105:
106: if [[ ${RESULT} != 0 ]]
107: then
108: echo "setversion: version ${FREEM_VERSION} not found in ChangeLog"
109: exit 1
110: fi
111:
112: DIVIDER='********************************************************************************'
113: INVER=0
114:
115:
116: while read -r LINE
117: do
118: if [[ "${LINE}" == "${VERSTR}" ]]
119: then
120: if [[ ${MINIMAL} == 0 ]]
121: then
122: echo "${LINE}"
123: fi
124: INVER=1
125: else
126: if [[ ${INVER} == 1 ]]
127: then
128: if [[ "${LINE:0:2}" == '**' ]]
129: then
130: exit 0
131: fi
132: if [[ ${MINIMAL} == 0 ]]
133: then
134: echo " ${LINE}"
135: else
136: if [[ "${LINE:0:1}" == '*' ]]
137: then
138: echo " ${LINE}"
139: fi
140: fi
141: fi
142: fi
143:
144: done < ChangeLog
145:
146:
147:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>