Annotation of freem/scripts/fmd-package, revision 1.2

1.1       snw         1: #!/usr/bin/env bash
                      2: 
                      3: #
1.2     ! snw         4: #   $Id: fmd-package,v 1.1 2025/04/06 03:38:05 snw Exp $
1.1       snw         5: #    Prepare a binary package for the current platform
                      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-package,v $
        !            28: #   Revision 1.1  2025/04/06 03:38:05  snw
        !            29: #   Prepare for adding packaging functionality 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: function usage() {
                     40:     echo
                     41:     echo "Builds a binary package of the current FreeM code"
                     42:     echo
                     43:     echo "usage:"
                     44:     echo
                     45:     echo "  fmd package"
                     46:     echo
                     47:     echo "NOTE: You cannot build a package for a different"
                     48:     echo "      platform. That is, if you're running on a"
                     49:     echo "      Solaris system, you can only build a Solaris"
                     50:     echo "      package."
                     51:     echo
                     52:     exit 0
                     53: }
                     54: 
                     55: if [[ $1 == "help" ]]
                     56: then
                     57:     usage
                     58: fi
                     59: 
1.2     ! snw        60: if [[ $# != 2 ]]
1.1       snw        61: then
                     62:     echo "package:  must be run from 'fmd package'"
                     63:     exit 1
                     64: fi
                     65: 
                     66: if [[ ${_fmd_can_package} == 0 ]]
                     67: then
1.2     ! snw        68:     echo "package:  FreeM does not yet support binary packages on ${_fmd_distribution} ${_fmd_kernel}"
1.1       snw        69:     exit 1
                     70: else
1.2     ! snw        71:     echo "package:  building ${_fmd_pkg_mechanism} package on ${_fmd_distribution} ${_fmd_kernel}"
1.1       snw        72: fi
                     73: 
1.2     ! snw        74: CMDSCRIPT="${SCRIPT_DIR}/fmd-pkg-${_fmd_pkg_mechanism}"
        !            75: 
        !            76: if [[ -f "${CMDSCRIPT}" ]]
        !            77: then
        !            78:     ${CMDSCRIPT} $1 $2
        !            79: else
        !            80:     echo "package:  ${CMDSCRIPT} not found"
        !            81: fi

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