1: #!/usr/bin/env bash
2:
3: #
4: # $Id: fmd-setversion,v 1.4 2025/05/02 16:25:46 snw Exp $
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: fmd-setversion,v $
28: # Revision 1.4 2025/05/02 16:25:46 snw
29: # -m
30: #
31: # Revision 1.3 2025/04/06 03:38:05 snw
32: # Prepare for adding packaging functionality to fmd
33: #
34: # Revision 1.2 2025/04/04 19:43:18 snw
35: # Switch to using environment catalog to determine user and group for environment, and remove -u and -g flags from freem
36: #
37: # Revision 1.1 2025/04/04 18:00:01 snw
38: # *** empty log message ***
39: #
40: #
41: # SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
42: # SPDX-License-Identifier: AGPL-3.0-or-later
43: #
44:
45: function usage()
46: {
47: echo
48: echo "Sets the FreeM version in this repository"
49: echo
50: echo "usage:"
51: echo
52: echo " fmd setversion <version>"
53: echo " - Sets the FreeM version in this repository to <version>"
54: echo
55: echo " fmd setversion --revert"
56: echo " - Reverts to the previous FreeM version"
57: echo
58: exit 0
59: }
60:
61: if [[ $1 == "help" ]]
62: then
63: usage
64: fi
65:
66: if [[ $# == 0 ]]
67: then
68: echo "setversion: must be run from 'fmd setversion'"
69: exit 1
70: fi
71:
72: CURVER=$(cat sem.ver)
73: OLDVER=$(cat ver.old)
74: FMD=$1
75: NEWVER=$2
76:
77: if [[ $# == 1 ]]
78: then
79: echo "setversion: assuming new version is \"cvs-current\""
80: NEWVER="cvs-current"
81: fi
82:
83: if [[ "${NEWVER}" == "--revert" ]]
84: then
85: NEWVER="${OLDVER}"
86: echo "setversion: reverting to previous version ${NEWVER}"
87: fi
88:
89: if [[ "${CURVER}" == "${NEWVER}" ]]
90: then
91: echo "setversion: no change"
92: exit 1
93: fi
94:
95: echo "setversion: version change ${CURVER} => ${NEWVER}"
96: echo "setversion: backing up old version"
97: cp sem.ver ver.old
98:
99: echo "${NEWVER}" > sem.ver
100:
101: sed -i.orig "s/${CURVER}/${NEWVER}/g" doc/freem.texi
102: sed -i.orig "s/${CURVER}/${NEWVER}/g" configure.ac
103: sed -i.orig "s/${CURVER}/${NEWVER}/g" doc/freem_conformance.1
104:
105: VERSTR="VERSION ${NEWVER}"
106:
107: echo "" >> ChangeLog
108: echo '********************************************************************************' >> ChangeLog
109: echo "${VERSTR}" >> ChangeLog
110: echo "" >> ChangeLog
111:
112: ${FMD} log "Change version from ${CURVER} to ${NEWVER}"
113:
114: ${FMD} changelog ${NEWVER}
115:
116:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>