diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2003-11-07 12:50:05 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2003-11-07 12:50:05 +0000 |
commit | 9bc1d750a05cc4efec0f1b9f4384bfd12d73daa3 (patch) | |
tree | 7c50852ab3c96fb011070c394c0ad265843c1d12 /move/move.pm | |
parent | 12be8805ee4af3ba2060107179c4433963bc0dab (diff) | |
download | drakx-backup-do-not-use-9bc1d750a05cc4efec0f1b9f4384bfd12d73daa3.tar drakx-backup-do-not-use-9bc1d750a05cc4efec0f1b9f4384bfd12d73daa3.tar.gz drakx-backup-do-not-use-9bc1d750a05cc4efec0f1b9f4384bfd12d73daa3.tar.bz2 drakx-backup-do-not-use-9bc1d750a05cc4efec0f1b9f4384bfd12d73daa3.tar.xz drakx-backup-do-not-use-9bc1d750a05cc4efec0f1b9f4384bfd12d73daa3.zip |
better handle etc files: scan a/c/mtime after copying all /etc files
to list the ones which are read and written, make it a file list
and be assured to have those when initing move
Diffstat (limited to 'move/move.pm')
-rw-r--r-- | move/move.pm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/move/move.pm b/move/move.pm index 8354ebbe9..f2ffd6ddb 100644 --- a/move/move.pm +++ b/move/move.pm @@ -17,9 +17,25 @@ sub symlinkf_short { if (my $l = readlink $dest) { $dest = $l if $l =~ m!^/!; } + -d $file and log::l("$file already exists and is a directory! writing in directory may be needed, not overwriting"), return; symlinkf($dest, $file); } +sub handle_etcfiles { + my (@allowed_modes) = @_; + #- non-trivial files listed from tools/scan-etc.pl + foreach (chomp_(cat_('/image/move/etcfiles'))) { + my $mode if 0; + m|^# (\S+)| and $mode = $1; + m|^/| && member($mode, @allowed_modes) and do { + $mode eq 'READ' && !-e $_ and symlinkf_short("/image$_", $_); + $mode eq 'OVERWRITE' and system("cp /image$_ $_"); #- need copy contents + $mode eq 'DIR' and mkdir_p $_; + } + } + +} + #- run very soon at stage2 start, setup things on tmpfs rw / that #- were not necessary to start stage2 itself (there were setup #- by stage1 of course) @@ -40,6 +56,9 @@ sub init { mkdir_p("/etc/$_"), system("cp -R /image/etc/$_/* /etc/$_") foreach qw(cups profile.d sysconfig/network-scripts devfs/conf.d); + + #- directories we badly need as non-links because files will be written in + handle_etcfiles('DIR'); #- for /etc/sysconfig/networking/ifcfg-lo mkdir "/etc/sysconfig/networking"; @@ -54,6 +73,9 @@ sub init { symlinkf_short("/image/etc/X11/$_", "/etc/X11/$_") foreach qw(encodings.dir app-defaults applnk fs lbxproxy proxymngr rstart wmsession.d xinit.d xinit xkb xserver xsm); + #- non-trivial files/directories that need be readable, files that will be overwritten + handle_etcfiles('READ', 'OVERWRITE'); + #- create remaining /etc and /var subdirectories if not already copied or symlinked, #- because programs most often won't try to create the missing subdir before trying #- to write a file, leading to obscure unexpected failures |