Debian Codegraph @

bin/msandbox

raw ◀ ▶
1 Debian patch touch this file
1 #!/usr/bin/perl
2 # sandbox
3 # The MySQL Sandbox
4 # Copyright (C) 2006-2018 Giuseppe Maxia
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18 use strict;
19 use warnings;
20
21 use English qw( -no_match_vars );
22 use Data::Dumper;
23 use MySQL::Sandbox qw(runs_as_root);
24
25 my $DEBUG = $MySQL::Sandbox::DEBUG;
26
27 runs_as_root();
28
29 #my $install_dir;
30 #$install_dir = $PROGRAM_NAME;
31 #$install_dir =~ s{/\w+(\.pl)?$}{};
32
33 my $msb = MySQL::Sandbox->new();
34
35 my @apps = (
36 {
37 name => 'make_sandbox',
38 description => 'the easiest way of creating a sandbox',
39 },
40 {
41 name => 'low_level_make_sandbox',
42 description => q{create a single sandbox, with fine tuning options (don't use directly)},
43 },
44 {
45 name => 'make_replication_sandbox',
46 description => 'creates a sandbox with replicated master and slaves or circular',
47 },
48 {
49 name => 'make_multiple_sandbox',
50 description => 'creates a group of sandboxes with the same version',
51 },
52 {
53 name => 'make_multiple_custom_sandbox',
54 description => 'create a group of sandboxes with different versions',
55 },
56 {
57 name => 'make_sandbox_from_source',
58 description => 'create a sandbox from a build directory',
59 },
60 {
61 name => 'make_sandbox_from_installed',
62 description => 'create a sandbox from already installed binaries',
63 },
64 {
65 name => 'sbtool',
66 description => 'performs auxiliary actions with existing sandboxes',
67 },
68 );
69
70 my $choice = shift
71 or help();
72 if (grep {$choice eq $_->{name} } @apps ) {
73 my $application = "$choice";
74 if ( -x $application) {
75 exec $application, @ARGV;
76 }
77 else {
78 die "application $application not found\n";
79 }
80 }
81 else {
•82 exec "man MySQL::Sandbox";
83 #die "'$choice' is not an application in MySQL Sandbox\n";
84 }
85
86 sub help {
87 print $msb->credits();
88 print "available applications:\n";
89 for my $app (@apps) {
90 printf " %-30s: %s\n", $app->{'name'}, $app->{'description'};
91 }
92 exit(1);
93 }
94
95 __END__
96