lacg.pl 636 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/perl
  2. use strict;
  3. use Template;
  4. my $lacg_dir = "/root/lacg";
  5. my $lacg_conf = sprintf('%s/%s', ($lacg_dir,"config"));
  6. my $lacg_templates_dir = sprintf('%s/%s', ($lacg_dir, "templates"));
  7. our %templates;
  8. our %data;
  9. require $lacg_conf;
  10. foreach my $template (keys %templates)
  11. {
  12. printf "Writing %s\n", $templates{$template};
  13. my $tt = Template->new({ABSOLUTE => 1});
  14. my $tt_file = sprintf('%s/%s', ($lacg_templates_dir, $template));
  15. $tt->process($tt_file, \%data, $templates{$template}) || die $tt->error;
  16. }
  17. print "Lazy Admin Configuration Generator is done.\n";
  18. print "Press enter to reboot...\n";
  19. <>;
  20. exec('reboot');