This file is indexed.

/usr/bin/odfbuild is in libopenoffice-oodoc-perl 2.125-3.

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
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/usr/bin/perl

eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
    if 0; # not running under some shell
#-----------------------------------------------------------------------------
#	$Id : odfbuild 0.2 2008-05-04 JMG$
#-----------------------------------------------------------------------------

=head1	NAME

odfbuild - OpenDocument file creation utility

=head1	SYNOPSIS

odfbuild filename.odt

odfbuild filename.odt --title "My Document" --subject "Test"

odfbuild filename.ods --class spreadsheet --source "data.csv" --tablesize "8x16"

cat data.txt | odfbuild filename.odt -

=head1	OPTIONS

	--class		Document class (text, spreadsheet, drawing, presentation)
			Default: text
	--opendocument	(no value). If this option is on, the document will be in
			OpenDocument format. Without this option, the format will
			be selected according to the general configuration of the
			OpenOffice::OODoc installation.
	--creator	The author of the document. Default: the current user's
			login name.
	--date		Creation date. Default is current local time.
			If provided, must be in ISO-8601 format
			(YYYY-MM-DDTHH:MM:SS)
	--description	The description (abstract) of the document. Default: none.
	--force		(no value). If this option is on, any existing file with
			the same path as the target file will be replaced. Without
			this option, the program will fail if the target exists.
	--generator	Software signature to be stored in the file (not visible
			for the end user).
			Default: "Genicorp OpenOffice::OODoc <version>"
	--keywords	A list of comma-separated keywords. Default: none.
	--source	A text file, to be used as the content of the document.
			If the document class is 'text', each line is loaded as a new
			paragraph with the standard style. If the document class is
			'spreadsheet', the file is processed as CSV data and loaded
			in one sheet. If the document class is neither 'text' nor
			'spreadsheet', the file is not processed.
			If source = '-', or if a '-' argument is provided, the data
			file is read through the standard input.
	--subject	The subject of the document. Default: none.
	--tablename	The name of the sheet to be created if the document class is
			'spreadsheet' and if a data file is provided. Default: the name
			of the data file, or "Unnamed Sheet" if the data is read from
			the standard input.
	--tablesize	The size of the sheet to be created if the document class is
			'spreadsheet' and if a data file is provided, in 'HxW' format
			where H is the number of lines and W the number of columns.
			Default: '16x8'
	--title		The title of the document. Default: "Untitled".
	--readable_XML	(no value). For debugging only. If this option is on, the XML
			content of the target file is indented, in order to be later
			edited.

=cut

#----------------------------------------------------------------------------------------

use OpenOffice::OODoc	2.101;
use Getopt::Long;

my $INPUT	= undef;
my $input	= undef;

my $generator	= 'OpenOffice::OODoc ' . $OpenOffice::OODoc::VERSION;
my $title	= "Generated document";
my $description	= "This file has been created with $generator";

my $targetfile = $ARGV[0]
	or die "Usage: oobuild <filename> [--options]\n";

GetOptions
	(
	''			=> \(my $stdin = undef),
	'class=s'		=> \(my $class = 'text'),
	'date=s'		=> \(my $date = odfLocaltime),
	'generator=s'		=> \$generator,
	'title=s'		=> \$title,
	'subject=s'		=> \(my $subject = ''),
	'description=s'		=> \$description,
	'keywords=s'		=> \(my $keywords = ''),
	'creator=s'		=> \(my $creator = scalar getpwuid($<)),
	'source=s'		=> \(my $source = undef),
	'tablesize=s'		=> \(my $tablesize = '16x8'),
	'tablename=s'		=> \(my $tablename = undef),
	'force'			=> \(my $force = undef),
	'opendocument'		=> \(my $odf = undef),
	'readable_XML'		=> \(my $rxml = undef)
	);

if ( -e $targetfile && ! defined $force)
	{
	die	"File $targetfile exists. I don't create it.\n"	.
		"Use --force to replace it.\n";
	}
my $odf_flag = $odf ? 'on' : undef;
my $rxml_flag = $rxml ? 'on' : undef;

my $archive	= odfContainer
			(
			$targetfile,
			create		=> $class,
			opendocument	=> $odf_flag
			)
	or die "File creation failure\n";

#----------------------------------------------------------------------------------------

my $meta	= odfMeta(container => $archive, readable_XML => $rxml_flag);
$meta->creation_date($date);
$meta->date($date);
$meta->generator($generator);
$meta->initial_creator($creator);
$meta->creator($creator);
$meta->title($title);
$meta->subject($subject);
$meta->description($description);
$meta->keywords(split ',', $keywords) if $keywords;

#----------------------------------------------------------------------------------------

if ($stdin || $source)
	{
	my $INPUT = undef;
	if ($stdin || ($source eq '-'))
		{
		$INPUT = *STDIN;
		$source = '-';
		}
	else
		{
		if ( -e $source && -r $source )
			{
			open(SOURCE, "<", $source);
			$INPUT = *SOURCE;
			}
		}
	my $content = odfDocument
			(container => $archive, readable_XML => $rxml_flag);
	if ($class eq 'text')
		{
		my $first_para = $content->getParagraph(0);
		while (my $para = <$INPUT>)
			{
			$content->appendParagraph(text => $para);
			}
		$content->removeElement($first_para) if $first_para;
		}
	elsif ($class eq 'spreadsheet')
		{
		my ($cols, $lns) = split 'x', $tablesize;
		unless ($tablename)
			{
			if ($source gt '-')
				{
				$tablename = $source;
				}
			else
				{
				$tablename = 'Unnamed Sheet';
				}
			}
		my $first_sheet = $content->getTable(0);
		my $sheet = $content->appendTable($tablename, $cols, $lns);
		$content->removeElement($first_sheet) if $first_sheet;
		ROW: for (my $i = 0; my $record = <$INPUT>; $i++)
			{
			last ROW unless $record;
			chomp $record;
			my @data = split ';', $record;
			my $row = $content->getTableRow($sheet, $i);
			CELL: for (my $j = 0; my $value = shift @data; $j++)
				{
				last CELL unless defined $value;
				$content->cellValue($row, $j, $value);
				}
			}
		}
	else
		{
		warn "Source text loading not allowed for this class\n";
		}
	close $INPUT unless ($source eq '-');
	}

#----------------------------------------------------------------------------------------

$archive->save;
exit;

#----------------------------------------------------------------------------------------