my $picinspath = '/usr/share/texmf/tex/latex/picins'; my $file = 'picins.sty'; if (!-e "$picinspath/$file") { if (!-d $picinspath) { my @parts=split('/',$picinspath); my $filepath; foreach my $part (@parts) { $filepath.= '/'.$part; if (!-d $filepath) { mkdir($filepath,0755); } } } if (-d $picinspath) { system("/usr/bin/wget -O $picinspath/$file http://www.ctan.org/get/macros/latex209/contrib/picins/picins.sty 1>/dev/null 2>/dev/null"); die("/usr/bin/wget -O http://www.ctan.org/get/macros/latex209/contrib/picins/picins.sty failed") if $?; if (-e $picinspath.'/'.$file) { system('/usr/bin/texconfig rehash 1>/dev/null 2>/dev/null'); die("Can't run /usr/bin/texconfig rehash") if $?; print "$picinspath/$file created and /usr/bin/texconfig rehash ran successfully.\n"; } else { die("Can't find $picinspath/$file"); } } else { die("Can't find $picinspath") if $?; } } else { print "No action required - $picinspath/$file already exists.\n"; }