Annotation of freem/scripts/fmd, revision 1.1
1.1 ! snw 1: #!/usr/bin/env bash
! 2:
! 3: #
! 4: # $Id$
! 5: # FreeM dev script wrapper
! 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: # SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
! 30: # SPDX-License-Identifier: AGPL-3.0-or-later
! 31: #
! 32:
! 33: PGM=$(basename $0)
! 34: SCRIPT_DIR=$(dirname "$0")
! 35:
! 36: function usage() {
! 37: echo "usage: ${PGM} <command>"
! 38: exit 1
! 39: }
! 40:
! 41: if [[ $# < 1 ]]
! 42: then
! 43: usage
! 44: fi
! 45:
! 46: FMD_COMMAND=$1
! 47: shift
! 48:
! 49: CMDSCRIPT="${SCRIPT_DIR}/fmd-${FMD_COMMAND}"
! 50:
! 51: if [[ ! -x "${CMDSCRIPT}" ]]
! 52: then
! 53: echo "${PGM}: ${FMD_COMMAND} is not a valid command"
! 54: exit 1
! 55: fi
! 56:
! 57: case "${FMD_COMMAND}" in
! 58:
! 59: log)
! 60: ${SCRIPT_DIR}/fmd-log "${SCRIPT_DIR}/${PGM}" "$1"
! 61: ;;
! 62:
! 63: commit)
! 64: ${SCRIPT_DIR}/fmd-commit "${SCRIPT_DIR}/${PGM}" "$1"
! 65: ;;
! 66:
! 67: *)
! 68: ${CMDSCRIPT} "${SCRIPT_DIR}/${PGM}" $@
! 69: ;;
! 70:
! 71: esac
! 72:
! 73:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>