You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

58 lines
1.4 KiB

  1. #!/usr/bin/perl
  2. #
  3. # makedesc directory file
  4. #
  5. # Scan the directory for files, and use the files to generate a task
  6. # description file. The format of the task description file is described in
  7. # tata.c. The format of the input files is:
  8. #
  9. # Task: desktop
  10. # Section: user
  11. # Description: Provide a basic GUI system
  12. # This task provides functionality for a basic desktop; whether Gnome
  13. # based, KDE based or customised. With this task, your system will boot
  14. # into a graphical login screen, at which point you can choose which of
  15. # these desktops you wish to use on a per-user basis. You can further
  16. # customise your desktop once installed.
  17. # Packages:
  18. # kdebase
  19. # gdm
  20. # ...
  21. #
  22. # Hash-comments are allowed in the files, but must be on their own lines.
  23. my $dir=shift or die "no directory specified\n";
  24. my $file=shift or die "no file specified\n";
  25. open (OUT, ">$file") or die ">$file: $!";
  26. use File::Find;
  27. find(\&processfile, $dir);
  28. sub processfile {
  29. return unless /^[-_.a-z0-9]+$/ and -f $_;
  30. open (IN, $_) or die "$_: $!";
  31. my %fields;
  32. my $field="";
  33. while (<IN>) {
  34. chomp;
  35. next if /^\s*#/;
  36. if (/^\s/) {
  37. $fields{$field}.="\n$_";
  38. }
  39. else {
  40. ($field, my $value)=split(/:\s*/, $_, 2);
  41. $field=lc($field);
  42. $fields{$field}=$value;
  43. }
  44. }
  45. close IN;
  46. print OUT map { ucfirst($_).": ".$fields{$_}."\n" }
  47. qw{task section description};
  48. print OUT "\n";
  49. }
  50. close OUT;