|
1 | 1 | #!/usr/bin/env perl
|
2 | 2 | BEGIN { require 5.022 }
|
3 |
| -package Squashmount v19.0.2; |
| 3 | +package Squashmount v19.1.0; |
4 | 4 |
|
5 | 5 | use strict;
|
6 | 6 | use warnings;
|
@@ -261,6 +261,10 @@ For usage in scripts, combine this with B<-q>/B<-S> and pass a tag.
|
261 | 261 | Output the absolute path to the squash-file.
|
262 | 262 | For usage in scripts, combine this with B<-q>/B<-S> and pass a tag.
|
263 | 263 |
|
| 264 | +=item B<print-mtime> |
| 265 | + |
| 266 | +Output the mtime of the squash-file. |
| 267 | + |
264 | 268 | =item B<print-type>
|
265 | 269 |
|
266 | 270 | Output the tool actually used for mounting.
|
@@ -2750,7 +2754,14 @@ sub cmd_status {
|
2750 | 2754 | push(@status, 'WORKDIR: ' . &get_abspath('WORKDIR', $force, 1))
|
2751 | 2755 | if (&is_valid_workdir($force));
|
2752 | 2756 | my $file = &get_abspath('FILE', $force);
|
2753 |
| - push(@status, 'FILE: ' . $file) if (&is_abspath($file)); |
| 2757 | + if (&is_abspath($file)) { |
| 2758 | + push(@status, 'FILE: ' . $file); |
| 2759 | + if (-f $file) { |
| 2760 | + my $mtime = &local_mtime($file); |
| 2761 | + push(@status, 'mtime: ' . $mtime) |
| 2762 | + if (&is_nonempty($mtime)) |
| 2763 | + } |
| 2764 | + } |
2754 | 2765 | push(@status, "TEMPDIR: $tempdir") if (&is_abspath($tempdir));
|
2755 | 2766 | push(@status, "BACKUP: $backup") if (&is_nonempty($backup));
|
2756 | 2767 | &mksquashfs_options(\my @options);
|
@@ -2796,6 +2807,10 @@ sub cmd_print_file {
|
2796 | 2807 | &do_print(&get_abspath('FILE', $force))
|
2797 | 2808 | }
|
2798 | 2809 |
|
| 2810 | +sub cmd_print_mtime { |
| 2811 | + &do_print(&local_mtime(&get_abspath('FILE', $force)) // '') |
| 2812 | +} |
| 2813 | + |
2799 | 2814 | sub cmd_print_type {
|
2800 | 2815 | &do_print($current->{'TYPE'} // '')
|
2801 | 2816 | }
|
@@ -4862,6 +4877,14 @@ sub bad_status {
|
4862 | 4877 | $exitstatus = 1 unless ($fatalreturn || ($exitstatus != 0))
|
4863 | 4878 | }
|
4864 | 4879 |
|
| 4880 | +sub local_mtime { |
| 4881 | + my $file = shift(); |
| 4882 | + return undef unless (&is_nonempty($file)); |
| 4883 | + my $mtime = (stat($file))[9]; |
| 4884 | + return undef unless (&is_nonempty($mtime)); |
| 4885 | + localtime($mtime) |
| 4886 | +} |
| 4887 | + |
4865 | 4888 | # check whether argument is a nonempty string and the corresponding file exists
|
4866 | 4889 |
|
4867 | 4890 | sub file_exists {
|
@@ -5271,6 +5294,9 @@ my $action = (shift(@ARGV) // '');
|
5271 | 5294 | } elsif ($action =~ m{fil}i) {
|
5272 | 5295 | $cmd = 'print-file';
|
5273 | 5296 | $action = \&cmd_print_file
|
| 5297 | + } elsif ($action =~ m{tim}i) { |
| 5298 | + $cmd = 'print-mtime'; |
| 5299 | + $action = \&cmd_print_mtime |
5274 | 5300 | } elsif ($action =~ m{s.*typ}i) {
|
5275 | 5301 | $cmd = 'print-squashtype';
|
5276 | 5302 | $action = \&cmd_print_squashtype
|
|
0 commit comments