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

1.1       snw         1: #!/usr/bin/bash
                      2: 
                      3: #
1.2     ! snw         4: #   $Id: fmd-pkg-pkgadd,v 1.1 2025/04/07 03:23:44 snw Exp $
1.1       snw         5: #    Solaris package builder
                      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-pkgadd,v $
        !            28: #   Revision 1.1  2025/04/07 03:23:44  snw
        !            29: #   Port Solaris packaging script to fmd infrastructure
        !            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: PKG=CLDfreem
                     48: ARCH=${_fmd_subarch}
                     49: OS=${_fmd_distribution}
                     50: VERS=${_fmd_freem_version}
                     51: SOLVER=${_fmd_osversion}
                     52: PKGFILE=${PKG}-${VERS}-${OS}${SOLVER}-${ARCH}.pkg
                     53: 
                     54: echo "${PGM}:  producing pkgadd package \"${PKGFILE}\""
                     55: 
                     56: TMPDIR="/tmp/fmd-pkg-pkgadd"
                     57: rm -rf "${TMPDIR}"
                     58: mkdir -p "${TMPDIR}"
                     59: 
                     60: LOGFILE="${TMPDIR}/pkgbuild.log"
                     61: echo "${PGM}:  logging to ${LOGFILE}"
                     62: 
                     63: cat <<EOF > pkginfo
                     64: PKG=${PKG}
                     65: NAME=Coherent Logic Development FreeM programming language and database
                     66: ARCH=${ARCH}
                     67: VERSION=${VERS}
                     68: CATEGORY=application
                     69: BASEDIR=/usr/local
                     70: EOF
                     71: 
                     72: echo -n "${PGM}:  running pkgmk... "
1.2     ! snw        73: pkgmk -o -d /tmp -a ${ARCH} >> "${LOGFILE}" 2>&1
1.1       snw        74: if [[ $? == 0 ]]
                     75: then
                     76:     echo "[OK]"
                     77: else
                     78:     echo "[FAIL]"
                     79:     exit 1
                     80: fi
                     81: touch ${PKGFILE}
                     82: 
                     83: echo -n "${PGM}:  running pkgtrans... "
1.2     ! snw        84: pkgtrans -s /tmp ${PKGFILE} ${PKG} >> "${LOGFILE}" 2>&1
1.1       snw        85: if [[ $? == 0 ]]
                     86: then
                     87:     echo "[OK]"
                     88: else
                     89:     echo "[FAIL]"
                     90:     exit 1
                     91: fi
                     92: 
                     93: echo -n "${PGM}:  cleaning up... "
                     94: rm -r /tmp/${PKG}
                     95: if [[ $? == 0 ]]
                     96: then
                     97:     echo "[OK]"
                     98: else
                     99:     echo "[FAIL]"
                    100:     exit 1
                    101: fi

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