Annotation of freem/scripts/fmd, revision 1.3
1.1 snw 1: #!/usr/bin/env bash
2:
3: #
1.3 ! snw 4: # $Id: fmd,v 1.2 2025/04/06 03:38:05 snw Exp $
1.1 snw 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: #
1.2 snw 27: # $Log: fmd,v $
1.3 ! snw 28: # Revision 1.2 2025/04/06 03:38:05 snw
! 29: # Prepare for adding packaging functionality to fmd
! 30: #
1.2 snw 31: # Revision 1.1 2025/04/04 18:00:01 snw
32: # *** empty log message ***
33: #
1.1 snw 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:
1.2 snw 42: source "${SCRIPT_DIR}/_fmd_common.bash"
43:
44: #echo "Welcome, $(echo ${_fmd_fullname} | awk '{ print $1 }') <${_fmd_email}>!"
45: #echo
46: #echo "fmd: running on ${_fmd_distribution} ${_fmd_osversion} (${_fmd_kernel} kernel) on ${_fmd_arch}"
47: #echo "fmd: this repository contains sources for FreeM ${_fmd_freem_version}"
48:
1.1 snw 49: function usage() {
1.2 snw 50: echo
51: echo "FreeM developer utilities"
52: echo
53: echo "usage:"
54: echo
55: echo " ${PGM} <command> [OPTIONS]"
56: echo
57: echo " <command> is one of the following:"
58:
59: for FMDCMD in $(_fmd_commands)
60: do
1.3 ! snw 61: if [[ "${FMDCMD}" != "pkg" ]]
! 62: then
! 63: echo " - ${FMDCMD}"
! 64: fi
1.2 snw 65: done
66:
67: echo
68: echo " To get detailed help on an individual fmd command:"
69: echo " fmd help <command>"
70: echo
1.1 snw 71: exit 1
72: }
73:
74: if [[ $# < 1 ]]
75: then
76: usage
77: fi
78:
79: FMD_COMMAND=$1
80: shift
81:
1.2 snw 82: if [[ "${FMD_COMMAND}" == "help" ]]
83: then
84: if [[ $# == 0 ]]
85: then
86: usage
87: else
88: CMDSCRIPT="${SCRIPT_DIR}/fmd-$1"
89: FMD_COMMAND="help"
90: fi
91: else
92: CMDSCRIPT="${SCRIPT_DIR}/fmd-${FMD_COMMAND}"
93: fi
1.1 snw 94:
95: if [[ ! -x "${CMDSCRIPT}" ]]
1.2 snw 96: then
1.1 snw 97: echo "${PGM}: ${FMD_COMMAND} is not a valid command"
98: exit 1
1.2 snw 99: fi
1.1 snw 100:
101: case "${FMD_COMMAND}" in
102:
1.2 snw 103: help)
104: ${CMDSCRIPT} help
105: ;;
106:
1.1 snw 107: log)
108: ${SCRIPT_DIR}/fmd-log "${SCRIPT_DIR}/${PGM}" "$1"
109: ;;
110:
111: commit)
112: ${SCRIPT_DIR}/fmd-commit "${SCRIPT_DIR}/${PGM}" "$1"
113: ;;
114:
115: *)
116: ${CMDSCRIPT} "${SCRIPT_DIR}/${PGM}" $@
117: ;;
118:
119: esac
120:
121:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>