File:  [Coherent Logic Development] / freem / scripts / fmd-pkg-pkgadd
Revision 1.2: download - view: text, annotated - select for diffs
Mon Apr 7 03:43:53 2025 UTC (3 months, 3 weeks ago) by snw
Branches: MAIN
CVS tags: HEAD
Attempt to correct bash incompatibility on Solaris 8

    1: #!/usr/bin/bash
    2: 
    3: #
    4: #   $Id: fmd-pkg-pkgadd,v 1.2 2025/04/07 03:43:53 snw Exp $
    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: #
   27: #   $Log: fmd-pkg-pkgadd,v $
   28: #   Revision 1.2  2025/04/07 03:43:53  snw
   29: #   Attempt to correct bash incompatibility on Solaris 8
   30: #
   31: #   Revision 1.1  2025/04/07 03:23:44  snw
   32: #   Port Solaris packaging script to fmd infrastructure
   33: #
   34: #
   35: # SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
   36: # SPDX-License-Identifier: AGPL-3.0-or-later
   37: #
   38: 
   39: PGM=$(basename $0)
   40: SCRIPT_DIR=$(dirname "$0")
   41: 
   42: source "${SCRIPT_DIR}/_fmd_common.bash"
   43: 
   44: if [[ $# != 1 ]]
   45: then
   46:     echo "${PGM}:  must run from fmd package"
   47:     exit 1
   48: fi
   49: 
   50: PKG=CLDfreem
   51: ARCH=${_fmd_subarch}
   52: OS=${_fmd_distribution}
   53: VERS=${_fmd_freem_version}
   54: SOLVER=${_fmd_osversion}
   55: PKGFILE=${PKG}-${VERS}-${OS}${SOLVER}-${ARCH}.pkg
   56: 
   57: echo "${PGM}:  producing pkgadd package \"${PKGFILE}\""
   58: 
   59: TMPDIR="/tmp/fmd-pkg-pkgadd"
   60: rm -rf "${TMPDIR}"
   61: mkdir -p "${TMPDIR}"
   62: 
   63: LOGFILE="${TMPDIR}/pkgbuild.log"
   64: echo "${PGM}:  logging to ${LOGFILE}"
   65: 
   66: cat <<EOF > pkginfo
   67: PKG=${PKG}
   68: NAME=Coherent Logic Development FreeM programming language and database
   69: ARCH=${ARCH}
   70: VERSION=${VERS}
   71: CATEGORY=application
   72: BASEDIR=/usr/local
   73: EOF
   74: 
   75: echo -n "${PGM}:  running pkgmk... "
   76: pkgmk -o -d /tmp -a ${ARCH} >> "${LOGFILE}" 2>&1
   77: if [[ $? == 0 ]]
   78: then
   79:     echo "[OK]"
   80: else
   81:     echo "[FAIL]"
   82:     exit 1
   83: fi
   84: touch ${PKGFILE}
   85: 
   86: echo -n "${PGM}:  running pkgtrans... "
   87: pkgtrans -s /tmp ${PKGFILE} ${PKG} >> "${LOGFILE}" 2>&1
   88: if [[ $? == 0 ]]
   89: then
   90:     echo "[OK]"
   91: else
   92:     echo "[FAIL]"
   93:     exit 1
   94: fi
   95: 
   96: echo -n "${PGM}:  cleaning up... "
   97: rm -r /tmp/${PKG}
   98: if [[ $? == 0 ]]
   99: then
  100:     echo "[OK]"
  101: else
  102:     echo "[FAIL]"
  103:     exit 1
  104: fi

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