Changeset 450 for devel/pb/bin/pb


Ignore:
Timestamp:
May 27, 2008, 12:09:18 AM (12 years ago)
Author:
Bruno Cornec
Message:

Check presence of inittab before touching it in setupvm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r448 r450  
    15031503# Keep the VM in text mode
    15041504$file="/etc/inittab";
    1505 open(PBFILE,$file) || die "Unable to open $file";
    1506 open(PBOUT,"> $file.new") || die "Unable to open $file.new";
    1507 while (<PBFILE>) {
    1508     s/^(..):5:initdefault:$/$1:3:initdefault:/;
    1509     print PBOUT $_;
    1510 }
    1511 close(PBFILE);
    1512 close(PBOUT);
    1513 rename("$file.new",$file);
    1514 chmod 0640,$file;
     1505if (-f $file) {
     1506    open(PBFILE,$file) || die "Unable to open $file";
     1507    open(PBOUT,"> $file.new") || die "Unable to open $file.new";
     1508    while (<PBFILE>) {
     1509        s/^(..):5:initdefault:$/$1:3:initdefault:/;
     1510        print PBOUT $_;
     1511    }
     1512    close(PBFILE);
     1513    close(PBOUT);
     1514    rename("$file.new",$file);
     1515    chmod 0640,$file;
     1516}
    15151517
    15161518# pb has to be added to portage group on gentoo
Note: See TracChangeset for help on using the changeset viewer.