diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2003-11-14 18:55:35 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2003-11-14 18:55:35 +0000 |
commit | 81daab12665e715c0fbc26b285b3494f8767da66 (patch) | |
tree | 0f49b0db365a7d9e8726e6624f63d6d56ca088f7 /move | |
parent | f10db1d5174ebebc678a0fb1bbdae85beb53f31e (diff) | |
download | drakx-81daab12665e715c0fbc26b285b3494f8767da66.tar drakx-81daab12665e715c0fbc26b285b3494f8767da66.tar.gz drakx-81daab12665e715c0fbc26b285b3494f8767da66.tar.bz2 drakx-81daab12665e715c0fbc26b285b3494f8767da66.tar.xz drakx-81daab12665e715c0fbc26b285b3494f8767da66.zip |
preliminary support for saving system configuration data on usb key
Diffstat (limited to 'move')
-rw-r--r-- | move/Makefile | 2 | ||||
-rw-r--r-- | move/data/README.adding.more.files | 14 | ||||
-rw-r--r-- | move/data/keyfiles | 96 | ||||
-rw-r--r-- | move/move.pm | 28 | ||||
-rw-r--r-- | move/todo | 3 |
5 files changed, 141 insertions, 2 deletions
diff --git a/move/Makefile b/move/Makefile index 55594ec7f..dc88cc654 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 etcfiles all-etcfiles +DATA_FILES = devices symlinks directories-to-create etcfiles all-etcfiles keyfiles README.adding.more.files LANG_FILES = $(shell perl -ne 'print $$1 if /ALLOWED_LANGS = qw\((.*)\)/' move.pm) STAGE1 = ../mdk-stage1 diff --git a/move/data/README.adding.more.files b/move/data/README.adding.more.files new file mode 100644 index 000000000..407e6972a --- /dev/null +++ b/move/data/README.adding.more.files @@ -0,0 +1,14 @@ +About the ".sysconf" directory automatically created on the USB +key (which appears as /home/.sysconf when using Mandrake Move) + + +This directory holds system configuration files. The directories' +names are made by hashing system specific PCI hardware, and it is +used to guess at boot if we can use these files (saved from a +previous boot on the same machine), or we should create new ones. +Hence, you are able to save different system configuration files +according to each machine you boot MandrakeMove with an USB Key. + +If you want to add new files for saving for next reboot, just +create the new file in the tree structure, and replace the +symlink in the /etc tree to the cdrom, by a symlink there. diff --git a/move/data/keyfiles b/move/data/keyfiles new file mode 100644 index 000000000..a4b8677bf --- /dev/null +++ b/move/data/keyfiles @@ -0,0 +1,96 @@ +/etc/fstab +/etc/group +/etc/modules +/etc/modules.conf +/etc/passwd +/etc/resolv.conf +/etc/shadow +/etc/sudoers +/etc/cups/classes.conf +/etc/cups/client.conf +/etc/cups/command.types +/etc/cups/cupsd.conf +/etc/cups/mime.convs +/etc/cups/mime.types +/etc/cups/printers.conf +/etc/cups/pstoraster.convs +/etc/devfs/conf.d/dynamic.conf +/etc/profile.d/10lang.csh +/etc/profile.d/10lang.sh +/etc/profile.d/alias.csh +/etc/profile.d/alias.sh +/etc/profile.d/configure_keyboard.sh +/etc/profile.d/glib20.csh +/etc/profile.d/glib20.sh +/etc/profile.d/inputrc.csh +/etc/profile.d/inputrc.sh +/etc/profile.d/kde3.sh +/etc/profile.d/msec.csh +/etc/profile.d/msec.sh +/etc/profile.d/qtdir3.csh +/etc/profile.d/qtdir3.sh +/etc/profile.d/screen.sh +/etc/profile.d/ssh-client.sh +/etc/profile.d/tmpdir.csh +/etc/profile.d/tmpdir.sh +/etc/profile.d/xhost.csh +/etc/profile.d/xhost.sh +/etc/sysconfig/alsa +/etc/sysconfig/autofsck +/etc/sysconfig/autologin +/etc/sysconfig/bootsplash +/etc/sysconfig/harddisks +/etc/sysconfig/i18n +/etc/sysconfig/init +/etc/sysconfig/installkernel +/etc/sysconfig/msec +/etc/sysconfig/rawdevices +/etc/sysconfig/suspend +/etc/sysconfig/syslog +/etc/sysconfig/usb +/etc/sysconfig/userdrake +/etc/sysconfig/xinetd +/etc/sysconfig/console/consolefonts/lat0-16.psf.gz +/etc/sysconfig/console/consoletrans/iso15.acm.gz +/etc/sysconfig/console/consoletrans/iso15.sfm.gz +/etc/sysconfig/harddrake2/previous_hw +/etc/sysconfig/network-scripts/ifdown-aliases +/etc/sysconfig/network-scripts/ifdown-ipv6 +/etc/sysconfig/network-scripts/ifdown-post +/etc/sysconfig/network-scripts/ifdown-ppp +/etc/sysconfig/network-scripts/ifdown-sit +/etc/sysconfig/network-scripts/ifdown-sl +/etc/sysconfig/network-scripts/ifup-aliases +/etc/sysconfig/network-scripts/ifup-ipv6 +/etc/sysconfig/network-scripts/ifup-ipx +/etc/sysconfig/network-scripts/ifup-plip +/etc/sysconfig/network-scripts/ifup-plusb +/etc/sysconfig/network-scripts/ifup-post +/etc/sysconfig/network-scripts/ifup-ppp +/etc/sysconfig/network-scripts/ifup-routes +/etc/sysconfig/network-scripts/ifup-sit +/etc/sysconfig/network-scripts/ifup-sl +/etc/sysconfig/network-scripts/ifup-wireless +/etc/sysconfig/network-scripts/ifcfg-eth0 +/etc/sysconfig/network-scripts/ifcfg-eth1 +/etc/sysconfig/network-scripts/ifcfg-eth2 +/etc/sysconfig/network-scripts/ifcfg-eth3 +/etc/sysconfig/network-scripts/init.ipv6-global +/etc/sysconfig/network-scripts/network-functions +/etc/sysconfig/network-scripts/network-functions-ipv6 +/etc/sysconfig/suspend-scripts/suspend.control +/etc/sysconfig/suspend-scripts/suspend.d/anacron +/etc/sysconfig/suspend-scripts/suspend.d/beep +/etc/sysconfig/suspend-scripts/suspend.d/clock +/etc/sysconfig/suspend-scripts/suspend.d/hddisks +/etc/sysconfig/suspend-scripts/suspend.d/modules +/etc/sysconfig/suspend-scripts/suspend.d/network +/etc/sysconfig/suspend-scripts/suspend.d/pcmcia +/etc/sysconfig/suspend-scripts/suspend.d/services +/etc/sysconfig/suspend-scripts/suspend.d/sound +/etc/sysconfig/suspend-scripts/suspend.d/usb +/etc/sysconfig/suspend-scripts/suspend.d/xfree +/etc/X11/XF86Config +/etc/X11/XF86Config-4 +/etc/X11/XF86Config-4.old +/etc/X11/XF86Config.old diff --git a/move/move.pm b/move/move.pm index 2dc8779d6..a9fee7412 100644 --- a/move/move.pm +++ b/move/move.pm @@ -10,6 +10,7 @@ use fsedit; use run_program; use log; use lang; +use Digest::MD5 qw(md5_hex); my @ALLOWED_LANGS = qw(en_US fr es it de); @@ -185,7 +186,7 @@ sub keys_parts { my @keys = grep { $_->{usb_media_type} && index($_->{usb_media_type}, 'Mass Storage|') == 0 && $_->{media_type} eq 'hd' } @{$o->{all_hds}{hds}}; map_index { $_->{mntpoint} = $::i ? "/mnt/key$::i" : '/home'; - $_->{options} = 'umask=077,uid=501,gid=501'; + $_->{options} = 'umask=077,uid=501,gid=501,shortname=mixed'; $_; } fsedit::get_fstab(@keys); } @@ -203,6 +204,11 @@ sub install2::handleMoveKey { fs::mount_part($_) foreach keys_parts($o); } +sub machine_ident { + #- , c::get_hw_address('eth0'); before detect of network :( + md5_hex(join '', (map { (split)[1] } cat_('/proc/bus/pci/devices'))); +} + sub install2::verifyKey { my ($o) = $::o; @@ -246,6 +252,26 @@ unplug it, remove write protection, and then plug it again.")), } close F; unlink '/home/.touched'; + + my $wait = $o->wait_message(N("Setting up USB key"), N("Please wait, setting up system configuration files on USB key...")); + mkdir '/home/.sysconf'; + my $sysconf = '/home/.sysconf/' . machine_ident(); + if (!-d $sysconf) { + mkdir $sysconf; + foreach (chomp_(cat_('/image/move/keyfiles'))) { + mkdir_p("$sysconf/" . dirname($_)); + system("cp $_ $sysconf$_"); + symlinkf("$sysconf$_", $_); + } + system("cp /image/move/README.adding.more.files /home/.sysconf"); + } else { + foreach (chomp_(`find $sysconf -type f`)) { + my ($path) = /^\Q$sysconf\E(.*)/; + mkdir_p(dirname($path)); + symlinkf($_, $path); + } + } + $wait = undef; } sub install2::startMove { @@ -45,3 +45,6 @@ pwconv unlinks and rewrite /etc/shadow so maintaining a link to the usb key is not possible - don't use shadow? (anyway security is not high) - need to hack pwconv :/ + +/etc/X11/XF86Config-4 + - needs to mount the key even before drakx opens xfree |