Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 44105 Details for
Bug 21549
Ebuild for bricolage (new package)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Quiet installation for 1.8.x
quiet_rev_1_8_install-svn.diff (text/plain), 17.16 KB, created by
Marshall Roch
on 2004-11-16 14:55:04 UTC
(
hide
)
Description:
Quiet installation for 1.8.x
Filename:
MIME Type:
Creator:
Marshall Roch
Created:
2004-11-16 14:55:04 UTC
Size:
17.16 KB
patch
obsolete
>Index: Makefile >=================================================================== >--- Makefile (revision 6083) >+++ Makefile (working copy) >@@ -19,6 +19,9 @@ > # Set the location of Perl. > PERL = /usr/bin/perl > >+# Blank by default, but set to QUIET to ask essential questions only >+INSTALL_VERBOSITY?= STANDARD >+ > # can't load Bric since it loads Bric::Config which has dependencies > # that won't be solved till make install. > BRIC_VERSION = `$(PERL) -ne '/VERSION.*?([\d\.]+)/ and print $$1 and exit' < lib/Bric.pm` >@@ -31,24 +34,24 @@ > bconf/bricolage.conf build_done > > required.db : inst/required.pl >- $(PERL) inst/required.pl >+ $(PERL) inst/required.pl $(INSTALL_VERBOSITY) > > modules.db : inst/modules.pl lib/Bric/Admin.pod >- $(PERL) inst/modules.pl >+ $(PERL) inst/modules.pl $(INSTALL_VERBOSITY) > > apache.db : inst/apache.pl required.db >- $(PERL) inst/apache.pl >+ $(PERL) inst/apache.pl $(INSTALL_VERBOSITY) > >-# This shoudl be updated to something more database-independent. In fact, >+# This should be updated to something more database-independent. In fact, > # what should happen is that a script should present a list of supported > # databases, the user picks which one (each with a key name for the DBD > # driver, e.g., "Pg", "mysql", "Oracle", etc.), and then the rest of the > # work should just assume that database and do the work for that database. > postgres.db : inst/postgres.pl required.db >- $(PERL) inst/postgres.pl >+ $(PERL) inst/postgres.pl $(INSTALL_VERBOSITY) > > config.db : inst/config.pl required.db apache.db postgres.db >- $(PERL) inst/config.pl >+ $(PERL) inst/config.pl $(INSTALL_VERBOSITY) > > bconf/bricolage.conf : required.db inst/conf.pl > $(PERL) inst/conf.pl INSTALL $(BRIC_VERSION) >Index: inst/config.pl >=================================================================== >--- inst/config.pl (revision 6083) >+++ inst/config.pl (working copy) >@@ -36,6 +36,10 @@ > use Config; > use Cwd; > >+# check whether questions should be asked >+our $QUIET; >+$QUIET = 1 if $ARGV[0] and $ARGV[0] eq 'QUIET'; >+ > print "\n\n==> Gathering User Configuration <==\n\n"; > our %CONFIG; > >@@ -71,8 +75,8 @@ > > END > >- $CONFIG{set} = ask_choice("Your choice?", >- [ "s", "m" ], "s"); >+ $CONFIG{set} = "s"; >+ $CONFIG{set} = ask_choice("Your choice?", [ "s", "m" ], "s", $QUIET); > > # setup the default > if ($CONFIG{set} eq 's') { >@@ -123,7 +127,7 @@ > > sub confirm_settings { > my $default_root = $CONFIG{BRICOLAGE_ROOT}; >- ask_confirm("\nBricolage Root Directory", \$CONFIG{BRICOLAGE_ROOT}); >+ ask_confirm("\nBricolage Root Directory", \$CONFIG{BRICOLAGE_ROOT}, $QUIET); > > # make sure this directory isn't the same at the source directory > if (canonpath($CONFIG{BRICOLAGE_ROOT}) eq canonpath(cwd())) { >@@ -150,14 +154,15 @@ > $CONFIG{$_} = eval qq{"$CONFIG{$_}"}; > } > >- ask_confirm("Temporary Directory", \$CONFIG{TEMP_DIR}); >- ask_confirm("Perl Module Directory", \$CONFIG{MODULE_DIR}); >- ask_confirm("Executable Directory", \$CONFIG{BIN_DIR}); >- ask_confirm("Man-Page Directory (! to skip)", \$CONFIG{MAN_DIR}); >- ask_confirm("Log Directory", \$CONFIG{LOG_DIR}); >+ ask_confirm("Temporary Directory", \$CONFIG{TEMP_DIR}, $QUIET); >+ ask_confirm("Perl Module Directory", \$CONFIG{MODULE_DIR}, $QUIET); >+ ask_confirm("Executable Directory", \$CONFIG{BIN_DIR}, $QUIET); >+ ask_confirm("Man-Page Directory (! to skip)", \$CONFIG{MAN_DIR}, $QUIET); >+ ask_confirm("Log Directory", \$CONFIG{LOG_DIR}, $QUIET); > ask_confirm("PID File Location", \$CONFIG{PID_FILE}); >+ ask_confirm("Mason Component Directory", \$CONFIG{MASON_COMP_ROOT}, $QUIET); >+ ask_confirm("Mason Data Directory", \$CONFIG{MASON_DATA_ROOT}, $QUIET); >+ > $CONFIG{PID_FILE} = catfile($CONFIG{PID_FILE}, 'httpd.pid') > if -d $CONFIG{PID_FILE}; >- ask_confirm("Mason Component Directory", \$CONFIG{MASON_COMP_ROOT}); >- ask_confirm("Mason Data Directory", \$CONFIG{MASON_DATA_ROOT}); > } >Index: inst/postgres.pl >=================================================================== >--- inst/postgres.pl (revision 6083) >+++ inst/postgres.pl (working copy) >@@ -36,6 +36,10 @@ > use File::Spec::Functions; > use Data::Dumper; > >+# check whether questions should be asked >+our $QUIET; >+$QUIET = 1 if $ARGV[0] and $ARGV[0] eq 'QUIET'; >+ > print "\n\n==> Probing PostgreSQL Configuration <==\n\n"; > > our %PG; >@@ -122,13 +126,13 @@ > # ask the user for user settings > sub get_users { > print "\n"; >- ask_confirm("Postgres Root Username", \$PG{root_user}); >+ ask_confirm("Postgres Root Username", \$PG{root_user}, $QUIET); > ask_confirm("Postgres Root Password (leave empty for no password)", > \$PG{root_pass}); > > while(1) { > $PG{system_user} = $PG{root_user}; >- ask_confirm("Postgres System Username", \$PG{system_user}); >+ ask_confirm("Postgres System Username", \$PG{system_user}, $QUIET); > $PG{system_user_uid} = (getpwnam($PG{system_user}))[2]; > last if defined $PG{system_user_uid}; > print "User \"$PG{system_user}\" not found! This user must exist ". >Index: inst/modules.pl >=================================================================== >--- inst/modules.pl (revision 6083) >+++ inst/modules.pl (working copy) >@@ -36,6 +36,10 @@ > use File::Spec::Functions; > use Data::Dumper; > >+# check whether questions should be asked >+our $QUIET; >+$QUIET = 1 if $ARGV[0] and $ARGV[0] eq 'QUIET'; >+ > print "\n\n==> Probing Required Perl Modules <==\n\n"; > > our @MOD; >@@ -49,8 +53,8 @@ > $rec->{found} = check_module($rec); > unless ($rec->{found}) { > if ($rec->{optional} and >- not ask_yesno("Do you want to install the optional module " . >- "$rec->{name}? [no] ", 0)) { >+ not ask_yesno("Do you want to install the optional module " . >+ "$rec->{name}? [no] ", 0, $QUIET)) { > $rec->{found} = 1; > } else { > $MISSING = 1; >@@ -73,7 +77,7 @@ > END > > # for some reason an "exit 1" here doesn't stop the make run. >- kill(2, $$) unless ask_yesno("Continue? [yes] ", 1); >+ kill(2, $$) unless ask_yesno("Continue? [yes] ", 1, $QUIET); > } > > >Index: inst/required.pl >=================================================================== >--- inst/required.pl (revision 6083) >+++ inst/required.pl (working copy) >@@ -67,6 +67,10 @@ > our %REQ; > our %RESULTS; > >+# check to see whether we should ask questions or not >+our $QUIET; >+$QUIET = 1 if $ARGV[0] and $ARGV[0] eq 'QUIET'; >+ > # collect data - configuration requirements data goes into %REQ, raw > # binary pass/fail goes into %RESULTS. > >@@ -125,13 +129,13 @@ > # confirm or deny > if ($REQ{PG_CONFIG}) { > print "Found PostgreSQL's pg_config at '$REQ{PG_CONFIG}'.\n"; >- unless (ask_yesno("Is this correct? [yes] ", 1)) { >+ unless (ask_yesno("Is this correct? [yes] ", 1, $QUIET)) { > ask_confirm("Enter path to pg_config", \$REQ{PG_CONFIG}); > } > } else { > print "Failed to find pg_config.\n"; > if (ask_yesno("Do you want to provide a path to pg_config? [no] ", >- 0)) { >+ 0, $QUIET)) { > $REQ{PG_CONFIG} = 'NONE'; > ask_confirm("Enter path to pg_config", \$REQ{PG_CONFIG}); > } else { >@@ -188,7 +192,7 @@ > # confirm or deny > if ($REQ{APACHE_EXE}) { > print "Found Apache server binary at '$REQ{APACHE_EXE}'.\n"; >- unless (ask_yesno("Is this correct? [yes] ", 1)) { >+ unless ($QUIET or ask_yesno("Is this correct? [yes] ", 1)) { > ask_confirm("Enter path to Apache server binary", > \$REQ{APACHE_EXE}); > } >@@ -196,7 +200,7 @@ > print "Failed to find Apache server binary.\n"; > if (ask_yesno("Do you want to provide a path to the Apache server " . > "binary? [no] ", >- 0)) { >+ 0, $QUIET)) { > $REQ{APACHE_EXE} = 'NONE'; > ask_confirm("Enter path to Apache server binary", > \$REQ{APACHE_EXE}); >Index: inst/apache.pl >=================================================================== >--- inst/apache.pl (revision 6083) >+++ inst/apache.pl (working copy) >@@ -36,6 +36,10 @@ > use File::Spec::Functions; > use Data::Dumper; > >+# check whether questions should be asked >+our $QUIET; >+$QUIET = 1 if $ARGV[0] and $ARGV[0] eq 'QUIET'; >+ > print "\n\n==> Probing Apache Configuration <==\n\n"; > > our %AP; >@@ -296,17 +300,17 @@ > > END > >- ask_confirm("Apache User:\t\t\t", \$AP{user}); >- ask_confirm("Apache Group:\t\t\t", \$AP{group}); >- ask_confirm("Apache Port:\t\t\t", \$AP{port}); >- ask_confirm("Apache Server Name:\t\t", \$AP{server_name}); >+ ask_confirm("Apache User:\t\t\t", \$AP{user}, $QUIET); >+ ask_confirm("Apache Group:\t\t\t", \$AP{group}, $QUIET); >+ ask_confirm("Apache Port:\t\t\t", \$AP{port}, $QUIET); >+ ask_confirm("Apache Server Name:\t\t", \$AP{server_name}, $QUIET); > > # install fails if this is wrong > $AP{ssl_key} = catfile($AP{HTTPD_ROOT}, "conf", "ssl.key", "server.key"); > $AP{ssl_cert} = catfile($AP{HTTPD_ROOT}, "conf", "ssl.crt","server.crt"); > > if ($AP{ssl} or $AP{apache_ssl}) { >- if (ask_yesno("Do you want to use SSL? [no] ", 0)) { >+ if (ask_yesno("Do you want to use SSL? [no] ", 0, $QUIET)) { > if ($AP{ssl} and $AP{apache_ssl}) { > $AP{ssl} = ask_choice("Which SSL module do you use? " . > "(apache_ssl or mod_ssl) ", >Index: inst/lib/Bric/Inst.pm >=================================================================== >--- inst/lib/Bric/Inst.pm (revision 6083) >+++ inst/lib/Bric/Inst.pm (working copy) >@@ -76,20 +76,35 @@ > exit 1; > } > >-=item ask_yesno($question, $default) >+=item ask_yesno($question, $default, $quiet_mode) > > Asks the user a yes/no question. Default to $default if they just > press [return]. Returns 1 for a yes answer and 0 for no. > >+If $quiet_mode is true the default answer is returned without >+asking for user input (useful for unattended execution where >+appropriate default values can be passed to this sub). >+ >+Be careful when using ask_yesno in quiet mode: if you're asking >+confirmation for a potentially dangerous task either be sure >+to set the "forget it" answer as default or don't allow >+quiet mode at all. >+ > =cut > > sub ask_yesno { >- my ($question, $default) = @_; >+ my ($question, $default, $quiet_mode) = @_; > my $tries = 1; > local $| = 1; > while (1) { > print $question; >- my $answer = <STDIN>; >+ # just print a newline after the question to keep >+ # output tidy, if we are in quiet mode >+ print "\n" if $quiet_mode; >+ >+ my $answer= ''; >+ # do not wait for user input if we are in quiet mode >+ $answer = <STDIN> unless $quiet_mode; > chomp($answer); > return $default if not length $answer; > return 0 if $answer and $answer =~ /^no?$/i; >@@ -100,50 +115,81 @@ > } > > >-=item ask_confirm($description, $ref_to_setting) >+=item ask_confirm($description, $ref_to_setting, $quiet_mode) > > Asks the user to confirm a setting. If they enter a new value asks > "are you sure." Directly updates the setting and returns when done. > > A default setting of "NONE" will force the user to enter a value. > >+If $quiet_mode is true the default answer is returned without >+asking for user input (useful for unattended execution where >+appropriate default values can be passed to this sub). >+ >+The question is printed anyway, so that the default value appears >+in the output. >+ > =cut > > sub ask_confirm { >- my ($desc, $ref) = @_; >+ my ($desc, $ref, $quiet_mode) = @_; > my $tries = 1; > local $| = 1; > while (1) { > print $desc, " [", $$ref, "] "; >- my $answer = <STDIN>; >+ # just print a newline after the question to keep >+ # output tidy, if we are in quiet mode >+ print "\n" if $quiet_mode; >+ >+ my $answer= ''; >+ # do not wait for user input if we are in quiet mode >+ $answer = <STDIN> unless $quiet_mode; > chomp($answer); > if (not length $answer or $answer eq $$ref) { >+ if($quiet_mode and $$ref eq 'NONE') { >+ print "No default is available for this question: ", >+ "cannot continue quiet mode execution"; >+ return; >+ } > return unless $$ref eq 'NONE'; > print "No default is available for this question, ", > "please enter a value.\n"; > next; > } >- if (ask_yesno("Are you sure you want to use '$answer'? [yes] ", 1)) { >+ if (ask_yesno("Are you sure you want to use '$answer'? [yes] ", 1, $quiet_mode)) { > $$ref = $answer; > return; > } > } > } > >-=item ask_choice($question, [ "opt1", "opt2" ], "default") >+=item ask_choice($question, [ "opt1", "opt2" ], "default", $quiet_mode) > > Asks the user to choose from a list of options. Returns the option > selected. > >+If $quiet_mode is true the default answer is returned without >+asking for user input (useful for unattended execution where >+appropriate default values can be passed to this sub). >+ >+The question is printed anyway, so that the default value appears >+in the output. >+ > =cut > > sub ask_choice { >- my ($desc, $choices, $default) = @_; >+ my ($desc, $choices, $default, $quiet_mode) = @_; > my $tries = 1; > local $| = 1; > while (1) { > print $desc, " [", $default, "] "; >- my $answer = <STDIN>; >+ # just print a newline after the question to keep >+ # output tidy, if we are in quiet mode >+ print "\n" if $quiet_mode; >+ >+ my $answer= ''; >+ # do not wait for user input if we are in quiet mode >+ $answer = <STDIN> unless $quiet_mode; > chomp($answer); > $answer = lc $answer; > return $default if not length $answer; >Index: inst/clone.pl >=================================================================== >--- inst/clone.pl (revision 6083) >+++ inst/clone.pl (working copy) >@@ -19,6 +19,18 @@ > install.db if available. Outputs to the various .db files used by > later stages of the install. > >+The following configuration variables can be set using environment >+variables: C<$BRICOLAGE_ROOT>, C<$CONFIG_DIR>, C<$CLONE_NAME>, >+e.g.: >+ >+ make CLONE_NAME=unattended_archive clone >+ >+If the environment variable C<$INSTALL_VERBOSITY> is set to "QUIET" >+this script won't ask for confirmations so that unattended >+execution is possible: >+ >+ make INSTALL_VERBOSITY=QUIET clone >+ > =head1 AUTHOR > > Sam Tregar <stregar@about-inc.com> >@@ -37,10 +49,13 @@ > use Data::Dumper; > use POSIX 'strftime'; > >+# determine if clone should run in quiet mode >+my $quiet_mode = (defined $ENV{INSTALL_VERBOSITY} and $ENV{INSTALL_VERBOSITY} eq 'QUIET') ? 1 : 0; >+ > # make sure we're root, otherwise uninformative errors result > unless ($> == 0) { > print "This process must (usually) be run as root.\n"; >- exit 1 unless ask_yesno("Continue as non-root user? [yes] ", 1); >+ exit 1 unless ask_yesno("Continue as non-root user? [yes] ", 1, $quiet_mode); > } > > # setup default root >@@ -80,19 +95,25 @@ > # get clone name > sub get_clone_name { > print "\n"; >- $CLONE{NAME} = strftime '%Y%m%d%H%M%S', localtime; >+ $CLONE{NAME} = $ENV{CLONE_NAME} || strftime '%Y%m%d%H%M%S', localtime; >+ > ask_confirm("What would you like to name your clone ". >- "(used to name the archive)? ", \$CLONE{NAME}); >+ "(used to name the archive)? ", \$CLONE{NAME}, >+ $quiet_mode); > } > > # find the bricolage to update > sub get_bricolage_root { > ask_confirm("Bricolage Root Directory to Clone?", >- \$CLONE{BRICOLAGE_ROOT}); >+ \$CLONE{BRICOLAGE_ROOT}, >+ $quiet_mode); > >- $CLONE{CONFIG_DIR} = catdir $CLONE{BRICOLAGE_ROOT}, 'conf'; >+ $CLONE{CONFIG_DIR} = $ENV{CONFIG_DIR} || >+ catdir $CLONE{BRICOLAGE_ROOT}, 'conf'; >+ > ask_confirm("Bricolage Config Directory", >- \$CLONE{CONFIG_DIR}); >+ \$CLONE{CONFIG_DIR}, >+ $quiet_mode); > > # verify that we have a Bricolage install here > hard_fail("No Bricolage installation found in $CLONE{BRICOLAGE_ROOT}.\n") >@@ -123,7 +144,7 @@ > The installed version ("$VERSION") is not same as this version! "make > clone" is only designed to work with like versions. > END >- exit 1 unless ask_yesno("Continue with clone? [no] ", 0); >+ exit 1 unless ask_yesno("Continue with clone? [no] ", 0, $quiet_mode); > @todo = ($VERSION); > > } >@@ -133,13 +154,17 @@ > sub confirm_paths { > print "\nPlease confirm the Bricolage clone source directories.\n\n"; > ask_confirm("Bricolage Perl Module Directory", >- \$INSTALL->{CONFIG}{MODULE_DIR}); >+ \$INSTALL->{CONFIG}{MODULE_DIR}, >+ $quiet_mode); > ask_confirm("Bricolage Executable Directory", >- \$INSTALL->{CONFIG}{BIN_DIR}); >+ \$INSTALL->{CONFIG}{BIN_DIR}, >+ $quiet_mode); > ask_confirm("Mason Component Directory", >- \$INSTALL->{CONFIG}{MASON_COMP_ROOT}); >+ \$INSTALL->{CONFIG}{MASON_COMP_ROOT}, >+ $quiet_mode); > ask_confirm("Mason Data Directory", >- \$INSTALL->{CONFIG}{MASON_DATA_ROOT}); >+ \$INSTALL->{CONFIG}{MASON_DATA_ROOT}, >+ $quiet_mode); > } > > # output .db files used by installation steps
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 21549
:
28276
|
42093
|
44105
|
95853
|
95854