Changeset 1225 in MondoRescue


Ignore:
Timestamp:
Mar 6, 2007, 1:08:18 PM (17 years ago)
Author:
Bruno Cornec
Message:

mondo-web now uses the mondo configuration file for its initial setup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo-web/mondo-web.pl

    r1223 r1225  
    1818use Data::Dumper;
    1919use AppConfig;
    20 use AppConfig::File;
    2120
    2221my $cgi = new CGI;
     22my $default = "";
     23my @default;
    2324
    2425# Handling Configuration files
    25 #my $file = "/etc/mondo/mondo.conf.dist";
    26 #my $config = AppConfig->new();
    27 #my $cfgfile = $config->file($file);
    28 #$config->parse($file);            # read config file
    29 #print Dumper($cfgfile);
     26my $file1 = "/etc/mondo/mondo.conf.dist";
     27my $file2 = "/etc/mondo/mondo.conf";
     28
     29my $config = AppConfig->new({
     30                # Auto Create variables mentioned in Conf file
     31                CREATE => 1,
     32                DEBUG => 0,
     33                GLOBAL => {
     34                    # Each conf item has one single parameter
     35                    ARGCOUNT => AppConfig::ARGCOUNT_ONE
     36                }
     37            });
     38$config->file($file1, $file2);
    3039
    3140my $command="";
     
    5564my @options = sort keys %options;
    5665my %speed = (
     66        1 => '1x',
    5767        2 => '2x',
    5868        4 => '4x',
     
    111121    print "Destination path or device:\n";
    112122    print $cgi->textfield(-name=>'dest',
    113                 -default=>'',
     123                -default=>$config->get("mondo_images_dir"),
    114124                -size=>15,
    115125                -maxlenght=>150);
     
    117127    print "Size of media (MB):\n";
    118128    print $cgi->textfield(-name=>'size',
    119                 -default=>'4380',
     129                -default=>$config->get("mondo_media_size"),
    120130                -size=>6,
    121131                -maxlenght=>6);
     
    125135    print $cgi->h2('Compression Info');
    126136    print "<TABLE><TR><TD WIDTH=330>\n";
     137    $default = 'GZIP' if ($config->get("mondo_compression_tool") =~ /gzip/);
     138    $default = 'BZIP2' if ($config->get("mondo_compression_tool") =~ /bzip2/);
     139    $default = 'LZO' if ($config->get("mondo_compression_tool") =~ /lzo/);
    127140    print "Compression tool: ",$cgi->popup_menu(-name=>'comp',
    128141            -values=>\@comp,
    129             -default=>'GZIP',
     142            -default=>$default,
    130143            -labels=>\%comp);
    131144    print "</TD><TD WIDTH=300>\n";
    132145    print "Compression ratio: ",$cgi->popup_menu(-name=>'compratio',
    133146            -values=>\@ratio,
    134             -default=>6,
     147            -default=>$config->get("mondo_compression_level"),
    135148            -labels=>\%ratio);
    136149    print "</TD></TR></TABLE>\n";
     
    139152    print $cgi->h2('Optional Info');
    140153    print "<TABLE><TR><TD WIDTH=360>\n";
     154
     155    @default = (@default,'AUTO') if ($config->get("mondo_automatic_restore") =~ /yes/);
     156    @default = (@default,'NOFLOPPY') if ($config->get("mondo_write_boot_floppy") =~ /no/);
     157    @default = (@default,'DIFF') if ($config->get("mondo_differential") =~ /yes/);
     158    #'NFSEXCL' => 'Exclude Network File Systems',
     159    @default = (@default, 'NFSEXCL');
     160    #'NOBOOTABLE' => 'Create Non-Bootable media',
     161    #'MANEJECT' => 'Manual media ejection',
     162    #'VERIF' => 'Media verification (Slower)',
     163    #'XATTR' => 'Extended Attributes and ACL Management (Slower)'
    141164    print $cgi->checkbox_group(-name=>'options',
    142165            -values=>\@options,
    143             -defaults=>['NFSEXCL', 'NOFLOPPY'],
     166            -defaults=>\@default,
    144167            -linebreak=>'true',
    145168            -labels=>\%options);
     
    147170    print "Temporary Directory:\n";
    148171    print $cgi->textfield(-name=>'temp',
    149                 -default=>'/var/cache/mondo/tmp',
     172                -default=>$config->get("mondo_tmp_dir"),
    150173                -size=>25,
    151174                -maxlenght=>150);
     
    153176    print "Scratch Directory:\n";
    154177    print $cgi->textfield(-name=>'scratch',
    155                 -default=>'/var/cache/mondo/scratch',
     178                -default=>$config->get("mondo_scratch_dir"),
    156179                -size=>25,
    157180                -maxlenght=>150);
     
    159182    print "ISO Image Name Prefix:\n";
    160183    print $cgi->textfield(-name=>'prefix',
    161                 -default=>'mondorescue',
     184                -default=>$config->get("mondo_prefix"),
    162185                -size=>15,
    163186                -maxlenght=>150);
     
    165188    print "Tape block size:\n";
    166189    print $cgi->textfield(-name=>'block',
    167                 -default=>'32768',
     190                -default=>$config->get("mondo_external_tape_blocksize"),
    168191                -size=>10,
    169192                -maxlenght=>10);
     
    171194    print "Media Speed (if pertinent): ",$cgi->popup_menu(-name=>'speed',
    172195            -values=>\@speed,
    173             -default=>$speed[-1],
     196            -default=>$config->get("mondo_iso_burning_speed"),
    174197            -labels=>\%speed);
    175198    print "<BR>";
    176199    print "Kernel:\n";
    177200    print $cgi->textfield(-name=>'kernel',
    178                 -default=>'NATIVE',
     201                -default=>$config->get("mondo_kernel"),
    179202                -size=>30,
    180203                -maxlenght=>150);
     
    196219    print "Bootloader:<BR>\n",$cgi->radio_group(-name=>'boot',
    197220            -values=>\@boot,
    198             -default=>'NATIVE',
     221            -default=>$config->get("mondo_boot_loader"),
    199222            -linebreak=>'true',
    200223            -labels=>\%boot);
     
    203226    print $cgi->popup_menu(-name=>'debug',
    204227            -values=>\@ratio,
    205             -default=>2,
     228            -default=>$config->get("mondo_log_level"),
    206229            -labels=>\%ratio);
    207230    print "</TD><TD>\n";
    208231    print "Excluded directories:\n";
    209232    print $cgi->textfield(-name=>'exclude',
    210                 -default=>'',
     233                -default=>$config->get("mondo_exclude_files"),
    211234                -size=>30,
    212235                -maxlenght=>150);
     
    214237    print "Included directories:\n";
    215238    print $cgi->textfield(-name=>'include',
    216                 -default=>'',
     239                -default=>$config->get("mondo_include_files"),
    217240                -size=>30,
    218241                -maxlenght=>150);
Note: See TracChangeset for help on using the changeset viewer.