1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
#!/usr/bin/perl
#
# Guillaume Cottenceau (gc@mandrakesoft.com)
#
# Copyright 2001 MandrakeSoft
#
# This software may be freely redistributed under the terms of the GNU
# public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
use lib qw(/usr/lib/libDrakX);
use common;
use interactive;
use standalone;
use devices;
use detect_devices;
use steps;
use commands;
use fs;
use Data::Dumper;
$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
local $_ = join '', @ARGV;
/-h/ and die "usage: drakautoinst [--version]\n";
/-version/ and die 'version: $Id$ '."\n";
$::direct = /-direct/;
my $in = 'interactive'->vnew('su', 'default');
begin:
$::isEmbedded and kill USR2, $::CCPID;
my $imagefile = "/root/replay_install.img";
-f $imagefile or $in->ask_okcancel(_("Error!"),
_("I can't find needed image file `%s'.", $imagefile), 1), quit_global($in, 0);
$::direct or $in->ask_okcancel(_("Auto Install Configurator"),
_("You are about to configure an Auto Install floppy. This feature is somewhat dangerous and must be used circumspectly.
With that feature, you will be able to replay the installation you've performed on this computer, being interactively prompted for some steps, in order to change their values.
For maximum safety, the partitioning and formatting will never be performed automatically, whatever you chose during the install of this computer.
Do you want to continue?"), 1) or quit_global($in, 0);
my @manual_steps = qw(doPartitionDisks formatPartitions);
my @all_steps;
my @choices;
my $st = \%steps::installSteps;
for (my $f = $st->{first}; $f; $f = $st->{$f}{next}) {
next if member($f, @manual_steps);
my $def_choice = 'replay';
push @choices, { label => _($st->{$f}{text}), val => \$def_choice, list => [ 'replay', 'manual' ] };
push @all_steps, [ $f, \$def_choice ];
}
$in->ask_from(_("Automatic Steps Configuration"),
_("Please choose for each step whether it will replay like your install, or it will be manual"),
\@choices
) or quit_global($in, 0);
${$_->[1]} eq 'manual' and push @manual_steps, $_->[0] foreach @all_steps;
my $mountdir = "/root/tmp/drakautoinst-mountdir"; -d $mountdir or mkdir $mountdir, 0755;
my $floppy = detect_devices::floppy();
my $dev = devices::make($floppy);
$in->ask_okcancel('', _("Insert a blank floppy in drive %s", $floppy), 1) or quit_global($in, 0);
{
my $w = $in->wait_message('', _("Creating auto install floppy"));
commands::dd("if=$imagefile", "of=$dev", "bs=1440", "count=1024");
common::sync();
}
fs::mount($dev, $mountdir, 'vfat', 0);
my $cfgfile = "$mountdir/auto_inst.cfg";
eval(cat_($cfgfile));
my $str = join('',
"#!/usr/bin/perl -cw
#
# Special file generated by ``drakautoinst''.
#
# You should check the syntax of this file before using it in an auto-install.
# You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file
# (note the '#!/usr/bin/perl -cw' on the first line).
",
Data::Dumper->Dump([$o], ['$o']), q(
package install_steps_auto_install;
$graphical = 1;
), Data::Dumper->Dump([\@manual_steps], ['$msteps']),
q(push @graphical_steps, @$msteps;
), "\0");
$str =~ s/ {8}/\t/g; #- replace all 8 space char by only one tabulation, this reduces file size so much :-)
output($cfgfile, $str);
fs::umount($mountdir);
$in->ask_okcancel(_("Congratulations!"),
_("The floppy has been successfully generated.
You may now replay your installation."));
quit_global($in, 0);
sub quit_global {
my ($in, $exitcode) = @_;
$::isEmbedded ? kill USR1, $::CCPID : $in->exit($exitcode);
goto begin;
}
#-------------------------------------------------
#- $Log$
#- Revision 1.6 2001/09/14 17:30:23 siegel
#- Check exisence of "/root/replay_install.img" before anything else ...
#-
#- Revision 1.5 2001/08/29 21:58:24 gc
#- quit_global
#-
#- Revision 1.4 2001/08/26 14:34:10 gc
#- require -> use
#-
#- Revision 1.3 2001/08/18 17:52:21 prigaux
#- big renaming of ask_from_entries_refH in ask_from and ask_from_entries_refH_powered in ask_from_
#-
#- Revision 1.2 2001/08/13 19:08:27 gc
#- ouch! use lib from /usr/lib/libDrakX, rather than from ..
#-
#- Revision 1.1 2001/08/13 19:06:50 gc
#- initial revision for drakautoinst
#- - put %installSteps in a separate package (steps.pm) (for drakxtools)
#- - use additional fields {auto} and {noauto}, by step, to ease interactive auto install and oem stuff
#- - in install2.pm, perform each step either from the interactive class or from install_steps, according to the {auto} flag
#- - id, tell each step to not try to be automatic if {noauto}
#- - in the install, have auto install bootdisk created in install_any so we can always write a bootdisk (from install_steps) for further use from drakautoinst in standalone
#- - interactive version of install_steps_auto_install is now inheriting from the interactive class, so we can click on a previous automatic step and have it interactively during an interactive auto install
#-
#-
|