#!/usr/bin/env bash # # $Id: fmd-changelog,v 1.3 2025/04/07 00:45:52 snw Exp $ # Gets the changelog for a specific version # # # Author: Serena Willis # Copyright (C) 2025 Coherent Logic Development LLC # # # This file is part of FreeM. # # FreeM is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # FreeM is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero Public License for more details. # # You should have received a copy of the GNU Affero Public License # along with FreeM. If not, see . # # $Log: fmd-changelog,v $ # Revision 1.3 2025/04/07 00:45:52 snw # Enhance fmd-pkg-dpkg to auto-generate the debian/changelog file from the FreeM ChangeLog # # Revision 1.2 2025/04/06 03:38:05 snw # Prepare for adding packaging functionality to fmd # # Revision 1.1 2025/04/04 18:00:01 snw # *** empty log message *** # # # SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC # SPDX-License-Identifier: AGPL-3.0-or-later # MINIMAL=0 function usage() { echo echo "Prints a FreeM ChangeLog entry" echo echo "usage:" echo echo " fmd changelog [--minimal] []" echo echo " If the '--minimal' flag is specified, will print only the ChangeLog entries" echo " without the version header." echo echo " If is omitted, fmd changelog will assume you want the ChangeLog" echo " for the current version in your copy of the repository." echo exit 1 } if [[ $1 == "help" ]] then usage fi if [[ $# == 0 ]] then echo "changelog: must be run from 'fmd changelog'" exit 1 fi if [[ ! -f sem.ver ]] then echo "Not in the root of the FreeM repository." exit 1 fi if [[ $# < 2 ]] then if [[ $# == 1 ]] then FREEM_VERSION=$(cat sem.ver) else usage fi fi if [[ $# == 2 ]] then if [[ "$2" == "--minimal" ]] then MINIMAL=1 FREEM_VERSION=$(cat sem.ver) else FREEM_VERSION=$2 fi elif [[ $# == 3 ]] then if [[ "$2" != "--minimal" ]] then usage fi FREEM_VERSION=$3 MINIMAL=1 fi VERSTR="VERSION ${FREEM_VERSION}" egrep "^${VERSTR}" ChangeLog &> /dev/null RESULT=$? if [[ ${RESULT} != 0 ]] then echo "setversion: version ${FREEM_VERSION} not found in ChangeLog" exit 1 fi DIVIDER='********************************************************************************' INVER=0 while read -r LINE do if [[ "${LINE}" == "${VERSTR}" ]] then if [[ ${MINIMAL} == 0 ]] then echo "${LINE}" fi INVER=1 else if [[ ${INVER} == 1 ]] then if [[ "${LINE:0:2}" == '**' ]] then exit 0 fi if [[ ${MINIMAL} == 0 ]] then echo " ${LINE}" else if [[ "${LINE:0:1}" == '*' ]] then OLINE=$(echo "${LINE}" | cut -d\* -f2) echo "${OLINE:1}" fi fi fi fi done < ChangeLog