summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-11-03 21:01:40 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-11-03 21:01:40 +0000
commitbfb74f8e19dfb79be542b07cceffb48bb89eba09 (patch)
treebd1c218d189f1581d2d376a93560fabadf72bf02
parent6eb70d879ac65c1413ed84ba286f6123060a905e (diff)
downloaddrakx-bfb74f8e19dfb79be542b07cceffb48bb89eba09.tar
drakx-bfb74f8e19dfb79be542b07cceffb48bb89eba09.tar.gz
drakx-bfb74f8e19dfb79be542b07cceffb48bb89eba09.tar.bz2
drakx-bfb74f8e19dfb79be542b07cceffb48bb89eba09.tar.xz
drakx-bfb74f8e19dfb79be542b07cceffb48bb89eba09.zip
call summaryBefore to auto configure network, timezone, printers
obscure problems when launching foomatic-configure exhausted problem of missing subdirectories in /etc and /var, create them at startup when they are missing to prevent from future other problems of the kind
-rw-r--r--move/Makefile4
-rwxr-xr-xmove/collect-directories-to-create.pl17
-rw-r--r--move/data/.cvsignore1
-rw-r--r--move/move.pm26
4 files changed, 39 insertions, 9 deletions
diff --git a/move/Makefile b/move/Makefile
index 0d0220fd9..084e10099 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
+DATA_FILES = devices symlinks directories-to-create
LANG_FILES = $(shell perl -ne 'print $$1 if /ALLOWED_LANGS = qw\((.*)\)/' move.pm)
STAGE1 = ../mdk-stage1
@@ -22,6 +22,7 @@ all: install
build: xwait
cd $(STAGE1) && ADDITIONAL_DEFS="-DMANDRAKE_MOVE" MOVE=1 make init stage1-network stage1-cdrom init-move
+ sudo ./collect-directories-to-create.pl $(DEST_LIVETREE) > data/directories-to-create
install: build
while [ -e $(DEST_LIVETREE)/lock ]; do echo -e "\t*** sleeping because of lock... ***\n"; sleep 1; done
@@ -42,6 +43,7 @@ install: build
#- overwrite /usr/lib/libDrakX files of the live tree with those in CVS
sudo cp -f $(addprefix $(INSTALL)/, $(shell cd $(DEST_LIVETREE)/usr/lib/libDrakX ; ls *.pm)) $(DEST_LIVETREE)/usr/lib/libDrakX || :
+ sudo cp -f $(addprefix $(INSTALL)/printer/, $(shell cd $(DEST_LIVETREE)/usr/lib/libDrakX/printer ; ls *.pm)) $(DEST_LIVETREE)/usr/lib/libDrakX/printer || :
#- overwrite stuff.so of drakxtools because it doesn't contain C_DRAKX stuff
sudo cp -f ../perl-install/c/blib/arch/auto/stuff/stuff.so $(DEST_LIVETREE)/usr/lib/libDrakX/auto/c/stuff
diff --git a/move/collect-directories-to-create.pl b/move/collect-directories-to-create.pl
new file mode 100755
index 000000000..c6e208c57
--- /dev/null
+++ b/move/collect-directories-to-create.pl
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+
+use strict;
+use MDK::Common;
+
+#- there are programs/packages which fail when the directory
+#- in which they try to write doesn't exist. better collect them
+#- at build time so that drakx startup can create them.
+
+my @list = map { if_(m|^\Q$ARGV[0]\E(.*)$|, $1) } `find $ARGV[0]/{etc,var} -type d`;
+my @final;
+foreach my $e (sort { length($b) <=> length($a) } @list) {
+ any { /^\Q$e\E/ } @final and next;
+ push @final, $e;
+}
+
+print "$_\n" foreach sort @final;
diff --git a/move/data/.cvsignore b/move/data/.cvsignore
new file mode 100644
index 000000000..7e6125b3d
--- /dev/null
+++ b/move/data/.cvsignore
@@ -0,0 +1 @@
+directories-to-create
diff --git a/move/move.pm b/move/move.pm
index b9a6ae294..bae0195b4 100644
--- a/move/move.pm
+++ b/move/move.pm
@@ -22,11 +22,15 @@ sub init {
#- rw things
mkdir "/$_" foreach qw(home mnt root etc var);
- mkdir_p "/var/$_" foreach qw(log run/console spool lib/xkb lock/subsys);
- mkdir_p "/etc/$_" foreach qw(X11);
+ mkdir "/etc/$_" foreach qw(X11 cups);
touch '/etc/modules.conf';
symlinkf "/proc/mounts", "/etc/mtab";
- mkdir_p $_ foreach qw(/etc/devfs/conf.d /etc/rpm /etc/sysconfig /etc/sysconfig/console/consoletrans /etc/sysconfig/console/consolefonts);
+
+ #- to be able to adduser, one need to have /etc/passwd and /etc/group writable
+ #- sudoers must a file, not a symlink
+ system("cp /image/etc/{passwd,group,sudoers} /etc");
+
+ system("cp -R /image/etc/cups/* /etc/cups");
#- ro things
symlinkf "/image/etc/$_", "/etc/$_"
@@ -37,9 +41,11 @@ sub init {
symlinkf "/image/etc/X11/$_", "/etc/X11/$_"
foreach qw(encodings.dir app-defaults applnk fs lbxproxy proxymngr rstart wmsession.d xinit.d xinit xkb xserver xsm);
- #- to be able to adduser, one need to have /etc/passwd and /etc/group writable
- #- sudoers must a file, not a symlink
- system("cp /image/etc/{passwd,group,sudoers} /etc");
+ #- 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
+ -d $_ or mkdir_p $_ foreach chomp_(cat_('/image/move/directories-to-create'));
+
#- free up stage1 memory
fs::umount($_) foreach qw(/stage1/proc /stage1);
@@ -81,6 +87,12 @@ sub install2::startMove {
require install_steps;
install_steps::addUser($o);
+ lomount_clp('totem') if ! -x '/usr/bin/totem';
+
+ #- automatic printer, timezone, network configs
+ require install_steps_interactive;
+ install_steps_interactive::summaryBefore($o);
+
require install_any;
install_any::write_fstab($o);
modules::write_conf('');
@@ -113,8 +125,6 @@ Continue at your own risk."), formatError($@) ]) if $@;
output("/var/run/console/$username", 1);
run_program::run('pam_console_apply');
- lomount_clp('totem') if ! -x '/usr/bin/totem';
-
if (fork()) {
sleep 1;
log::l("DrakX waves bye-bye");