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