mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-08 08:44:05 +01:00
Improve compile time/date implementation
- Rename the command from 'date' to 'info' - Return the complete date/time/version string in the command Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
2a40012fc4
commit
41923cb80e
@ -3325,6 +3325,7 @@ report_capabilities1() {
|
||||
|
||||
show_status() {
|
||||
local compiletime
|
||||
local state
|
||||
|
||||
if product_is_started ; then
|
||||
[ $VERBOSITY -ge 1 ] && echo "$g_product is running"
|
||||
@ -3347,14 +3348,14 @@ show_status() {
|
||||
|
||||
if [ $VERBOSITY -ge 1 ]; then
|
||||
if [ -f $g_firewall ]; then
|
||||
compiletime=$($g_firewall date)
|
||||
compiletime=$($g_firewall info 2>/dev/null)
|
||||
|
||||
case $compiletime in
|
||||
Usage*)
|
||||
state="$state ($g_firewall compiled by Shorewall version $($g_firewall version))"
|
||||
compiled\ *)
|
||||
state="$state ($g_firewall $compiletime)"
|
||||
;;
|
||||
*)
|
||||
state="$state ($g_firewall compiled $compiletime by Shorewall version $($g_firewall version))"
|
||||
state="$state ($g_firewall compiled by Shorewall version $($g_firewall version))"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
@ -599,12 +599,16 @@ EOF
|
||||
#
|
||||
# Generate date_command()
|
||||
#
|
||||
sub compile_date_command() {
|
||||
sub compile_info_command() {
|
||||
my $date = localtime;
|
||||
|
||||
emit( "\ndate_command() {" ,
|
||||
" echo $date" ,
|
||||
"}" );
|
||||
emit( "\n",
|
||||
"#",
|
||||
"# Echo the time and date when this script was compiled",
|
||||
"#",
|
||||
"info_command() {" ,
|
||||
qq( echo "compiled $date by Shorewall version \$SHOREWALL_VERSION") ,
|
||||
"}\n" );
|
||||
}
|
||||
|
||||
#
|
||||
@ -935,7 +939,7 @@ sub compiler {
|
||||
#
|
||||
# Echo the compilation time and date
|
||||
#
|
||||
compile_date_command;
|
||||
compile_info_command unless $test;
|
||||
#
|
||||
# Copy the footer to the script
|
||||
#
|
||||
|
@ -25,7 +25,7 @@ usage() {
|
||||
echo " savesets <file>"
|
||||
echo " call <function> [ <parameter> ... ]"
|
||||
echo " version"
|
||||
echo " date"
|
||||
echo " info"
|
||||
echo
|
||||
echo "Options are:"
|
||||
echo
|
||||
@ -470,9 +470,9 @@ case "$COMMAND" in
|
||||
echo $SHOREWALL_VERSION
|
||||
status=0
|
||||
;;
|
||||
date)
|
||||
info)
|
||||
[ $# -ne 1 ] && usage 2
|
||||
date_command
|
||||
info_command
|
||||
;;
|
||||
help)
|
||||
[ $# -ne 1 ] && usage 2
|
||||
|
Loading…
Reference in New Issue
Block a user