]> git.ipfire.org Git - people/ms/firmware-update.git/blob - src/firmware-update.in
Show error when an invalid command is given
[people/ms/firmware-update.git] / src / firmware-update.in
1 #!/bin/bash
2 ###############################################################################
3 # #
4 # firmware-update - IPFire Firmware Update Tool #
5 # Copyright (C) 2019 IPFire Development Team #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 ###############################################################################
21
22 PACKAGE_NAME="@PACKAGE_NAME@"
23 PACKAGE_VERSION="@PACKAGE_VERSION@"
24
25 main() {
26 local action="${1}"
27 shift
28
29 case "${action}" in
30 version)
31 echo "${PACKAGE_NAME}: Version ${PACKAGE_VERSION}"
32 return 0
33 ;;
34
35 "")
36 echo "No command given" >&2
37 return 2
38 ;;
39
40 *)
41 echo "Invalid command: ${action}" >&2
42 return 2
43 ;;
44 esac
45 }
46
47 # Call main
48 main "$@" || exit ${?}