Annotation of freem/scripts/fmd-pkg-os2rpm, revision 1.1
1.1 ! snw 1: #!/usr/bin/env bash
! 2:
! 3: #
! 4: # $Id$
! 5: # Creates an rpm package on OS/2
! 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: #
! 30: # SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
! 31: # SPDX-License-Identifier: AGPL-3.0-or-later
! 32: #
! 33:
! 34: PGM=$(basename $0)
! 35: SCRIPT_DIR=$(dirname "$0")
! 36:
! 37: source "${SCRIPT_DIR}/_fmd_common.bash"
! 38:
! 39: if [[ $# != 1 ]]
! 40: then
! 41: echo "${PGM}: must run from fmd package"
! 42: exit 1
! 43: fi
! 44:
! 45: TMPDIR="/tmp/fmd-pkg-os2rpm"
! 46: rm -rf "${TMPDIR}"
! 47: mkdir -p "${TMPDIR}"
! 48:
! 49: LOGFILE="${TMPDIR}/pkgbuild.log"
! 50: echo "${PGM}: logging to ${LOGFILE}"
! 51:
! 52: RPM_RELEASE=$(echo "${_fmd_freem_version}" | sed "s/-/~/g")
! 53:
! 54: if [[ ! -f Makefile ]]
! 55: then
! 56: echo -n "${PGM}: running autogen.sh..."
! 57: ./autogen.sh &>> "${LOGFILE}"
! 58: if [[ $? != 0 ]]
! 59: then
! 60: echo "[FAIL]"
! 61: exit 1
! 62: else
! 63: echo "[OK]"
! 64: fi
! 65: echo -n "${PGM}: running configure..."
! 66: ./configure &>> "${LOGFILE}"
! 67: if [[ $? != 0 ]]
! 68: then
! 69: echo "[FAIL]"
! 70: exit 1
! 71: else
! 72: echo "[OK]"
! 73: fi
! 74:
! 75: fi
! 76:
! 77: ORIG_TARBALL="freem-${_fmd_freem_version}.tar.gz"
! 78: ORIG_DIR="freem-${_fmd_freem_version}/"
! 79: NEW_DIR="freem-${RPM_RELEASE}/"
! 80: NEW_TARBALL="freem-${RPM_RELEASE}.tar.gz"
! 81:
! 82: echo -n "${PGM}: running 'make dist' to prepare source tarball..."
! 83: make dist &>> "${LOGFILE}"
! 84: if [[ $? != 0 ]]
! 85: then
! 86: echo "[FAIL]"
! 87: exit 1
! 88: else
! 89: echo "[OK]"
! 90: fi
! 91:
! 92: if [[ "${ORIG_TARBALL}" != "${NEW_TARBALL}" ]]
! 93: then
! 94: RENAME=1
! 95: else
! 96: RENAME=0
! 97: fi
! 98:
! 99: if [[ $RENAME == 1 ]]
! 100: then
! 101: echo -n "${PGM}: cleaning up..."
! 102: rm -rf "${OLD_DIR}" "${NEW_DIR}" "${NEW_TARBALL}" &>> /dev/null
! 103: if [[ $? != 0 ]]
! 104: then
! 105: echo "[FAIL]"
! 106: exit 1
! 107: else
! 108: echo "[OK]"
! 109: fi
! 110: fi
! 111:
! 112: echo -n "${PGM}: decompressing source tarball..."
! 113: tar xzf "${ORIG_TARBALL}"
! 114: if [[ $? != 0 ]]
! 115: then
! 116: echo "[FAIL]"
! 117: exit 1
! 118: else
! 119: echo "[OK]"
! 120: fi
! 121:
! 122: if [[ $RENAME == 1 ]]
! 123: then
! 124: echo -n "${PGM}: renaming ${ORIG_DIR} -> ${NEW_DIR}..."
! 125: mv "${ORIG_DIR}" "${NEW_DIR}" &>> /dev/null
! 126: if [[ $? != 0 ]]
! 127: then
! 128: echo "[FAIL]"
! 129: exit 1
! 130: else
! 131: echo "[OK]"
! 132: fi
! 133:
! 134:
! 135: echo -n "${PGM}: generating ${NEW_TARBALL}..."
! 136: tar cf "${NEW_TARBALL}" "${NEW_DIR}" &>> /dev/null
! 137: if [[ $? != 0 ]]
! 138: then
! 139: echo "[FAIL]"
! 140: exit 1
! 141: else
! 142: echo "[OK]"
! 143: fi
! 144: fi
! 145:
! 146: echo -n "${PGM}: uploading source tarball..."
! 147: scp "${NEW_TARBALL}" jpw@freem.coherent-logic.com://var/www/freem.coherent-logic.com/downloads/ &>> "${LOGFILE}"
! 148: if [[ $? != 0 ]]
! 149: then
! 150: echo "[FAIL]"
! 151: exit 1
! 152: else
! 153: echo "[OK]"
! 154: fi
! 155:
! 156: echo "${PGM}: performing substitutions on specfile..."
! 157: cat scripts/rpm/freem.spec.os2 | sed "s/FREEM_VERSION/${RPM_RELEASE}/g" > scripts/rpm/freem.spec
! 158:
! 159: RPMROOT="${HOME}/rpmbuild"
! 160: echo -n "${PGM}: removing ${RPMROOT}..."
! 161: rm -rf "${RPMROOT}" &>> "${LOGFILE}"
! 162: if [[ $? != 0 ]]
! 163: then
! 164: echo "[FAIL]"
! 165: exit 1
! 166: else
! 167: echo "[OK]"
! 168: fi
! 169:
! 170: echo -n "${PGM}: preparing directory structure..."
! 171: mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} &>> "${LOGFILE}"
! 172: if [[ $? != 0 ]]
! 173: then
! 174: echo "[FAIL]"
! 175: exit 1
! 176: else
! 177: echo "[OK]"
! 178: fi
! 179:
! 180: echo -n "${PGM}: running spectool..."
! 181: spectool -g -R scripts/rpm/freem.spec &>> "${LOGFILE}"
! 182: if [[ $? != 0 ]]
! 183: then
! 184: echo "[FAIL]"
! 185: exit 1
! 186: else
! 187: echo "[OK]"
! 188: fi
! 189:
! 190: echo -n "${PGM}: building package..."
! 191: rpmbuild -ba scripts/rpm/freem.spec &>> "${LOGFILE}"
! 192: if [[ $? != 0 ]]
! 193: then
! 194: echo "[FAIL]"
! 195: exit 1
! 196: else
! 197: echo "[OK]"
! 198: fi
! 199:
! 200: echo -n "${PGM}: cleaning up..."
! 201: rm -rf "${OLD_DIR}" "${NEW_DIR}" "${NEW_TARBALL}" &>> /dev/null
! 202: if [[ $? != 0 ]]
! 203: then
! 204: echo "[FAIL]"
! 205: exit 1
! 206: else
! 207: echo "[OK]"
! 208: fi
! 209:
! 210: echo -n "${PGM}: copying rpm packages..."
! 211: cp ${RPMROOT}/RPMS/${_fmd_arch}/*.rpm . &>> "${LOGFILE}"
! 212: if [[ $? != 0 ]]
! 213: then
! 214: echo "[FAIL]"
! 215: exit 1
! 216: else
! 217: echo "[OK]"
! 218: fi
! 219:
! 220: echo -n "${PGM}: copying source rpm packages..."
! 221: cp ${RPMROOT}/SRPMS/*.rpm . &>> "${LOGFILE}"
! 222: if [[ $? != 0 ]]
! 223: then
! 224: echo "[FAIL]"
! 225: exit 1
! 226: else
! 227: echo "[OK]"
! 228: fi
! 229:
! 230: RPM_BUILT=$(ls -1 *.rpm)
! 231:
! 232: BLDLST=""
! 233: for PKGFILE in ${RPM_BUILT}
! 234: do
! 235: if [[ "${BLDLST}" == "" ]]
! 236: then
! 237: BLDLST="${PKGFILE}"
! 238: else
! 239: BLDLST="${BLDLST} ${PKGFILE}"
! 240: fi
! 241: done
! 242:
! 243: echo "${PGM}: built ${BLDLST}"
! 244:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>