diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2001-08-13 19:06:50 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2001-08-13 19:06:50 +0000 |
commit | 17b65ec06df7108085989f2e0398e1b834cd0358 (patch) | |
tree | 6c4a056dfeac594066fd7d41c621d390fedd3d17 /perl-install/standalone/drakautoinst | |
parent | 0fc25337f6b7397a892d6724cb6dc3886d6f01f8 (diff) | |
download | drakx-backup-do-not-use-17b65ec06df7108085989f2e0398e1b834cd0358.tar drakx-backup-do-not-use-17b65ec06df7108085989f2e0398e1b834cd0358.tar.gz drakx-backup-do-not-use-17b65ec06df7108085989f2e0398e1b834cd0358.tar.bz2 drakx-backup-do-not-use-17b65ec06df7108085989f2e0398e1b834cd0358.tar.xz drakx-backup-do-not-use-17b65ec06df7108085989f2e0398e1b834cd0358.zip |
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
Diffstat (limited to 'perl-install/standalone/drakautoinst')
-rwxr-xr-x | perl-install/standalone/drakautoinst | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/perl-install/standalone/drakautoinst b/perl-install/standalone/drakautoinst new file mode 100755 index 000000000..070c1d8dc --- /dev/null +++ b/perl-install/standalone/drakautoinst @@ -0,0 +1,137 @@ +#!/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(..); + +use common; +use interactive; +use standalone; +use devices; +use detect_devices; +use steps; +use commands; +use fs; + +$::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; + +$::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_entries_refH(_("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 $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); +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)); + +require Data::Dumper; +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(0); + goto begin; +} + + +#------------------------------------------------- +#- $Log$ +#- 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 +#- +#- |