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 | |
parent | 12be8805ee4af3ba2060107179c4433963bc0dab (diff) | |
download | drakx-9bc1d750a05cc4efec0f1b9f4384bfd12d73daa3.tar drakx-9bc1d750a05cc4efec0f1b9f4384bfd12d73daa3.tar.gz drakx-9bc1d750a05cc4efec0f1b9f4384bfd12d73daa3.tar.bz2 drakx-9bc1d750a05cc4efec0f1b9f4384bfd12d73daa3.tar.xz drakx-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
-rw-r--r-- | move/Makefile | 2 | ||||
-rw-r--r-- | move/data/etcfiles | 24 | ||||
-rw-r--r-- | move/data/etcfiles-report | 151 | ||||
-rw-r--r-- | move/move.pm | 22 |
4 files changed, 198 insertions, 1 deletions
diff --git a/move/Makefile b/move/Makefile index 6d7d0b4d1..67cd5e506 100644 --- a/move/Makefile +++ b/move/Makefile @@ -2,7 +2,7 @@ DEST_LIVETREE = /tmp/live_tree DEST_STAGE2 = $(DEST_LIVETREE)/usr/bin/stage2 -DATA_FILES = devices symlinks directories-to-create +DATA_FILES = devices symlinks directories-to-create etcfiles LANG_FILES = $(shell perl -ne 'print $$1 if /ALLOWED_LANGS = qw\((.*)\)/' move.pm) STAGE1 = ../mdk-stage1 diff --git a/move/data/etcfiles b/move/data/etcfiles new file mode 100644 index 000000000..bb1223b4b --- /dev/null +++ b/move/data/etcfiles @@ -0,0 +1,24 @@ +# READ directories/files that will be read (we let only non trivial things here) +/etc/bonobo-activation +/etc/esd.conf +/etc/gimp +/etc/gnucash +/etc/host.conf +/etc/imrc +/etc/initlog.conf +/etc/localtime +/etc/openoffice +/etc/rpc +/etc/termcap +/etc/tmdns.conf + +# OVERWRITE files that will be overwritten +/etc/modules + +# DIR mandatory directories because files will be written in +/etc/profile.d +/etc/rpm +/etc/sysconfig +/etc/sysconfig/console/consolefonts +/etc/sysconfig/console/consoletrans +/etc/sysconfig/network-scripts diff --git a/move/data/etcfiles-report b/move/data/etcfiles-report new file mode 100644 index 000000000..0e8aa0908 --- /dev/null +++ b/move/data/etcfiles-report @@ -0,0 +1,151 @@ +read: + /etc/DIR_COLORS + /etc/X11/fs/config + /etc/X11/xserver/SecurityPolicy + /etc/bashrc + /etc/bonobo-activation/bonobo-activation-config.xml + /etc/cups/client.conf + /etc/devfs/conf.d/dynamic.conf + /etc/devfsd.conf + /etc/dynamic/scripts/functions.script + /etc/dynamic/scripts/part.script + /etc/esd.conf + /etc/fonts/fonts.conf + /etc/fonts/local.conf + /etc/fstab + /etc/gconf/2/path + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/audio_codecs/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/audio_settings/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/call_forwarding/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/contacts/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/devices/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/gatekeeper/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/general/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/history/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/ldap/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/personal_data/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/ports/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/video_display/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/video_settings/%gconf.xml + /etc/gconf/gconf.xml.defaults/apps/gnomemeeting/view/%gconf.xml + /etc/gconf/gconf.xml.defaults/desktop/gnome/interface/%gconf.xml + /etc/gconf/gconf.xml.defaults/desktop/gnome/sound/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/audio_settings/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/call_forwarding/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/contacts/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/devices/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/gatekeeper/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/general/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/history/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/ldap/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/personal_data/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/ports/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/video_display/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/video_settings/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/apps/gnomemeeting/view/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/desktop/gnome/interface/%gconf.xml + /etc/gconf/gconf.xml.defaults/schemas/desktop/gnome/sound/%gconf.xml + /etc/gimp/1.2/gimprc + /etc/gimp/1.2/gimprc_user + /etc/gimp/1.2/gtkrc + /etc/gimp/1.2/gtkrc_user + /etc/gimp/1.2/unitrc + /etc/gnome-vfs-2.0/modules/cdda-module.conf + /etc/gnome-vfs-2.0/modules/default-modules.conf + /etc/gnome-vfs-2.0/modules/ssl-modules.conf + /etc/gnucash/config + /etc/group + /etc/gtk-2.0/gdk-pixbuf.loaders + /etc/gtk-2.0/gtk.immodules + /etc/host.conf + /etc/hotplug/blacklist + /etc/hotplug/hotplug.functions + /etc/hotplug/scsi.agent + /etc/hotplug/usb.agent + /etc/hotplug/usb.handmap + /etc/hotplug/usb.usermap + /etc/hotplug/usb/usb-storage + /etc/imrc + /etc/initlog.conf + /etc/inittab + /etc/inputrc + /etc/ld.so.cache + /etc/localtime + /etc/login.defs + /etc/modules + /etc/modules.conf + /etc/modules.devfs + /etc/nsswitch.conf + /etc/openoffice/autoresponse.conf + /etc/openoffice/openoffice.conf + /etc/pam.d/other + /etc/pam.d/su + /etc/pam.d/sudo + /etc/pam.d/system-auth + /etc/pam.d/xserver + /etc/pango/pango.modules + /etc/passwd + /etc/passwd- + /etc/profile.d/10lang.sh + /etc/profile.d/alias.sh + /etc/profile.d/configure_keyboard.sh + /etc/profile.d/glib20.sh + /etc/profile.d/inputrc.sh + /etc/profile.d/kde3.sh + /etc/profile.d/msec.sh + /etc/profile.d/qtdir3.sh + /etc/profile.d/screen.sh + /etc/profile.d/ssh-client.sh + /etc/profile.d/tmpdir.sh + /etc/profile.d/xhost.sh + /etc/rc.d/init.d/functions + /etc/rc.d/init.d/mandrake_consmap + /etc/rc.d/init.d/syslog + /etc/rc.d/init.d/xfs + /etc/resolv.conf + /etc/rpc + /etc/security/console.perms + /etc/security/fileshare.conf + /etc/security/limits.conf + /etc/security/pam_env.conf + /etc/services + /etc/shells + /etc/skel/.bash_logout + /etc/skel/.bash_profile + /etc/skel/.bashrc + /etc/skel/.mailcap + /etc/skel/.screenrc + /etc/sudoers + /etc/sysconfig/i18n + /etc/sysconfig/init + /etc/sysconfig/msec + /etc/sysconfig/syslog + /etc/sysconfig/usb + /etc/syslog.conf + /etc/termcap + /etc/tmdns.conf +wrote: + /etc/group + /etc/inittab + /etc/modules + /etc/modules.conf + /etc/passwd + /etc/passwd- + /etc/sysconfig/i18n +new: + /etc/X11/XF86Config + /etc/X11/XF86Config-4 + /etc/X11/XF86Config-4.old + /etc/X11/XF86Config.old + /etc/hosts + /etc/mcc.conf + /etc/profile.d/proxy.csh + /etc/profile.d/proxy.sh + /etc/rpm/macros + /etc/shadow + /etc/sysconfig/autologin + /etc/sysconfig/console/consolefonts/lat0-16.psf.gz + /etc/sysconfig/console/consoletrans/iso15.acm.gz + /etc/sysconfig/console/consoletrans/iso15.sfm.gz + /etc/sysconfig/network + /etc/sysconfig/network-scripts/ifcfg-eth0 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 |