[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-unattended/var/se3/unattended/install/bin/ -> bootini.pl (source)

   1  # Removes "Previous Operating System on C:\" line from boot.ini
   2  
   3  use warnings;
   4  use strict;
   5  use bytes;
   6  
   7  # you can find the ASCII (win-latin-1) numbers in the windows
   8  # character map (in the start folder > accessories > system tools)
   9  # browse the "terminal" font and you will find the ASCII numbers you
  10  # need
  11  my %regexp_map =
  12      ('dan' => qr{Tidligere operativsystem p\x86},
  13       'deu' => qr{Vorheriges Betriebssystem auf},
  14       'enu' => qr{Previous Operating System on},
  15       'esn' => qr{Sistema operativo anterior en},
  16       'fra' => qr{Syst\x8Ame d\'exploitation pr\x82c\x82dent sur},
  17       'ita' => qr{Sistema operativo precedente su},
  18       'nld' => qr{Vorig besturingssysteem op},
  19       'nor' => qr{Tidligere operativsystem p\x86},
  20       'ptb' => qr{Sistema operacional anterior na},
  21       'sve' => qr{Tidigare operativsystem p\x86},
  22       );
  23  
  24  my $bootini = 'C:\\boot.ini';
  25  
  26  my $lang = (exists $ENV{'WINLANG'} ? $ENV{'WINLANG'} : 'enu');
  27  
  28  my $langstr = (exists $regexp_map{$lang} ? $regexp_map{$lang} : $regexp_map{'enu'});
  29  
  30  sub reset_attribs () {
  31      system 'attrib', '+h', '+s', $bootini;
  32  }
  33  
  34  END {
  35      # Be sure to reset attribs on boot.ini no matter what.
  36      reset_attribs ();
  37  }
  38  
  39  system 'attrib', '-h', '-s', $bootini;
  40  
  41  open BOOTINI, $bootini
  42      or die "Unable to open $bootini for reading: $^E";
  43  
  44  my @lines = grep { $_ !~ $langstr } <BOOTINI>;
  45  
  46  close BOOTINI
  47      or die "Unable to close $bootini: $^E";
  48  
  49  open BOOTINI, ">$bootini"
  50      or die "Unable to open $bootini for writing: $^E";
  51  
  52  print BOOTINI @lines;
  53  
  54  close BOOTINI
  55      or die "Unable to close $bootini: $^E";
  56  
  57  exit 0;


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1