Annotation of freem/scripts/fmd-pkg-rpm, revision 1.2

1.1       snw         1: #!/usr/bin/env bash
                      2: 
                      3: #
1.2     ! snw         4: #   $Id: fmd-pkg-rpm,v 1.1 2025/04/07 05:19:36 snw Exp $
1.1       snw         5: #    Creates an rpm package
                      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: #
1.2     ! snw        27: #   $Log: fmd-pkg-rpm,v $
        !            28: #   Revision 1.1  2025/04/07 05:19:36  snw
        !            29: #   Initial work on moving rpm packaging to fmd
        !            30: #
1.1       snw        31: #
                     32: # SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
                     33: # SPDX-License-Identifier: AGPL-3.0-or-later
                     34: #
                     35: 
                     36: PGM=$(basename $0)
                     37: SCRIPT_DIR=$(dirname "$0")
                     38: 
                     39: source "${SCRIPT_DIR}/_fmd_common.bash"
                     40: 
                     41: if [[ $# != 1 ]]
                     42: then
                     43:     echo "${PGM}:  must run from fmd package"
                     44:     exit 1
                     45: fi
                     46: 
                     47: TMPDIR="/tmp/fmd-pkg-rpm"
                     48: rm -rf "${TMPDIR}"
                     49: mkdir -p "${TMPDIR}"
                     50: 
                     51: LOGFILE="${TMPDIR}/pkgbuild.log"
                     52: echo "${PGM}:  logging to ${LOGFILE}"
                     53: 
1.2     ! snw        54: RPM_RELEASE=$(echo "${_fmd_freem_version}" | sed "s/-/~/g")
        !            55: 
1.1       snw        56: if [[ ! -f Makefile ]]
                     57: then
                     58:     echo -n "${PGM}:  running autogen.sh..."
                     59:     ./autogen.sh &>> "${LOGFILE}"
                     60:     if [[ $? != 0 ]]
                     61:     then
                     62:        echo "[FAIL]"
                     63:        exit 1
                     64:     else
                     65:        echo "[OK]"
                     66:     fi
                     67:     echo -n "${PGM}:  running configure..."
                     68:     ./configure &>> "${LOGFILE}"
                     69:     if [[ $? != 0 ]]
                     70:     then
                     71:        echo "[FAIL]"
                     72:        exit 1
                     73:     else
                     74:        echo "[OK]"
                     75:     fi
                     76: 
                     77: fi
                     78:     
                     79: 
                     80: echo -n "${PGM}:  running 'make dist' to prepare source tarball..."
                     81: make dist &>> "${LOGFILE}"
                     82: if [[ $? != 0 ]]
                     83: then
                     84:     echo "[FAIL]"
                     85:     exit 1
                     86: else
                     87:     echo "[OK]"
                     88: fi
                     89: 
1.2     ! snw        90: ORIG_TARBALL="freem-${_fmd_freem_version.tar.gz}"
        !            91: 
        !            92: echo -n "${PGM}:  decompressing source tarball..."
        !            93: tar xzf "${TARBALL}"
        !            94: if [[ $? != 0 ]]
        !            95: then
        !            96:     echo "[FAIL]"
        !            97:     exit 1
        !            98: else
        !            99:     echo "[OK]"
        !           100: fi
        !           101: 
        !           102: 
1.1       snw       103: echo -n "${PGM}:  uploading source tarball..."
                    104: scp freem*.tar.gz jpw@freem.coherent-logic.com://var/www/freem.coherent-logic.com/downloads/ &>> "${LOGFILE}"
                    105: if [[ $? != 0 ]]
                    106: then
                    107:     echo "[FAIL]"
                    108:     exit 1
                    109: else
                    110:     echo "[OK]"
                    111: fi
1.2     ! snw       112: 
        !           113: echo "${PGM}:  performing substitutions on specfile..."
        !           114: cat scripts/rpm/freem.spec.in | sed "s/FREEM_VERSION/${RPM_RELEASE}/g" > scripts/rpm/freem.spec
        !           115: 
        !           116: echo -n "${PGM}:  running spectool..."
        !           117: spectool -g -R scripts/rpm/freem.spec &>> "${LOGFILE}"
        !           118: if [[ $? != 0 ]]
        !           119: then
        !           120:     echo "[FAIL]"
        !           121:     exit 1
        !           122: else
        !           123:     echo "[OK]"
        !           124: fi
        !           125: 
        !           126: echo -n "${PGM}:  building package..."
        !           127: rpmbuild -ba scripts/rpm/freem.spec &>> "${LOGFILE}"
        !           128: if [[ $? != 0 ]]
        !           129: then
        !           130:     echo "[FAIL]"
        !           131:     exit 1
        !           132: else
        !           133:     echo "[OK]"
        !           134: fi

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