lilalo

annotate l3config.pm @ 60:0b1553611bb5

В l3scripts добавился скрипт send-current-lablogs
author devi
date Sat Jan 14 18:23:11 2006 +0200 (2006-01-14)
parents d3fcff5e3757
children 1e1422588716
rev   line source
devi@32 1
devi@23 2 package l3config;
devi@23 3
devi@23 4 use Exporter;
devi@30 5 use vars qw(@ISA @EXPORT $VERSION);
devi@23 6 use Getopt::Long;
devi@23 7
devi@23 8 @ISA = ('Exporter');
devi@23 9 @EXPORT = qw(%Config &init_config);
devi@23 10
devi@32 11 our $System_Config_File = "/etc/lilalo.conf";
devi@32 12 our $User_Config_File = "$ENV{HOME}/.lilalo.conf";
devi@32 13 $ENV{HOME} ||= "/tmp";
devi@32 14
devi@32 15
devi@23 16 our %Config = (
devi@58 17 "skip_empty" => "yes",
devi@58 18 "skip_interrupted" => "no",
devi@58 19 "skip_wrong" => "no",
devi@58 20 "editors" => ["vi", "pico", "ee", "vim", "nano"],
devi@58 21 "pagers" => ["more", "less", "zmore", "zless", "info",
devi@58 22 "man", "mc", "trafshow", "screen", "cfdisk",
devi@58 23 "trafshow-bsd", "yes", "lynx", "links", "centericq"
devi@58 24 ],
devi@58 25 "terminal" => ["mc"],
devi@58 26 "suppress_editors" => "yes",
devi@58 27 "suppress_pagers" => "yes",
devi@58 28 "suppress_terminal" => "yes",
devi@23 29
devi@58 30 "terminal_width" => 400,
devi@58 31 "terminal_height" => 100,
devi@58 32 "verbose" => "yes",
devi@23 33
devi@58 34 "head_lines" => 5,
devi@58 35 "tail_lines" => 5,
devi@58 36 "cache_head_lines" => 50,
devi@58 37 "cache_tail_lines" => 50,
devi@58 38 "skip_text" => "...",
devi@58 39 "show_time" => "yes",
devi@58 40 "show_diffs" => "yes",
devi@58 41 "show_comments" => "yes",
devi@58 42 "show_notes" => "yes",
devi@23 43
devi@58 44 "input" => "$ENV{HOME}/.lilalo",
devi@58 45 "diffs" => "",
devi@58 46 "input_mask" => "*.script",
devi@58 47 "encoding" => "utf-8",
devi@23 48
devi@58 49 "cache" => "$ENV{HOME}/.lilalo/report.xml",
devi@58 50 "cache_stat" => "$ENV{HOME}/.lilalo/.report.dat",
devi@23 51
devi@58 52 "output" => "/tmp/report.html",
devi@58 53 "output_mask" => "INDEX",
devi@58 54 "output_format" => "html",
devi@58 55 "frontend_css" => "/l3/l3.css",
devi@58 56 "frontend_google_ico" => "/l3/google.ico",
devi@58 57 "frontend_linux_ico" => "/l3/linux.ico",
devi@58 58 "frontend_freebsd_ico" => "/l3/freebsd.ico",
devi@58 59 "frontend_opennet_ico" => "/l3/opennet.ico",
devi@58 60 "frontend_local_ico" => "/l3/freebsd.ico",
devi@23 61
devi@58 62 "mywi_server" => "127.0.0.1",
devi@58 63 "mywi_port" => "19801",
devi@31 64
devi@58 65 "stat_inactivity_interval" => "1800",
devi@23 66
devi@58 67 "signature" => "#lm:",
devi@58 68 "from" => "",
devi@58 69 "to" => "",
devi@58 70 "lab" => "",
devi@58 71 "keywords" => "linux command",
devi@58 72 "files_keywords" => "linux file",
devi@27 73
devi@58 74 comment_width => "300",
devi@58 75 note_width => "500",
devi@58 76 time_width => "60",
devi@30 77
devi@58 78 "mode" => "daemon", # daemon | normal
devi@58 79 "daemon_sleep_interval" => "10",
devi@58 80 "detach" => "yes",
devi@58 81 "agent_pidfile" => "$ENV{HOME}/.lilalo/l3-agent.pid",
devi@30 82
devi@58 83 "backend_address" => "192.168.15.254",
devi@58 84 "backend_port" => "18030",
devi@58 85 "backend_pidfile" => "/tmp/l3-backend.pid",
devi@58 86 "backend_datafile" => "/var/lilalo/lablogs-xml/backend.xml",
devi@30 87
devi@58 88 "l3-agent" => "l3-agent",
devi@58 89 "l3-backend" => "l3-backend",
devi@30 90
devi@58 91 "course-name" => "",
devi@58 92 "course-code" => "",
devi@58 93 "course-date" => "",
devi@58 94 "course-center" => "",
devi@58 95 "course-trainer" => "",
devi@58 96 "course-student" => "",
devi@30 97
devi@58 98 "filter" => "",
devi@58 99 #lm
devi@58 100 "show_host" => "no",
devi@30 101
devi@58 102 # Вспомогательные программы
devi@58 103 #"l3-report" => "./lm-report",
devi@58 104 "l3-report" => "./l3-report",
devi@40 105
devi@58 106 # Каталоги
devi@58 107 "path_lilalo" => "/var/lilalo/",
devi@58 108 "path_classes" => "/var/lilalo/classes/",
devi@58 109 "path_lablogs" => "/var/lilalo/lablogs/",
devi@58 110 "courses_path" => "/var/lilalo/courses/",
devi@58 111 "outpath" => "/var/lilalo/out/",
devi@58 112 "path_web" => "/var/www/l3", # Путь к web-отчётам
devi@58 113 "path_share" => "./share/", # Путь к web-отчётам
devi@48 114
devi@58 115 # Файлы
devi@58 116 "runfile" => "lm.run",
devi@58 117 "logfile" => "lm.log",
devi@58 118
devi@58 119 "class" => "class", # Имя файла класса
devi@58 120 "class_suffix" => ".xml", # Cуффикс файла класса
devi@58 121 "classfile" => "",
devi@58 122
devi@58 123 "sshkey" => "$ENV{HOME}/.ssh/id_dsa.pub",
devi@58 124 "lmssh" => "./lm-ssh",
devi@58 125 "lminstall" => "./lm-install",
devi@58 126 "ssh_user" => "root",
devi@58 127
devi@58 128 "l3scripts" => "l3scripts",
devi@58 129
devi@58 130
devi@58 131 "cgi_path_info" => "",
devi@58 132 "cgi2file" => "",
devi@58 133
devi@58 134 "year" => "2006",
devi@58 135 );
devi@23 136
devi@23 137 sub read_config_file
devi@23 138 {
devi@23 139 my $config = $_[0];
devi@23 140 my $filename = $_[1];
devi@23 141 open(CONFIG, "$filename")
devi@23 142 or return;
devi@23 143 while (<CONFIG>) {
devi@23 144 s/#.*//;
devi@23 145 next if /^\s*$/;
devi@23 146 my ($var, $val) = split /\s*=\s*/, $_, 2;
devi@23 147 $var =~ s/\s*//;
devi@23 148 $config->{$var} = $val;
devi@23 149 }
devi@23 150 close(CONFIG);
devi@23 151 }
devi@23 152
devi@23 153
devi@23 154 sub init_config
devi@23 155 {
devi@23 156 my %argv_config;
devi@23 157 my %file_config;
devi@32 158 read_config_file(\%file_config, $System_Config_File);
devi@32 159 read_config_file(\%file_config, $User_Config_File);
devi@23 160 GetOptions(\%argv_config, map "$_=s", keys %Config);
devi@23 161 %Config = (%Config, %file_config, %argv_config);
devi@23 162 }
devi@23 163