1: #!/usr/bin/env bash
2:
3: #
4: # $Id: mk-debian-package,v 1.6 2025/04/04 02:50:44 snw Exp $
5: # Creates a Debian package for a specific FreeM version
6: #
7: #
8: # Author: Serena Willis <snw@coherent-logic.com>
9: # Copyright (C) 1998 MUG Deutschland
10: # Copyright (C) 2025 Coherent Logic Development LLC
11: #
12: #
13: # This file is part of FreeM.
14: #
15: # FreeM is free software: you can redistribute it and/or modify
16: # it under the terms of the GNU Affero Public License as published by
17: # the Free Software Foundation, either version 3 of the License, or
18: # (at your option) any later version.
19: #
20: # FreeM is distributed in the hope that it will be useful,
21: # but WITHOUT ANY WARRANTY; without even the implied warranty of
22: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23: # GNU Affero Public License for more details.
24: #
25: # You should have received a copy of the GNU Affero Public License
26: # along with FreeM. If not, see <https://www.gnu.org/licenses/>.
27: #
28: # $Log: mk-debian-package,v $
29: # Revision 1.6 2025/04/04 02:50:44 snw
30: # Prepare build scripts for 0.63.0
31: #
32: # Revision 1.5 2025/04/03 03:52:38 snw
33: # Prepare Debian packaging infra for 0.63 series
34: #
35: # Revision 1.4 2025/03/14 00:58:44 snw
36: # Remove dbgsym package from upload
37: #
38: # Revision 1.3 2025/03/14 00:28:10 snw
39: # Support Debian-specific version number
40: #
41: # Revision 1.2 2025/03/14 00:13:41 snw
42: # Add copyright file
43: #
44: # Revision 1.1.1.1 2025/03/13 23:42:41 snw
45: # Initial commit
46: #
47: #
48: # SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
49: # SPDX-License-Identifier: AGPL-3.0-or-later
50: #
51:
52: PGM=$(basename $0)
53:
54: function usage() {
55: echo "usage: ${PGM} <freem-version> <package-version> <ssh-server>"
56: exit 1
57: }
58:
59: if [[ $# != 3 ]]
60: then
61: usage
62: fi
63:
64: FREEM_VERSION=$1
65: FREEM_VERSION_MOD=$(echo "${FREEM_VERSION}" | sed 's/-/./g')
66: FDPKG_VERSION=$2
67: FDSSH=$3
68:
69: SRCDIR=$(pwd)
70: TMPDIR=$(mktemp -d)
71: INFILE="freem-${FREEM_VERSION}.tar.gz"
72: OUTFILE="${TMPDIR}/freem_${FREEM_VERSION_MOD}.orig.tar.gz"
73: TARDIR="${TMPDIR}/freem-${FREEM_VERSION_MOD}"
74:
75: URL="https://freem.coherent-logic.com/downloads/freem-${FREEM_VERSION}.tar.gz"
76: echo -n "${PGM}: downloading ${URL} to ${OUTFILE}..."
77: curl -s "${URL}" > "${OUTFILE}"
78: if [[ $? == 0 ]]
79: then
80: echo "[OK]"
81: else
82: echo "[FAIL]"
83: exit 1
84: fi
85:
86: echo -n "${PGM}: extracting ${OUTFILE} to ${TARDIR}..."
87: tar zxf "${OUTFILE}" -C "${TMPDIR}"
88: if [[ "${FREEM_VERSION}" != "${FREEM_VERSION_MOD}" ]]
89: then
90: mv "${TMPDIR}/freem-${FREEM_VERSION}" "${TMPDIR}/freem-${FREEM_VERSION_MOD}"
91: fi
92: if [[ $? == 0 ]]
93: then
94: echo "[OK]"
95: else
96: echo "[FAIL]"
97: exit 1
98: fi
99:
100: echo -n "${PGM}: copying Debian packaging control info to ${TARDIR}..."
101: cp -r debian "${TARDIR}/"
102: if [[ $? == 0 ]]
103: then
104: echo "[OK]"
105: else
106: echo "[FAIL]"
107: exit 1
108: fi
109:
110: sed -i "s/FREEM_VERSION/${FREEM_VERSION_MOD}-${FDPKG_VERSION}/g" "${TARDIR}/debian/changelog"
111: sed -i "s/FREEM_VERSION/${FREEM_VERSION}-${FDPKG_VERSION}/g" "${TARDIR}/debian/control"
112:
113: echo "${PGM}: building the package..."
114: cd "${TARDIR}"
115: export DEB_BUILD_MAINT_OPTIONS=hardening=-fortify,-format,-stackprotector,-stackprotectorstrong
116: debuild -us -uc
117:
118: echo "${PGM}: the package is in ${TMPDIR}"
119:
120: rm -f ${TMPDIR}/*dbgsym*
121: scp ${TMPDIR}/*.deb "${FDSSH}://var/www/freem.coherent-logic.com/downloads/binaries/debian/"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>