/usr/bin/ikiwiki-calendar is in ikiwiki 3.20160121.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #!/usr/bin/perl
use warnings;
use strict;
use IkiWiki;
use IkiWiki::Setup;
use Getopt::Long;
sub usage () {
die gettext("usage: ikiwiki-calendar [-f] your.setup [pagespec] [startyear [endyear]]"), "\n";
}
my $force=0;
GetOptions(
"force" => \$force,
) || usage();
my $setup=shift || usage();
my $pagespec;
if (@ARGV && $ARGV[0] !~ /^\d+$/) {
$pagespec=shift;
}
my $startyear=shift || 1900+(localtime(time))[5];
my $endyear=shift || $startyear;
%config=IkiWiki::defaultconfig();
IkiWiki::Setup::load($setup);
IkiWiki::loadplugins();
IkiWiki::checkconfig();
my $archivebase = 'archives';
$archivebase = $config{archivebase} if defined $config{archivebase};
if (! defined $pagespec) {
$pagespec=$config{archive_pagespec} || "*";
}
sub writearchive ($$;$) {
my $template=template(shift);
my $year=shift;
my $month=shift;
my $page=defined $month ? "$year/$month" : $year;
my $pagefile=newpagefile("$archivebase/$page", $config{default_pageext});
$template->param(pagespec => $pagespec);
$template->param(year => $year);
$template->param(month => $month) if defined $month;
if ($force || ! -e "$config{srcdir}/$pagefile") {
writefile($pagefile, $config{srcdir}, $template->output);
IkiWiki::rcs_add($pagefile) if $config{rcs};
}
}
foreach my $y ($startyear..$endyear) {
writearchive("calendaryear.tmpl", $y);
foreach my $m (qw{01 02 03 04 05 06 07 08 09 10 11 12}) {
writearchive("calendarmonth.tmpl", $y, $m);
}
}
IkiWiki::rcs_commit_staged(message => gettext("calendar update"))
if $config{rcs};
exec("ikiwiki", "--setup", $setup, "--refresh");
die "failed to run ikiwiki --setup $setup --refresh\n";
|