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

1.1     ! snw         1: #!/usr/bin/env bash
        !             2: 
        !             3: #
        !             4: #   $Id$
        !             5: #    Set version in FreeM repository
        !             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: if [[ $# == 0 ]]
        !            34: then
        !            35:     echo "setversion:  must be run from 'fmd setversion'"
        !            36:     exit 1
        !            37: fi
        !            38: 
        !            39: if [[ ! -f sem.ver ]]
        !            40: then
        !            41:     echo "Not in the root of the FreeM repository."
        !            42:     exit 1
        !            43: fi
        !            44: 
        !            45: CURVER=$(cat sem.ver)
        !            46: OLDVER=$(cat ver.old)
        !            47: FMD=$1
        !            48: NEWVER=$2
        !            49: 
        !            50: if [[ $# == 1 ]]
        !            51: then
        !            52:     echo "setversion:  assuming new version is \"cvs-current\""
        !            53:     NEWVER="cvs-current"
        !            54: fi
        !            55: 
        !            56: if [[ "${NEWVER}" == "--revert" ]]
        !            57: then
        !            58:     NEWVER="${OLDVER}"
        !            59:     echo "setversion:  reverting to previous version ${NEWVER}"
        !            60: fi
        !            61: 
        !            62: if [[ "${CURVER}" == "${NEWVER}" ]]
        !            63: then
        !            64:     echo "setversion:  no change"
        !            65:     exit 1
        !            66: fi
        !            67: 
        !            68: echo "setversion:  version change ${CURVER} => ${NEWVER}"
        !            69: echo "setversion:  backing up old version"
        !            70: cp sem.ver ver.old
        !            71: 
        !            72: echo "${NEWVER}" > sem.ver
        !            73: 
        !            74: sed -i.orig "s/${CURVER}/${NEWVER}/g" doc/freem.texi
        !            75: sed -i.orig "s/${CURVER}/${NEWVER}/g" configure.ac
        !            76: 
        !            77: VERSTR="VERSION ${NEWVER}"
        !            78: 
        !            79: echo "" >> ChangeLog
        !            80: echo '********************************************************************************' >> ChangeLog
        !            81: echo "${VERSTR}" >> ChangeLog
        !            82: echo "" >> ChangeLog
        !            83: 
        !            84: ${FMD} log "Changed version from ${CURVER} to ${NEWVER}"
        !            85: 
        !            86: ${FMD} changelog ${NEWVER}
        !            87: 
        !            88: 

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