Mageia Bugzilla – Attachment 9140 Details for
Bug 20551
Installer no longer respects default rpmsrate level when selecting packages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
new Getopt option install2 test case
test-new.pl (text/plain), 5.15 KB, created by
Thierry Vignaud
on 2017-03-23 15:53:01 CET
(
hide
)
Description:
new Getopt option install2 test case
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2017-03-23 15:53:01 CET
Size:
5.15 KB
patch
obsolete
> >use lib qw(/usr/lib/libDrakX ./install/); >#use diagnostics; >use strict; >use vars qw($o); >use Getopt::Long qw(GetOptionsFromArray :config no_ignore_case no_auto_abbrev no_getopt_compat pass_through); >use Data::Dumper; ># make results reproducible: >$Data::Dumper::Sortkeys = 1; > >BEGIN { $::isInstall = 1 } > >#-###################################################################################### >#- misc imports >#-###################################################################################### >use install::steps_list; >use common; > >#-####################################################################################### >=head1 Data Structure > >=head2 $O; > >$o (or $::o in other modules) is the big struct which contain, well everything: > >=over 4 > >=item * globals > >=item * the interactive methods > >=item * ... > >=back > >if you want to do a kickstart file, you just have to add all the required fields (see for example >the variable $default) > >=cut >#-####################################################################################### >$o = $::o = { ># bootloader => { linear => 0, message => 1, timeout => 5, restricted => 0 }, >#- packages => [ qw() ], > partitioning => { clearall => 0, eraseBadPartitions => 0, auto_allocate => 0 }, #-, readonly => 0 }, > authentication => { sha512 => 1, shadow => 1 }, > locale => { lang => 'en_US' }, >#- isUpgrade => 0, > toRemove => [], > toSave => [], >#- simple_themes => 1, > > timezone => { >#- timezone => "Europe/Paris", >#- UTC => 1, > }, >#- superuser => { password => 'a', shell => '/bin/bash', realname => 'God' }, >#- user => { name => 'foo', password => 'bar', home => '/home/foo', shell => '/bin/bash', realname => 'really, it is foo' }, > >#- keyboard => 'de', >#- display => "192.168.1.19:1", > steps => \%install::steps_list::installSteps, > orderedSteps => \@install::steps_list::orderedInstallSteps, > > #- for the list of fields available, see network/network.pm > net => { > #- network => { HOSTNAME => 'abcd' }, > #- resolv => { DOMAINNAME => 'foo.xyz' }, > #- ifcfg => { > #- eth0 => { DEVICE => "eth0", IPADDR => '1.2.3.4', NETMASK => '255.255.255.128' } > #- }, > }, > untranslated_license => "Bla license" >#-step : the current one >#-prefix >#-mouse >#-keyboard >#-netc >#-methods >#-packages compss > >}; > >=over > >=item parse_args($cfg, $patch) > >Parse arguments (which came from either the boot loader command line or its configuration file). > >=cut > >sub parse_args { > my ($cfg, $patch); > my @cmdline = (@_, map { "--$_" } split ' ', cat_("/proc/cmdline")); > > #- from stage1 > put_in_hash(\%ENV, { getVarsFromSh('/tmp/env') }); > exists $ENV{$_} and push @cmdline, sprintf("--%s=%s", lc($_), $ENV{$_}) foreach qw(METHOD PCMCIA KICKSTART); > > GetOptionsFromArray(\@cmdline, > $o, # must be 2nd parameter (see http://perldoc.perl.org/Getopt/Long.html#Storing-options-values-in-a-hash) > 'keyboard=s' => sub { $o->{keyboard} = $_[1]; push @::auto_steps, 'selectKeyboard' }, > 'lang=s', > 'flang=s' => sub { $o->{lang} = $_[1]; push @::auto_steps, 'selectLanguage' }, > 'langs=s' => sub { $o->{locale}{langs} = +{ map { $_ => 1 } split(':', $_[1]) } }, > 'method=s', > 'pcmcia=s', > 'step=s' => \$o->{steps}{first}, > 'meta_class=s', > 'freedriver=s', > > # fs/block options: > no_bad_drives => \$o->{partitioning}{no_bad_drives}, > nodmraid => \$o->{partitioning}{nodmraid}, > 'readonly=s' => sub { $o->{partitioning}{readonly} = $_[1] ne "0" }, > 'use_uuid=s' => sub { $::no_uuid_by_default = !$_[1] }, > > # urpmi options: > 'debug_urpmi', > 'deploops', > 'justdb', > 'tune-rpm' => sub { $o->{'tune-rpm'} = 'all' }, > > # GUI options: > 'vga16=s', > 'vga=s' => sub { $o->{vga} = $_[1] =~ /0x/ ? hex($_[1]) : $_[1] }, > 'display=s', > askdisplay => sub { print "Please enter the X11 display to perform the install on ? "; $o->{display} = chomp_(scalar(<STDIN>)) }, > 'newt|text' => sub { $o->{interactive} = "curses" }, > stdio => sub { $o->{interactive} = "stdio" }, > 'simple_themes', > 'theme=s', > 'doc', #- will be used to know that we're running for the doc team, > #- e.g. we want screenshots with a good B&W contrast > > 'security=s' => \$o->{security}, > > # auto install options: > noauto => \$::noauto, > testing => \$::testing, > patch => \$patch, > 'defcfg=s' => \$cfg, > 'auto_install|kickstart=s' => \$::auto_install, > > local_install => \$::local_install, > uml_install => sub { $::uml_install = $::local_install = 1 }, > > # debugging options: > 'useless_thing_accepted', > alawindows => sub { $o->{security} = 0; $o->{partitioning}{clearall} = 1; $o->{bootloader}{crushMbr} = 1 }, > fdisk => \$o->{partitioning}{fdisk}, > 'nomouseprobe=s', > 'updatemodules', > > 'suppl=s' => \$o->{supplmedia}, > 'askmedia', > restore => \$::isRestore, > 'compsslistlevel=s', > ); > > ($cfg, $patch); >} > >my ($cfg, $patch) = parse_args(@ARGV); >output("o_new.pm", Dumper($o)); > >=back
use lib qw(/usr/lib/libDrakX ./install/); #use diagnostics; use strict; use vars qw($o); use Getopt::Long qw(GetOptionsFromArray :config no_ignore_case no_auto_abbrev no_getopt_compat pass_through); use Data::Dumper; # make results reproducible: $Data::Dumper::Sortkeys = 1; BEGIN { $::isInstall = 1 } #-###################################################################################### #- misc imports #-###################################################################################### use install::steps_list; use common; #-####################################################################################### =head1 Data Structure =head2 $O; $o (or $::o in other modules) is the big struct which contain, well everything: =over 4 =item * globals =item * the interactive methods =item * ... =back if you want to do a kickstart file, you just have to add all the required fields (see for example the variable $default) =cut #-####################################################################################### $o = $::o = { # bootloader => { linear => 0, message => 1, timeout => 5, restricted => 0 }, #- packages => [ qw() ], partitioning => { clearall => 0, eraseBadPartitions => 0, auto_allocate => 0 }, #-, readonly => 0 }, authentication => { sha512 => 1, shadow => 1 }, locale => { lang => 'en_US' }, #- isUpgrade => 0, toRemove => [], toSave => [], #- simple_themes => 1, timezone => { #- timezone => "Europe/Paris", #- UTC => 1, }, #- superuser => { password => 'a', shell => '/bin/bash', realname => 'God' }, #- user => { name => 'foo', password => 'bar', home => '/home/foo', shell => '/bin/bash', realname => 'really, it is foo' }, #- keyboard => 'de', #- display => "192.168.1.19:1", steps => \%install::steps_list::installSteps, orderedSteps => \@install::steps_list::orderedInstallSteps, #- for the list of fields available, see network/network.pm net => { #- network => { HOSTNAME => 'abcd' }, #- resolv => { DOMAINNAME => 'foo.xyz' }, #- ifcfg => { #- eth0 => { DEVICE => "eth0", IPADDR => '1.2.3.4', NETMASK => '255.255.255.128' } #- }, }, untranslated_license => "Bla license" #-step : the current one #-prefix #-mouse #-keyboard #-netc #-methods #-packages compss }; =over =item parse_args($cfg, $patch) Parse arguments (which came from either the boot loader command line or its configuration file). =cut sub parse_args { my ($cfg, $patch); my @cmdline = (@_, map { "--$_" } split ' ', cat_("/proc/cmdline")); #- from stage1 put_in_hash(\%ENV, { getVarsFromSh('/tmp/env') }); exists $ENV{$_} and push @cmdline, sprintf("--%s=%s", lc($_), $ENV{$_}) foreach qw(METHOD PCMCIA KICKSTART); GetOptionsFromArray(\@cmdline, $o, # must be 2nd parameter (see http://perldoc.perl.org/Getopt/Long.html#Storing-options-values-in-a-hash) 'keyboard=s' => sub { $o->{keyboard} = $_[1]; push @::auto_steps, 'selectKeyboard' }, 'lang=s', 'flang=s' => sub { $o->{lang} = $_[1]; push @::auto_steps, 'selectLanguage' }, 'langs=s' => sub { $o->{locale}{langs} = +{ map { $_ => 1 } split(':', $_[1]) } }, 'method=s', 'pcmcia=s', 'step=s' => \$o->{steps}{first}, 'meta_class=s', 'freedriver=s', # fs/block options: no_bad_drives => \$o->{partitioning}{no_bad_drives}, nodmraid => \$o->{partitioning}{nodmraid}, 'readonly=s' => sub { $o->{partitioning}{readonly} = $_[1] ne "0" }, 'use_uuid=s' => sub { $::no_uuid_by_default = !$_[1] }, # urpmi options: 'debug_urpmi', 'deploops', 'justdb', 'tune-rpm' => sub { $o->{'tune-rpm'} = 'all' }, # GUI options: 'vga16=s', 'vga=s' => sub { $o->{vga} = $_[1] =~ /0x/ ? hex($_[1]) : $_[1] }, 'display=s', askdisplay => sub { print "Please enter the X11 display to perform the install on ? "; $o->{display} = chomp_(scalar(<STDIN>)) }, 'newt|text' => sub { $o->{interactive} = "curses" }, stdio => sub { $o->{interactive} = "stdio" }, 'simple_themes', 'theme=s', 'doc', #- will be used to know that we're running for the doc team, #- e.g. we want screenshots with a good B&W contrast 'security=s' => \$o->{security}, # auto install options: noauto => \$::noauto, testing => \$::testing, patch => \$patch, 'defcfg=s' => \$cfg, 'auto_install|kickstart=s' => \$::auto_install, local_install => \$::local_install, uml_install => sub { $::uml_install = $::local_install = 1 }, # debugging options: 'useless_thing_accepted', alawindows => sub { $o->{security} = 0; $o->{partitioning}{clearall} = 1; $o->{bootloader}{crushMbr} = 1 }, fdisk => \$o->{partitioning}{fdisk}, 'nomouseprobe=s', 'updatemodules', 'suppl=s' => \$o->{supplmedia}, 'askmedia', restore => \$::isRestore, 'compsslistlevel=s', ); ($cfg, $patch); } my ($cfg, $patch) = parse_args(@ARGV); output("o_new.pm", Dumper($o)); =back
View Attachment As Raw
Actions:
View
Attachments on
bug 20551
:
9135
|
9136
|
9137
|
9138
|
9139
| 9140 |
9141
|
9142
|
9143
|
9144
|
9145
|
9146