Annotation of freem/scripts/fmd-pkg-dpkg, revision 1.1

1.1     ! snw         1: #!/usr/bin/env bash
        !             2: 
        !             3: #
        !             4: #   $Id$
        !             5: #    Creates a Debian package for a specific FreeM 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: #
        !            27: #   $Log$
        !            28: #
        !            29: # SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
        !            30: # SPDX-License-Identifier: AGPL-3.0-or-later
        !            31: #
        !            32: 
        !            33: PGM=$(basename $0)
        !            34: SCRIPT_DIR=$(dirname "$0")
        !            35: 
        !            36: if [[ $# != 2 ]]
        !            37: then
        !            38:     echo "fmd-pkg-dpkg:  must run from fmd package"
        !            39:     exit 1
        !            40: fi
        !            41: 
        !            42: FMD=$1
        !            43: 
        !            44: FREEM_VERSION="${_fmd_freem_version}"
        !            45: FREEM_VERSION_MOD=$(echo "${FREEM_VERSION}" | sed 's/-/./g')
        !            46: FDPKG_VERSION=$2
        !            47: 
        !            48: TMPDIR="/tmp/fmd-pkg-dpkg"
        !            49: rm -rf "${TMPDIR}"
        !            50: 
        !            51: INFILE="freem-${FREEM_VERSION}.tar.gz"
        !            52: OUTFILE="${TMPDIR}/freem_${FREEM_VERSION_MOD}.orig.tar.gz"
        !            53: TARDIR="${TMPDIR}/freem-${FREEM_VERSION_MOD}"
        !            54: 
        !            55: 
        !            56: echo -n "${PGM}:  extracting ${OUTFILE} to ${TARDIR}..."
        !            57: tar zxf "${OUTFILE}" -C "${TMPDIR}"
        !            58: if [[ "${FREEM_VERSION}" != "${FREEM_VERSION_MOD}" ]]
        !            59: then
        !            60:     mv "${TMPDIR}/freem-${FREEM_VERSION}" "${TMPDIR}/freem-${FREEM_VERSION_MOD}"
        !            61: fi
        !            62: if [[ $? == 0 ]]
        !            63: then
        !            64:     echo "[OK]"
        !            65: else
        !            66:     echo "[FAIL]"
        !            67:     exit 1
        !            68: fi
        !            69: 
        !            70: echo -n "${PGM}:  copying Debian packaging control info to ${TARDIR}..."
        !            71: cp -r debian "${TARDIR}/"
        !            72: if [[ $? == 0 ]]
        !            73: then
        !            74:     echo "[OK]"
        !            75: else
        !            76:     echo "[FAIL]"
        !            77:     exit 1
        !            78: fi
        !            79: 
        !            80: sed -i "s/FREEM_VERSION/${FREEM_VERSION_MOD}-${FDPKG_VERSION}/g" "${TARDIR}/debian/changelog"
        !            81: sed -i "s/FREEM_VERSION/${FREEM_VERSION}-${FDPKG_VERSION}/g" "${TARDIR}/debian/control"
        !            82: 
        !            83: echo "${PGM}:  building the package..."
        !            84: cd "${TARDIR}"
        !            85: export DEB_BUILD_MAINT_OPTIONS=hardening=-fortify,-format,-stackprotector,-stackprotectorstrong
        !            86: debuild -us -uc
        !            87: 
        !            88: echo "${PGM}:  the package is in ${TMPDIR}"
        !            89: 
        !            90: rm -f ${TMPDIR}/*dbgsym*
        !            91: scp ${TMPDIR}/*.deb "${FDSSH}://var/www/freem.coherent-logic.com/downloads/binaries/debian/" 

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