Add "version" action

This commit is contained in:
Jérémy Lecour 2022-04-28 18:51:32 +02:00 committed by Jérémy Lecour
parent 900c789f95
commit def7813d71
2 changed files with 19 additions and 3 deletions

View File

@ -9,6 +9,7 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
* store and compare state between restart
* colorize output if terminal supports colors
* simple syslog logging
* "version" action
### Changed

View File

@ -1033,10 +1033,21 @@ reset() {
syslog_info "reset"
printf "${GREEN}${BOLD}${NAME} reset${RESET}\n"
}
show_version() {
cat <<END
${NAME} version ${VERSION}
Copyright 2007-2022 Evolix <info@evolix.fr>.
${NAME} comes with ABSOLUTELY NO WARRANTY.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3
of the License.
END
}
echo "${NAME} version ${VERSION}"
source_configuration
check_unpersisted_state
case "${1:-''}" in
@ -1061,8 +1072,12 @@ case "${1:-''}" in
start
;;
version)
show_version
;;
*)
echo "Usage: $0 {start|stop|restart|status|reset}"
echo "Usage: $0 {start|stop|restart|status|reset|version}"
exit 1
;;
esac